[1/2] user32: Add a test to demonstrate the z-order problem for a top level window with a region.

Dmitry Timoshkov dmitry at baikal.ru
Wed May 30 01:50:45 CDT 2012


---
 dlls/user32/tests/win.c |   56 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index dd5069b..23337ca 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -7063,6 +7063,61 @@ todo_wine
     ok(ret, "UnregisterClass(my_window) failed\n");
 }
 
+static void test_toplevel_zorder(void)
+{
+    HWND hwnd_1, hwnd_2, hwnd;
+    HRGN hrgn;
+    int ret;
+
+    hwnd_1 = CreateWindowEx(0, "MainWindowClass", NULL,
+                            WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+                            250, 250, 300, 300,
+                            0, 0, GetModuleHandle(0), NULL);
+    ok(hwnd_1 != 0, "CreateWindowEx failed\n");
+
+    hwnd_2 = CreateWindowEx(0, "MainWindowClass", NULL,
+                            WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+                            320, 320, 120, 120,
+                            0, 0, GetModuleHandle(0), NULL);
+    ok(hwnd_2 != 0, "CreateWindowEx failed\n");
+
+    hwnd = GetWindow(hwnd_2, GW_HWNDNEXT);
+    ok(hwnd == hwnd_1, "expected next window %p, got %p\n", hwnd_1, hwnd);
+    hwnd = GetWindow(hwnd_1, GW_HWNDPREV);
+    ok(hwnd == hwnd_2, "expected next window %p, got %p\n", hwnd_2, hwnd);
+
+    hrgn = CreateRectRgn(0, 0, 300, 300);
+    SetWindowRgn(hwnd_1, hrgn, TRUE);
+    InvalidateRect(hwnd_1, NULL, TRUE);
+    InvalidateRect(hwnd_2, NULL, TRUE);
+
+    hwnd = GetWindow(hwnd_2, GW_HWNDNEXT);
+    ok(hwnd == hwnd_1, "expected next window %p, got %p\n", hwnd_1, hwnd);
+    hwnd = GetWindow(hwnd_1, GW_HWNDPREV);
+    ok(hwnd == hwnd_2, "expected next window %p, got %p\n", hwnd_2, hwnd);
+
+    /* make sure we've got expose event */
+    SetClassLongPtr(hwnd_1, GCLP_HICONSM, 0);
+    SetClassLongPtr(hwnd_2, GCLP_HICONSM, 0);
+    flush_events(TRUE);
+
+    ret = GetUpdateRect(hwnd_1, NULL, 0);
+    ok(!ret, "update rect of hwnd_1 is not empty\n");
+    ret = GetUpdateRect(hwnd_2, NULL, 0);
+    ok(!ret, "update rect of hwnd_2 is not empty\n");
+
+    hwnd = GetWindow(hwnd_2, GW_HWNDNEXT);
+todo_wine
+    ok(hwnd == hwnd_1, "expected next window %p, got %p\n", hwnd_1, hwnd);
+    hwnd = GetWindow(hwnd_1, GW_HWNDPREV);
+todo_wine
+    ok(hwnd == hwnd_2, "expected previous window %p, got %p\n", hwnd_2, hwnd);
+
+    DestroyWindow(hwnd_1);
+    DestroyWindow(hwnd_2);
+    DeleteObject(hrgn);
+}
+
 START_TEST(win)
 {
     HMODULE user32 = GetModuleHandleA( "user32.dll" );
@@ -7113,6 +7168,7 @@ START_TEST(win)
     our_pid = GetWindowThreadProcessId(hwndMain, NULL);
 
     /* Add the tests below this line */
+    test_toplevel_zorder();
     test_child_window_from_point();
     test_thick_child_size(hwndMain);
     test_fullscreen();
-- 
1.7.10.1




More information about the wine-patches mailing list