user32/tests: Add some tests for classes with non-zero low word instance.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Dmitry Timoshkov 2020-02-19 12:29:54 +08:00 committed by Alexandre Julliard
parent 3641983714
commit e2c0f51312
1 changed files with 31 additions and 0 deletions

View File

@ -98,6 +98,7 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
LONG i;
WCHAR str[20];
ATOM classatom;
HINSTANCE hInstance2;
cls.style = CS_HREDRAW | CS_VREDRAW | (global?CS_GLOBALCLASS:0);
cls.lpfnWndProc = ClassTest_WndProc;
@ -121,6 +122,26 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
"RegisterClass of the same class should fail for the second time\n");
/* Setup windows */
hInstance2 = (HINSTANCE)(((ULONG_PTR)hInstance & ~0xffff) | 0xdead);
hTestWnd = CreateWindowW (className, winName,
WS_OVERLAPPEDWINDOW + WS_HSCROLL + WS_VSCROLL,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
0, hInstance2, 0);
todo_wine_if (!global)
ok(hTestWnd != 0, "Failed to create window for hInstance %p\n", hInstance2);
todo_wine_if (!global)
ok((HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE) == hInstance,
"Wrong GCL instance %p != %p\n",
(HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE), hInstance);
todo_wine_if (!global)
ok((HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE) == hInstance2,
"Wrong GWL instance %p != %p\n",
(HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE), hInstance2);
DestroyWindow(hTestWnd);
hTestWnd = CreateWindowW (className, winName,
WS_OVERLAPPEDWINDOW + WS_HSCROLL + WS_VSCROLL,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
@ -128,6 +149,14 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
ok(hTestWnd!=0, "Failed to create window\n");
ok((HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE) == hInstance,
"Wrong GCL instance %p/%p\n",
(HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE), hInstance);
ok((HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE) == hInstance,
"Wrong GWL instance %p/%p\n",
(HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE), hInstance);
/* test initial values of valid classwords */
for(i=0; i<NUMCLASSWORDS; i++)
{
@ -1491,6 +1520,8 @@ START_TEST(class)
ClassTest(hInstance,FALSE);
ClassTest(hInstance,TRUE);
ClassTest((HANDLE)((ULONG_PTR)hInstance | 0x1234), FALSE);
ClassTest((HANDLE)((ULONG_PTR)hInstance | 0x1234), TRUE);
CreateDialogParamTest(hInstance);
test_styles();
test_builtinproc();