From: "Jiajin Cui" Subject: [PATCH v6 2/4] user32/tests: Add test to check z-order for child window call SetWindowPos. Message-Id: <2020070211352715856011@uniontech.com> Date: Thu, 2 Jul 2020 11:35:27 +0800 From 1ad70b4811913be7199cf225fc37e0c1ff6d681f Mon Sep 17 00:00:00 2001 From: Jiajin Cui Date: Wed, 1 Jul 2020 18:31:56 +0800 Subject: [PATCH v6 2/4] user32/tests: Add test to check z-order for child window call SetWindowPos. The child window should't change the z-order when it calls the SetWindowPos with HWND_TOPMOST or HWND_NOTOPMOST, and should't change existing WS_EX_TOPMOST extended styles when it calls the SetWindowPos with any parameters. Signed-off-by: Jiajin Cui --- dlls/user32/tests/win.c | 75 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 700e60db17..654e5700fe 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -3013,6 +3013,80 @@ static void test_popup_zorder(HWND hwnd_D, HWND hwnd_E, DWORD style) DestroyWindow(hwnd_F); } +static void test_child_topmost_zorder(HWND hwnd_D) +{ + HWND hwnd_A, hwnd_B, hwnd_C; + + hwnd_C = CreateWindowExA(0, "MainWindowClass", NULL, + WS_CHILD, + 100, 100, 100, 100, + hwnd_D, 0, GetModuleHandleA(NULL), NULL); + check_z_order(hwnd_C, 0, 0, 0, FALSE); + + hwnd_B = CreateWindowExA(0, "MainWindowClass", NULL, + WS_CHILD, + 100, 100, 100, 100, + hwnd_D, 0, GetModuleHandleA(NULL), NULL); + check_z_order(hwnd_C, hwnd_B, 0, 0, FALSE); + check_z_order(hwnd_B, 0, hwnd_C, 0, FALSE); + + hwnd_A = CreateWindowExA(WS_EX_TOPMOST, "MainWindowClass", NULL, + WS_CHILD, + 100, 100, 100, 100, + hwnd_D, 0, GetModuleHandleA(NULL), NULL); + check_z_order(hwnd_C, hwnd_B, 0, 0, FALSE); + check_z_order(hwnd_B, hwnd_A, hwnd_C, 0, FALSE); +todo_wine check_z_order(hwnd_A, 0, hwnd_B, 0, TRUE); + + SetWindowPos(hwnd_A, HWND_TOP, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); + check_z_order(hwnd_C, hwnd_B, hwnd_A, 0, FALSE); + check_z_order(hwnd_B, 0, hwnd_C, 0, FALSE); +todo_wine check_z_order(hwnd_A, hwnd_C, 0, 0, TRUE); + + SetWindowPos(hwnd_A, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); + check_z_order(hwnd_C, hwnd_B, hwnd_A, 0, FALSE); + check_z_order(hwnd_B, 0, hwnd_C, 0, FALSE); + check_z_order(hwnd_A, hwnd_C, 0, 0, TRUE); + + SetWindowPos(hwnd_B, HWND_TOP, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); +todo_wine +{ + check_z_order(hwnd_C, 0, hwnd_A, 0, FALSE); + check_z_order(hwnd_B, hwnd_A, 0, 0, FALSE); + check_z_order(hwnd_A, hwnd_C, hwnd_B, 0, TRUE); +} + + SetWindowPos(hwnd_A, HWND_NOTOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); +todo_wine +{ + check_z_order(hwnd_C, 0, hwnd_A, 0, FALSE); + check_z_order(hwnd_B, hwnd_A, 0, 0, FALSE); + check_z_order(hwnd_A, hwnd_C, hwnd_B, 0, TRUE); +} + + SetWindowPos(hwnd_A, HWND_BOTTOM, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); + check_z_order(hwnd_C, hwnd_A, hwnd_B, 0, FALSE); + check_z_order(hwnd_B, hwnd_C, 0, 0, FALSE); +todo_wine check_z_order(hwnd_A, 0, hwnd_C, 0, TRUE); + + SetWindowPos(hwnd_C, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); +todo_wine +{ + check_z_order(hwnd_C, hwnd_A, hwnd_B, 0, FALSE); + check_z_order(hwnd_B, hwnd_C, 0, 0, FALSE); + check_z_order(hwnd_A, 0, hwnd_C, 0, TRUE); +} + + SetWindowPos(hwnd_C, HWND_TOP, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); +todo_wine check_z_order(hwnd_C, hwnd_B, 0, 0, FALSE); + check_z_order(hwnd_B, hwnd_A, hwnd_C, 0, FALSE); +todo_wine check_z_order(hwnd_A, 0, hwnd_B, 0, TRUE); + + DestroyWindow(hwnd_A); + DestroyWindow(hwnd_B); + DestroyWindow(hwnd_C); +} + static void test_vis_rgn( HWND hwnd ) { RECT win_rect, rgn_rect; @@ -11971,6 +12045,7 @@ START_TEST(win) test_children_zorder(hwndMain); test_popup_zorder(hwndMain2, hwndMain, WS_POPUP); test_popup_zorder(hwndMain2, hwndMain, 0); + test_child_topmost_zorder(hwndMain); test_GetLastActivePopup(); test_keyboard_input(hwndMain); test_mouse_input(hwndMain); -- 2.20.1