[PATCH 4/5] user32/tests: Make WS_EX_TOPMOST tests more generic.

Dmitry Timoshkov dmitry at baikal.ru
Mon Nov 13 04:14:30 CST 2017


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/user32/tests/win.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index fdfdf9215a..d9491f5ab7 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -9856,20 +9856,29 @@ static void test_desktop( void )
     }
 }
 
-static void test_topmost(HWND hwnd)
+static BOOL is_topmost(HWND hwnd)
+{
+    return (GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
+}
+
+static void swp_after(HWND hwnd, HWND after)
 {
     BOOL ret;
 
-    ok(!(GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST), "WS_EX_TOPMOST should not be set\n");
-    ret = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
-    ok(ret, "Got %d\n", ret);
-    ok(GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "WS_EX_TOPMOST should be set\n");
-    ret = SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
-    ok(ret, "Got %d\n", ret);
-    ok(GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "WS_EX_TOPMOST should be set\n");
-    ret = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
-    ok(ret, "Got %d\n", ret);
-    ok(!(GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST), "WS_EX_TOPMOST should not be set\n");
+    ret = SetWindowPos(hwnd, after, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
+    ok(ret, "SetWindowPos failed\n");
+}
+
+static void test_topmost(HWND hwnd)
+{
+    ok(!is_topmost(hwnd), "WS_EX_TOPMOST should not be set\n");
+
+    swp_after(hwnd, HWND_TOPMOST);
+    ok(is_topmost(hwnd), "WS_EX_TOPMOST should be set\n");
+    swp_after(hwnd, HWND_TOP);
+    ok(is_topmost(hwnd), "WS_EX_TOPMOST should be set\n");
+    swp_after(hwnd, HWND_NOTOPMOST);
+    ok(!is_topmost(hwnd), "WS_EX_TOPMOST should not be set\n");
 }
 
 START_TEST(win)
-- 
2.15.0




More information about the wine-devel mailing list