From: Rémi Bernon rbernon@codeweavers.com
--- dlls/user32/tests/class.c | 164 +++++++++++++++++++++++++------------- 1 file changed, 108 insertions(+), 56 deletions(-)
diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c index 480f528e015..fdd49157721 100644 --- a/dlls/user32/tests/class.c +++ b/dlls/user32/tests/class.c @@ -1446,15 +1446,15 @@ static void test_IME(void) #define IS_INTRESOURCE(x) (((ULONG_PTR)(x) >> 16) == 0)
#define check_class_info_a( inst, name, expect ) check_class_info_a_( __FILE__, __LINE__, inst, name, expect, FALSE ) -static void check_class_info_a_( const char *file, int line, HINSTANCE instance, const char *name, const WNDCLASSA *expect, BOOL todo ) +static ATOM check_class_info_a_( const char *file, int line, HINSTANCE instance, const char *name, const WNDCLASSA *expect, BOOL todo ) { WNDCLASSA wc = {0}; - UINT ret; + UINT atom;
- ret = GetClassInfoA( instance, name, &wc ); - if (!expect) ok_(file, line)( !ret, "GetClassInfoA succeeded\n" ); - else ok_(file, line)( ret, "GetClassInfoA failed, error %lu\n", GetLastError() ); - if (!expect || !ret) return; + atom = GetClassInfoA( instance, name, &wc ); + if (!expect) ok_(file, line)( !atom, "GetClassInfoA succeeded\n" ); + else ok_(file, line)( atom, "GetClassInfoA failed, error %lu\n", GetLastError() ); + if (!expect || !atom) return atom;
ok_(file, line)( expect->style == wc.style, "got style %#x\n", wc.style ); todo_wine_if( todo ) ok_(file, line)( expect->lpfnWndProc == wc.lpfnWndProc, "got lpfnWndProc %p\n", wc.lpfnWndProc ); @@ -1470,6 +1470,8 @@ static void check_class_info_a_( const char *file, int line, HINSTANCE instance,
if (IS_INTRESOURCE(name)) ok_(file, line)( name == wc.lpszClassName, "got lpszClassName %s\n", debugstr_a( wc.lpszClassName ) ); else ok_(file, line)( !strcmp( name, wc.lpszClassName ), "got lpszClassName %s\n", debugstr_a( wc.lpszClassName ) ); + + return atom; }
#define check_atom_name_a( atom, expect ) check_atom_name_a_( __FILE__, __LINE__, atom, expect ) @@ -1642,7 +1644,8 @@ static void test_actctx_classes(void) class = RegisterClassA( &wc ); ok( class != 0, "RegisterClassA failed, error %lu\n", GetLastError() ); check_atom_name_a( class, wc.lpszClassName ); - check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc ); + check_atom_name_a( tmp_class, wc.lpszClassName ); ret = UnregisterClassA( wc.lpszClassName, hinst ); ok( ret, "UnregisterClassA failed, error %lu\n", GetLastError() ); check_atom_name_a( class, NULL ); @@ -1657,7 +1660,8 @@ static void test_actctx_classes(void) class = RegisterClassA( &wc_double_version ); ok( class != 0, "RegisterClassA failed, error %lu\n", GetLastError() ); todo_wine check_atom_name_a( class, wc_double_version.lpszClassName ); - check_class_info_a( hinst, "4.3.2.1!4.3.2.1!ClassVersion", &wc_double_version ); + tmp_class = check_class_info_a( hinst, "4.3.2.1!4.3.2.1!ClassVersion", &wc_double_version ); + todo_wine check_atom_name_a( tmp_class, "4.3.2.1!ClassVersion" ); ret = UnregisterClassA( "4.3.2.1!4.3.2.1!ClassVersion", hinst ); ok( ret, "UnregisterClassA failed, error %lu\n", GetLastError() ); check_atom_name_a( class, NULL ); @@ -1674,7 +1678,8 @@ static void test_actctx_classes(void) class = RegisterClassA( &wc ); ok( class != 0, "RegisterClassA failed, error %lu\n", GetLastError() ); todo_wine check_atom_name_a( class, wc.lpszClassName ); - check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc ); + todo_wine check_atom_name_a( tmp_class, wc.lpszClassName ); ret = DeactivateActCtx( 0, cookie ); ok( ret, "DeactivateActCtx failed, error %lu\n", GetLastError() ); todo_wine check_atom_name_a( class, wc.lpszClassName ); @@ -1718,18 +1723,23 @@ static void test_actctx_classes(void) class = RegisterClassA( &wc_versioned ); ok( class != 0, "RegisterClassA failed, error %lu\n", GetLastError() ); check_atom_name_a( class, wc_versioned.lpszClassName ); - check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_versioned ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_versioned ); + check_atom_name_a( tmp_class, wc_versioned.lpszClassName ); check_class_info_a( hinst, wc.lpszClassName, NULL ); - check_class_info_a( hinst, wc_versioned.lpszClassName, &wc_versioned ); + tmp_class = check_class_info_a( hinst, wc_versioned.lpszClassName, &wc_versioned ); + check_atom_name_a( tmp_class, wc_versioned.lpszClassName );
ret = ActivateActCtx( context, &cookie ); ok( ret, "ActivateActCtx failed, error %lu\n", GetLastError() ); check_atom_name_a( class, wc_versioned.lpszClassName );
/* GetClassInfoA now works with base name */ - check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_versioned ); - check_class_info_a( hinst, wc.lpszClassName, &wc_versioned ); - check_class_info_a( hinst, wc_versioned.lpszClassName, &wc_versioned ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_versioned ); + check_atom_name_a( tmp_class, wc_versioned.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc.lpszClassName, &wc_versioned ); + check_atom_name_a( tmp_class, wc_versioned.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc_versioned.lpszClassName, &wc_versioned ); + check_atom_name_a( tmp_class, wc_versioned.lpszClassName );
/* prevents the class to be registered when context is active */ tmp_class = RegisterClassA( &wc_versioned ); @@ -1756,21 +1766,29 @@ static void test_actctx_classes(void) ok( class_versioned != 0, "RegisterClassA failed, error %lu\n", GetLastError() ); check_atom_name_a( class_versioned, wc_versioned.lpszClassName );
- check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc ); - check_class_info_a( hinst, wc.lpszClassName, &wc ); - check_class_info_a( hinst, MAKEINTRESOURCEA( class_versioned ), &wc_versioned ); - check_class_info_a( hinst, wc_versioned.lpszClassName, &wc_versioned ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc ); + check_atom_name_a( tmp_class, wc.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc.lpszClassName, &wc ); + check_atom_name_a( tmp_class, wc.lpszClassName ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class_versioned ), &wc_versioned ); + check_atom_name_a( tmp_class, wc_versioned.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc_versioned.lpszClassName, &wc_versioned ); + check_atom_name_a( tmp_class, wc_versioned.lpszClassName );
ret = ActivateActCtx( context, &cookie ); ok( ret, "ActivateActCtx failed, error %lu\n", GetLastError() );
/* unversioned class redirects to the versioned class now */ check_atom_name_a( class, wc.lpszClassName ); - check_class_info_a_( __FILE__, __LINE__, hinst, MAKEINTRESOURCEA( class ), &wc_versioned, TRUE ); - check_class_info_a( hinst, wc.lpszClassName, &wc_versioned ); + tmp_class = check_class_info_a_( __FILE__, __LINE__, hinst, MAKEINTRESOURCEA( class ), &wc_versioned, TRUE ); + todo_wine check_atom_name_a( tmp_class, wc_versioned.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc.lpszClassName, &wc_versioned ); + check_atom_name_a( tmp_class, wc_versioned.lpszClassName ); check_atom_name_a( class_versioned, wc_versioned.lpszClassName ); - check_class_info_a( hinst, MAKEINTRESOURCEA( class_versioned ), &wc_versioned ); - check_class_info_a( hinst, wc_versioned.lpszClassName, &wc_versioned ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class_versioned ), &wc_versioned ); + check_atom_name_a( tmp_class, wc_versioned.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc_versioned.lpszClassName, &wc_versioned ); + check_atom_name_a( tmp_class, wc_versioned.lpszClassName );
/* prevents the class to be registered when context is active */ tmp_class = RegisterClassA( &wc_versioned ); @@ -1796,8 +1814,10 @@ static void test_actctx_classes(void) ret = DeactivateActCtx( 0, cookie ); ok( ret, "DeactivateActCtx failed, error %lu\n", GetLastError() ); check_atom_name_a( class, wc.lpszClassName ); - check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc ); - check_class_info_a( hinst, wc.lpszClassName, &wc ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc ); + check_atom_name_a( tmp_class, wc.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc.lpszClassName, &wc ); + check_atom_name_a( tmp_class, wc.lpszClassName );
/* unversioned class can be unregistered after context is deactivated */ ret = UnregisterClassA( wc.lpszClassName, hinst ); @@ -1816,8 +1836,10 @@ static void test_actctx_classes(void) class = RegisterClassA( &wc_leak ); ok( class != 0, "RegisterClassA failed, error %lu\n", GetLastError() ); check_atom_name_a( class, wc_leak.lpszClassName ); - check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_leak ); - check_class_info_a( hinst, wc_leak.lpszClassName, &wc_leak ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_leak ); + check_atom_name_a( tmp_class, wc_leak.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc_leak.lpszClassName, &wc_leak ); + check_atom_name_a( tmp_class, wc_leak.lpszClassName ); check_class_info_a( hinst, wc_leak_versioned.lpszClassName, NULL );
ret = ActivateActCtx( context, &cookie ); @@ -1833,9 +1855,12 @@ static void test_actctx_classes(void) tmp_class = RegisterClassA( &wc_leak ); todo_wine ok( tmp_class == class, "RegisterClassA failed, error %lu\n", GetLastError() ); check_atom_name_a( class, wc_leak.lpszClassName ); - check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_leak ); - check_class_info_a( hinst, wc_leak.lpszClassName, &wc_leak ); - check_class_info_a( hinst, wc_leak_versioned.lpszClassName, &wc ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_leak ); + check_atom_name_a( tmp_class, wc_leak.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc_leak.lpszClassName, &wc_leak ); + todo_wine check_atom_name_a( tmp_class, wc_leak.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc_leak_versioned.lpszClassName, &wc ); + todo_wine check_atom_name_a( tmp_class, wc_leak.lpszClassName );
/* versioned class can be unregistered with its base name */ ret = UnregisterClassA( wc_leak.lpszClassName, hinst ); @@ -1858,8 +1883,10 @@ static void test_actctx_classes(void) ret = DeactivateActCtx( 0, cookie ); ok( ret, "DeactivateActCtx failed, error %lu\n", GetLastError() ); todo_wine check_atom_name_a( class, wc_leak.lpszClassName ); - todo_wine check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_leak ); - todo_wine check_class_info_a( hinst, wc_leak.lpszClassName, &wc_leak ); + todo_wine tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_leak ); + todo_wine check_atom_name_a( tmp_class, wc_leak.lpszClassName ); + todo_wine tmp_class = check_class_info_a( hinst, wc_leak.lpszClassName, &wc_leak ); + todo_wine check_atom_name_a( tmp_class, wc_leak.lpszClassName ); check_class_info_a( hinst, wc_leak_versioned.lpszClassName, NULL );
/* unversioned class can be unregistered now */ @@ -1880,9 +1907,12 @@ static void test_actctx_classes(void) class = RegisterClassA( &wc ); ok( class != 0, "RegisterClassA failed, error %lu\n", GetLastError() ); todo_wine check_atom_name_a( class, wc.lpszClassName ); - check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc ); - check_class_info_a( hinst, wc.lpszClassName, &wc ); - check_class_info_a( hinst, wc_versioned.lpszClassName, &wc ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc ); + todo_wine check_atom_name_a( tmp_class, wc.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc.lpszClassName, &wc ); + todo_wine check_atom_name_a( tmp_class, wc.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc_versioned.lpszClassName, &wc ); + todo_wine check_atom_name_a( tmp_class, wc.lpszClassName );
/* when context isn't active, class info is available by versioned name only */ ret = DeactivateActCtx( 0, cookie ); @@ -1890,7 +1920,8 @@ static void test_actctx_classes(void) todo_wine check_atom_name_a( class, wc.lpszClassName ); todo_wine check_class_info_a( hinst, MAKEINTRESOURCEA( class ), NULL ); check_class_info_a( hinst, wc.lpszClassName, NULL ); - check_class_info_a( hinst, wc_versioned.lpszClassName, &wc ); + tmp_class = check_class_info_a( hinst, wc_versioned.lpszClassName, &wc ); + todo_wine check_atom_name_a( tmp_class, wc.lpszClassName );
/* when context is active, CreateWindow is allowed by atom, versioned, base names */ @@ -2012,14 +2043,18 @@ static void test_actctx_classes(void) check_class_info_a( hinst, wc_integral.lpszClassName, NULL ); class = RegisterClassA( &wc_integral_int ); ok( class == 1234, "RegisterClassA failed, error %lu\n", GetLastError() ); - check_class_info_a( hinst, MAKEINTRESOURCEA(1234), &wc_integral_int ); - todo_wine check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral_int ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA(1234), &wc_integral_int ); + ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() ); + todo_wine tmp_class = check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral_int ); + todo_wine ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() ); ret = UnregisterClassA( MAKEINTRESOURCEA( class ), hinst ); ok( ret, "UnregisterClassA failed, error %lu\n", GetLastError() ); class = RegisterClassA( &wc_integral ); todo_wine ok( class == 1234, "RegisterClassA failed, error %lu\n", GetLastError() ); - todo_wine check_class_info_a( hinst, MAKEINTRESOURCEA(1234), &wc_integral ); - check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral ); + todo_wine tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA(1234), &wc_integral ); + todo_wine ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() ); + tmp_class = check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral ); + todo_wine ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() ); ret = DeactivateActCtx( 0, cookie ); ok( ret, "DeactivateActCtx failed, error %lu\n", GetLastError() );
@@ -2054,17 +2089,22 @@ static void test_actctx_classes(void) /* registering versioned class while context isn't active */ class = RegisterClassA( &wc_integral_versioned ); ok( class != 1234, "RegisterClassA failed, error %lu\n", GetLastError() ); - check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_integral_versioned ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_integral_versioned ); + check_atom_name_a( tmp_class, wc_integral_versioned.lpszClassName ); check_class_info_a( hinst, wc_integral.lpszClassName, NULL ); - check_class_info_a( hinst, wc_integral_versioned.lpszClassName, &wc_integral_versioned ); + tmp_class = check_class_info_a( hinst, wc_integral_versioned.lpszClassName, &wc_integral_versioned ); + check_atom_name_a( tmp_class, wc_integral_versioned.lpszClassName );
ret = ActivateActCtx( context, &cookie ); ok( ret, "ActivateActCtx failed, error %lu\n", GetLastError() );
/* GetClassInfoA now works with base name */ - check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_integral_versioned ); - check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral_versioned ); - check_class_info_a( hinst, wc_integral_versioned.lpszClassName, &wc_integral_versioned ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_integral_versioned ); + check_atom_name_a( tmp_class, wc_integral_versioned.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral_versioned ); + check_atom_name_a( tmp_class, wc_integral_versioned.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc_integral_versioned.lpszClassName, &wc_integral_versioned ); + check_atom_name_a( tmp_class, wc_integral_versioned.lpszClassName );
/* prevents the class to be registered when context is active */ tmp_class = RegisterClassA( &wc_integral_versioned ); @@ -2072,9 +2112,12 @@ static void test_actctx_classes(void) tmp_class = RegisterClassA( &wc_integral ); ok( !tmp_class, "RegisterClassA succeeded, error %lu\n", GetLastError() );
- check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_integral_versioned ); - check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral_versioned ); - check_class_info_a( hinst, wc_integral_versioned.lpszClassName, &wc_integral_versioned ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_integral_versioned ); + check_atom_name_a( tmp_class, wc_integral_versioned.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral_versioned ); + check_atom_name_a( tmp_class, wc_integral_versioned.lpszClassName ); + tmp_class = check_class_info_a( hinst, wc_integral_versioned.lpszClassName, &wc_integral_versioned ); + check_atom_name_a( tmp_class, wc_integral_versioned.lpszClassName );
/* versioned class can be unregistered with its base name */ ret = UnregisterClassA( wc_integral.lpszClassName, hinst ); @@ -2086,8 +2129,10 @@ static void test_actctx_classes(void) /* registering unversioned class before context is activated */ class = RegisterClassA( &wc_integral ); ok( class == 1234, "RegisterClassA failed, error %lu\n", GetLastError() ); - check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_integral ); - check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_integral ); + ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() ); + tmp_class = check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral ); + ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() ); check_class_info_a( hinst, wc_integral_versioned.lpszClassName, NULL );
ret = ActivateActCtx( context, &cookie ); @@ -2102,9 +2147,12 @@ static void test_actctx_classes(void) tmp_class = RegisterClassA( &wc_integral ); todo_wine ok( tmp_class == class, "RegisterClassA failed, error %lu\n", GetLastError() );
- check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_integral ); - check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral ); - check_class_info_a( hinst, wc_integral_versioned.lpszClassName, &wc_integral ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_integral ); + ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() ); + tmp_class = check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral ); + todo_wine ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() ); + tmp_class = check_class_info_a( hinst, wc_integral_versioned.lpszClassName, &wc_integral ); + todo_wine ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() );
/* versioned class can be unregistered with its base name */ ret = UnregisterClassA( wc_integral.lpszClassName, hinst ); @@ -2126,16 +2174,20 @@ static void test_actctx_classes(void) ok( ret, "ActivateActCtx failed, error %lu\n", GetLastError() ); class = RegisterClassA( &wc_integral ); todo_wine ok( class == 1234, "RegisterClassA failed, error %lu\n", GetLastError() ); - check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_integral ); - check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral ); - check_class_info_a( hinst, wc_integral_versioned.lpszClassName, &wc_integral ); + tmp_class = check_class_info_a( hinst, MAKEINTRESOURCEA( class ), &wc_integral ); + todo_wine ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() ); + tmp_class = check_class_info_a( hinst, wc_integral.lpszClassName, &wc_integral ); + todo_wine ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() ); + tmp_class = check_class_info_a( hinst, wc_integral_versioned.lpszClassName, &wc_integral ); + todo_wine ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() );
/* class info is available by versioned name only, if context isn't active. */ ret = DeactivateActCtx( 0, cookie ); ok( ret, "DeactivateActCtx failed, error %lu\n", GetLastError() ); todo_wine check_class_info_a( hinst, MAKEINTRESOURCEA( class ), NULL ); check_class_info_a( hinst, wc_integral.lpszClassName, NULL ); - check_class_info_a( hinst, wc_integral_versioned.lpszClassName, &wc_integral ); + tmp_class = check_class_info_a( hinst, wc_integral_versioned.lpszClassName, &wc_integral ); + todo_wine ok( tmp_class == 1234, "GetClassInfoA failed, error %lu\n", GetLastError() );
/* CreateWindow is allowed by atom, versioned, base names when context is active */