ReactOS 0.4.15-dev-7988-g06a3508
GetClassInfo.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Tests for GetClassInfo
5 * COPYRIGHT: Copyright 2023 Timo Kreuzer <timo.kreuzer@reactos.org>
6 */
7
8#include "precomp.h"
9
11{
12 return ((GetVersion() & 0xFF) << 8) |
13 ((GetVersion() >> 8) & 0xFF);
14}
15
17{
18 WNDCLASSEXW wcex;
20
21 memset(&wcex, 0xab, sizeof(wcex));
22
25
26 ok_hex(wcex.cbSize, 0xabababab);
27 ok_hex(wcex.style, 0x8);
28 ok(wcex.lpfnWndProc != NULL, "lpfnWndProc shound't be NULL\n");
29 ok_int(wcex.cbClsExtra, 0);
30 ok_int(wcex.cbWndExtra, GetWinVersion() <= 0x502 ? 8 : 0);
32 ok_ptr(wcex.hIcon, NULL);
33 ok(wcex.hCursor != NULL, "hCursor shound't be NULL\n");
34 if (GetWinVersion() > 0x502)
35 ok_ptr(wcex.hbrBackground, (HBRUSH)(ULONG_PTR)2);
36 else
37 ok(wcex.hbrBackground != NULL, "hbrBackground shound't be NULL\n");
40 ok_ptr(wcex.hIconSm, NULL);
41}
42
44{
45 WNDCLASSEXW wcex;
47
48 memset(&wcex, 0xab, sizeof(wcex));
49
52
53 ok_hex(wcex.cbSize, 0xabababab);
54 ok_hex(wcex.style, 0x808);
55 ok(wcex.lpfnWndProc != NULL, "lpfnWndProc shound't be NULL\n");
56 ok_int(wcex.cbClsExtra, 0);
57 ok_int(wcex.cbWndExtra, 30); // DLGWINDOWEXTRA
59 ok_ptr(wcex.hIcon, NULL);
60 ok(wcex.hCursor != NULL, "hCursor shound't be NULL\n");
64 ok_ptr(wcex.hIconSm, NULL);
65}
66
68{
69 WNDCLASSEXW wcex;
71
72 memset(&wcex, 0xab, sizeof(wcex));
73
76
77 ok_hex(wcex.cbSize, 0xabababab);
78 ok_hex(wcex.style, 0x803);
79 ok_ptr(wcex.lpfnWndProc, NULL);
80 ok_int(wcex.cbClsExtra, 0);
81 ok_int(wcex.cbWndExtra, 16);
83 ok_ptr(wcex.hIcon, NULL);
84 ok(wcex.hCursor != NULL, "hCursor shound't be NULL\n");
88 ok_ptr(wcex.hIconSm, NULL);
89}
90
91
93{
94 WNDCLASSEXW wcex;
96
97 memset(&wcex, 0xab, sizeof(wcex));
98
101
102 ok_hex(wcex.cbSize, 0xabababab);
103 ok_hex(wcex.style, 0x803);
104 ok_ptr(wcex.lpfnWndProc, NULL);
105 ok_int(wcex.cbClsExtra, 0);
106 ok_int(wcex.cbWndExtra, GetWinVersion() <= 0x502 ? sizeof(ULONG_PTR) : 16);
108 ok_ptr(wcex.hIcon, NULL);
109 ok(wcex.hCursor != NULL, "hCursor shound't be NULL\n");
111 ok_ptr(wcex.lpszMenuName, NULL);
113 ok_ptr(wcex.hIconSm, NULL);
114}
115
117{
118 WNDCLASSEXW wcex;
119 ATOM atom;
120 BOOL result;
121
122 memset(&wcex, 0, sizeof(wcex));
123
124 wcex.cbSize = sizeof(WNDCLASSEXW);
125 wcex.style = 0x1;
127 wcex.cbClsExtra = 1;
128 wcex.cbWndExtra = 5;
130 wcex.hIcon = NULL;
131 wcex.hCursor = NULL;
132 wcex.hbrBackground = NULL;
133 wcex.lpszMenuName = NULL;
134 wcex.lpszClassName = L"ProTestClass1";
135 wcex.hIconSm = 0;
136
137 atom = RegisterClassExW(&wcex);
138 ok(atom != 0, "Failed to register class!\n");
139 if (atom == 0)
140 {
141 skip("Failed to register class!");
142 return;
143 }
144
145 memset(&wcex, 0xab, sizeof(wcex));
146
148 ok_int(result, atom);
149
150 ok_hex(wcex.cbSize, 0xabababab);
151 ok_hex(wcex.style, 0x1);
153 ok_int(wcex.cbClsExtra, 1);
154 ok_int(wcex.cbWndExtra, 5);
156 ok_ptr(wcex.hIcon, NULL);
157 ok_ptr(wcex.hIcon, NULL);
159 ok_ptr(wcex.lpszMenuName, NULL);
161 ok_ptr(wcex.hIconSm, NULL);
162}
163
165{
166 Test_Desktop();
167 Test_Dialog();
169 Test_Custom();
170}
VOID Test_Menu(VOID)
Definition: GetClassInfo.c:67
VOID Test_Desktop(VOID)
Definition: GetClassInfo.c:16
VOID Test_Dialog(VOID)
Definition: GetClassInfo.c:43
VOID Test_Custom(VOID)
Definition: GetClassInfo.c:116
VOID Test_SwitchWnd(VOID)
Definition: GetClassInfo.c:92
static USHORT GetWinVersion(VOID)
Definition: GetClassInfo.c:10
#define ok_hex(expression, result)
Definition: atltest.h:94
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ok_int(expression, result)
Definition: atltest.h:134
#define ok_ptr(expression, result)
Definition: atltest.h:108
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint64EXT * result
Definition: glext.h:11304
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
DWORD WINAPI GetVersion()
Definition: redirtest.c:5
#define memset(x, y, z)
Definition: compat.h:39
LPCWSTR lpszClassName
Definition: winuser.h:3226
LPCWSTR lpszMenuName
Definition: winuser.h:3225
HBRUSH hbrBackground
Definition: winuser.h:3224
WNDPROC lpfnWndProc
Definition: winuser.h:3218
UINT cbSize
Definition: winuser.h:3216
int cbWndExtra
Definition: winuser.h:3220
HCURSOR hCursor
Definition: winuser.h:3223
HICON hIconSm
Definition: winuser.h:3227
HINSTANCE hInstance
Definition: winuser.h:3221
UINT style
Definition: winuser.h:3217
int cbClsExtra
Definition: winuser.h:3219
HICON hIcon
Definition: winuser.h:3222
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define WC_SWITCH
Definition: undocuser.h:12
#define WC_DESKTOP
Definition: undocuser.h:10
#define WC_MENU
Definition: undocuser.h:9
#define WC_DIALOG
Definition: undocuser.h:11
#define GetModuleHandle
Definition: winbase.h:3827
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI GetClassInfoExW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSEXW)
#define GetClassInfo
Definition: winuser.h:5779
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
struct _WNDCLASSEXW WNDCLASSEXW
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185