Dmitry Timoshkov : user32/tests: Make WS_EX_TOPMOST tests more generic.
Module: wine Branch: master Commit: 82cf34562e661e513ace5579c9f884d8f5288154 URL: http://source.winehq.org/git/wine.git/?a=commit;h=82cf34562e661e513ace5579c9... Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Mon Nov 13 18:14:30 2017 +0800 user32/tests: Make WS_EX_TOPMOST tests more generic. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- 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 fdfdf92..d9491f5 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)
participants (1)
-
Alexandre Julliard