USER32: add a short test for child windows (take 2)
Mike McCormack
mike at codeweavers.com
Fri Oct 29 04:19:52 CDT 2004
Integrated into tests/win.c as per Dmitry's request.
ChangeLog:
* add a short test for child windows
-------------- next part --------------
Index: dlls/user/tests/win.c
===================================================================
RCS file: /home/wine/wine/dlls/user/tests/win.c,v
retrieving revision 1.36
diff -u -r1.36 win.c
--- dlls/user/tests/win.c 11 Oct 2004 19:55:28 -0000 1.36
+++ dlls/user/tests/win.c 29 Oct 2004 09:13:18 -0000
@@ -2099,8 +2099,86 @@
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
}
+static void test_child_window()
+{
+ WNDCLASSA cls,child_cls;
+ char className[] = "parentclass"; /* To make sure className >= 0x10000 */
+ char winName[] = "parent window";
+ char childclassName[] = "childclass"; /* To make sure className >= 0x10000 */
+ char childwinName[] = "child window";
+ HWND hWnd, hChild;
+ HINSTANCE hInstance = GetModuleHandleA( NULL );
+
+ cls.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
+ cls.lpfnWndProc = DefWindowProcA;
+ cls.cbClsExtra = 0;
+ cls.cbWndExtra = 0;
+ cls.hInstance = 0;
+ cls.hIcon = LoadIconA (0, (LPSTR)IDI_APPLICATION);
+ cls.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW);
+ cls.hbrBackground = GetStockObject (WHITE_BRUSH);
+ cls.lpszMenuName = 0;
+ cls.lpszClassName = className;
+
+ ok (RegisterClassA (&cls), "unable to register class") ;
+
+ hWnd = CreateWindowA (className, winName,
+ WS_OVERLAPPEDWINDOW ,
+ CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, 0,
+ 0,
+ hInstance, 0);
+
+ ok(hWnd != 0, "Couldn't create parent window");
+
+ child_cls.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
+ child_cls.lpfnWndProc = DefWindowProcA;
+ child_cls.cbClsExtra = 0;
+ child_cls.cbWndExtra = 0;
+ child_cls.hInstance = 0;
+ child_cls.hIcon = LoadIconA (0, (LPSTR)IDI_APPLICATION);
+ child_cls.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW);
+ child_cls.hbrBackground = GetStockObject (GRAY_BRUSH);
+ child_cls.lpszMenuName = 0;
+ child_cls.lpszClassName = childclassName;
+
+ ok (RegisterClassA (&child_cls) , "unable to register child class");
+
+ /* NOTE: WS_POPUP should override WS_CHILD */
+
+ hChild = CreateWindowExA (
+ 0, childclassName, childwinName,
+ WS_POPUP | WS_CHILD | WS_CLIPCHILDREN,
+ 50, 50, 50, 100, hWnd,
+ 0, hInstance, 0);
+
+ ok(hChild != 0, "Couldn't create child window");
+
+ ok(!SetActiveWindow(hChild),
+ "Can activate without parent window");
+
+ ok(GetAncestor(hChild, GA_PARENT) == GetDesktopWindow(),
+ "ancestor is not the desktop window");
+
+ ShowWindow (hWnd, SW_SHOW);
+ UpdateWindow (hWnd);
+
+ ok(SetActiveWindow(hChild) != 0,
+ "Can't activate window with parent active");
+
+ ShowWindow (hChild, SW_SHOW);
+ UpdateWindow (hChild);
+
+ ok(SetActiveWindow(hChild) != 0,
+ "Can't activate window with parent active");
+
+ DestroyWindow(hChild);
+ DestroyWindow(hWnd);
+}
+
START_TEST(win)
{
+ test_child_window();
+
pGetAncestor = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetAncestor" );
pGetWindowInfo = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetWindowInfo" );
More information about the wine-patches
mailing list