Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/user32/tests/win.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index db27b6b..ea9fac2 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -4011,6 +4011,8 @@ done:
if (child) DestroyWindow(child); DestroyWindow(popup); + + SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE); }
static void test_validatergn(HWND hwnd)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/user32/tests/win.c | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index ea9fac2..a692a06 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -3152,7 +3152,7 @@ todo_wine
static void test_SetActiveWindow(HWND hwnd) { - HWND hwnd2; + HWND hwnd2, ret;
flush_events( TRUE ); ShowWindow(hwnd, SW_HIDE); @@ -3165,13 +3165,13 @@ static void test_SetActiveWindow(HWND hwnd) ShowWindow(hwnd, SW_SHOW); check_wnd_state(hwnd, hwnd, hwnd, 0);
- hwnd2 = SetActiveWindow(0); - ok(hwnd2 == hwnd, "SetActiveWindow returned %p instead of %p\n", hwnd2, hwnd); + ret = SetActiveWindow(0); + ok(ret == hwnd, "SetActiveWindow returned %p instead of %p\n", ret, hwnd); if (!GetActiveWindow()) /* doesn't always work on vista */ { check_wnd_state(0, 0, 0, 0); - hwnd2 = SetActiveWindow(hwnd); - ok(hwnd2 == 0, "SetActiveWindow returned %p instead of 0\n", hwnd2); + ret = SetActiveWindow(hwnd); + ok(ret == 0, "SetActiveWindow returned %p instead of 0\n", ret); } check_wnd_state(hwnd, hwnd, hwnd, 0);
@@ -3194,6 +3194,9 @@ static void test_SetActiveWindow(HWND hwnd) hwnd2 = CreateWindowExA(0, "static", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 0, 0, hwnd, 0, 0, NULL); check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
+ SetActiveWindow(hwnd); + check_wnd_state(hwnd, hwnd, hwnd, 0); + DestroyWindow(hwnd2); check_wnd_state(hwnd, hwnd, hwnd, 0);
@@ -3205,6 +3208,31 @@ static void test_SetActiveWindow(HWND hwnd)
DestroyWindow(hwnd2); check_wnd_state(hwnd, hwnd, hwnd, 0); + + /* try to activate the desktop */ + SetLastError(0xdeadbeef); + ret = SetActiveWindow(GetDesktopWindow()); + ok(ret == NULL, "expected NULL, got %p\n", ret); + todo_wine + ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %u\n", GetLastError()); + check_wnd_state(hwnd, hwnd, hwnd, 0); + + /* activating a child should activate the parent */ + hwnd2 = CreateWindowExA(0, "MainWindowClass", "Child window", WS_CHILD, 0, 0, 0, 0, hwnd, 0, GetModuleHandleA(NULL), NULL); + check_wnd_state(hwnd, hwnd, hwnd, 0); + ret = SetActiveWindow(hwnd2); + ok(ret == hwnd, "expected %p, got %p\n", hwnd, ret); + check_wnd_state(hwnd, hwnd, hwnd, 0); + ret = SetActiveWindow(0); + ok(ret == hwnd, "expected %p, got %p\n", hwnd, ret); + if (!GetActiveWindow()) + { + ret = SetActiveWindow(hwnd2); + ok(ret == NULL, "expected NULL, got %p\n", ret); + todo_wine + check_active_state(hwnd, hwnd, hwnd); + } + DestroyWindow(hwnd2); }
struct create_window_thread_params
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/user32/tests/win.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index a692a06..6a6a765 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -9856,6 +9856,102 @@ static void test_LockWindowUpdate(HWND parent) DestroyWindow(child); }
+static void test_hide_window(void) +{ + HWND hwnd, hwnd2, hwnd3; + + hwnd = CreateWindowExA(0, "MainWindowClass", "Main window", WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + hwnd2 = CreateWindowExA(0, "MainWindowClass", "Main window 2", WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + trace("hwnd = %p, hwnd2 = %p\n", hwnd, hwnd2); + check_active_state(hwnd2, hwnd2, hwnd2); + ok(GetWindow(hwnd2, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd2, GW_HWNDNEXT)); + + /* test hiding two normal windows */ + ShowWindow(hwnd2, SW_HIDE); + check_active_state(hwnd, hwnd, hwnd); + todo_wine + ok(GetWindow(hwnd, GW_HWNDNEXT) == hwnd2, "expected %p, got %p\n", hwnd2, GetWindow(hwnd, GW_HWNDNEXT)); + + ShowWindow(hwnd, SW_HIDE); + check_active_state(hwndMain, 0, hwndMain); + ok(GetWindow(hwnd, GW_HWNDNEXT) == hwnd2, "expected %p, got %p\n", hwnd2, GetWindow(hwnd, GW_HWNDNEXT)); + + ShowWindow(hwnd, SW_SHOW); + check_active_state(hwnd, hwnd, hwnd); + + ShowWindow(hwnd2, SW_SHOW); + check_active_state(hwnd2, hwnd2, hwnd2); + ok(GetWindow(hwnd2, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd2, GW_HWNDNEXT)); + + /* hide a non-active window */ + ShowWindow(hwnd, SW_HIDE); + check_active_state(hwnd2, hwnd2, hwnd2); + todo_wine + ok(GetWindow(hwnd2, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd2, GW_HWNDNEXT)); + + /* hide a window in the middle */ + ShowWindow(hwnd, SW_SHOW); + ShowWindow(hwnd2, SW_SHOW); + hwnd3 = CreateWindowExA(0, "MainWindowClass", "Main window 3", WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + SetActiveWindow(hwnd2); + ShowWindow(hwnd2, SW_HIDE); + check_active_state(hwnd3, hwnd3, hwnd3); + todo_wine { + ok(GetWindow(hwnd3, GW_HWNDNEXT) == hwnd2, "expected %p, got %p\n", hwnd2, GetWindow(hwnd3, GW_HWNDNEXT)); + ok(GetWindow(hwnd2, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd2, GW_HWNDNEXT)); + } + + DestroyWindow(hwnd3); + + /* hide a normal window when there is a topmost window */ + hwnd3 = CreateWindowExA(WS_EX_TOPMOST, "MainWindowClass", "Topmost window 3", WS_POPUP|WS_VISIBLE, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + ShowWindow(hwnd, SW_SHOW); + ShowWindow(hwnd2, SW_SHOW); + check_active_state(hwnd2, hwnd2, hwnd2); + ShowWindow(hwnd2, SW_HIDE); + todo_wine + check_active_state(hwnd3, hwnd3, hwnd3); + ok(GetWindow(hwnd2, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd2, GW_HWNDNEXT)); + + /* hide a topmost window */ + ShowWindow(hwnd2, SW_SHOW); + ShowWindow(hwnd3, SW_SHOW); + ShowWindow(hwnd3, SW_HIDE); + check_active_state(hwnd2, hwnd2, hwnd2); + ok(GetWindow(hwnd2, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd2, GW_HWNDNEXT)); + + DestroyWindow(hwnd3); + + /* hiding an owned window activates its owner */ + ShowWindow(hwnd, SW_SHOW); + ShowWindow(hwnd2, SW_SHOW); + hwnd3 = CreateWindowExA(0, "MainWindowClass", "Owned window 3", WS_POPUP|WS_VISIBLE, + 100, 100, 200, 200, hwnd, 0, GetModuleHandleA(NULL), NULL); + ShowWindow(hwnd3, SW_HIDE); + check_active_state(hwnd, hwnd, hwnd); + todo_wine { + ok(GetWindow(hwnd3, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd3, GW_HWNDNEXT)); + ok(GetWindow(hwnd, GW_HWNDNEXT) == hwnd2, "expected %p, got %p\n", hwnd2, GetWindow(hwnd, GW_HWNDNEXT)); + } + + /* hide an owner window */ + ShowWindow(hwnd, SW_SHOW); + ShowWindow(hwnd2, SW_SHOW); + ShowWindow(hwnd3, SW_SHOW); + ShowWindow(hwnd, SW_HIDE); + check_active_state(hwnd3, hwnd3, hwnd3); + ok(GetWindow(hwnd3, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd3, GW_HWNDNEXT)); + ok(GetWindow(hwnd, GW_HWNDNEXT) == hwnd2, "expected %p, got %p\n", hwnd2, GetWindow(hwnd, GW_HWNDNEXT)); + + DestroyWindow(hwnd3); + DestroyWindow(hwnd2); + DestroyWindow(hwnd); +} + static void test_desktop( void ) { HWND desktop = GetDesktopWindow(); @@ -10433,6 +10529,7 @@ START_TEST(win) test_deferwindowpos(); test_LockWindowUpdate(hwndMain); test_desktop(); + test_hide_window();
/* add the tests above this line */ if (hhook) UnhookWindowsHookEx(hhook);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/user32/tests/win.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 6a6a765..6761960 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -9952,6 +9952,97 @@ static void test_hide_window(void) DestroyWindow(hwnd); }
+static void test_minimize_window(HWND hwndMain) +{ + HWND hwnd, hwnd2, hwnd3; + + hwnd = CreateWindowExA(0, "MainWindowClass", "Main window", WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + hwnd2 = CreateWindowExA(0, "MainWindowClass", "Main window 2", WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + trace("hwnd = %p, hwnd2 = %p\n", hwnd, hwnd2); + check_active_state(hwnd2, hwnd2, hwnd2); + ok(GetWindow(hwnd2, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd2, GW_HWNDNEXT)); + + /* test hiding two normal windows */ + ShowWindow(hwnd2, SW_MINIMIZE); + todo_wine + check_active_state(hwnd, hwnd, hwnd); + + ShowWindow(hwnd, SW_MINIMIZE); + todo_wine + if (GetActiveWindow() == 0) + check_active_state(0, 0, 0); + + ShowWindow(hwnd, SW_RESTORE); + check_active_state(hwnd, hwnd, hwnd); + + ShowWindow(hwnd2, SW_RESTORE); + check_active_state(hwnd2, hwnd2, hwnd2); + + /* hide a non-active window */ + ShowWindow(hwnd, SW_MINIMIZE); + check_active_state(hwnd2, hwnd2, hwnd2); + + /* hide a window in the middle */ + ShowWindow(hwnd, SW_RESTORE); + ShowWindow(hwnd2, SW_RESTORE); + hwnd3 = CreateWindowExA(0, "MainWindowClass", "Main window 3", WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + SetActiveWindow(hwnd2); + ShowWindow(hwnd2, SW_MINIMIZE); + todo_wine + check_active_state(hwnd3, hwnd3, hwnd3); + ok(GetWindow(hwnd3, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd3, GW_HWNDNEXT)); + + DestroyWindow(hwnd3); + + /* hide a normal window when there is a topmost window */ + hwnd3 = CreateWindowExA(WS_EX_TOPMOST, "MainWindowClass", "Topmost window 3", WS_POPUP|WS_VISIBLE, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + ShowWindow(hwnd, SW_RESTORE); + ShowWindow(hwnd2, SW_RESTORE); + check_active_state(hwnd2, hwnd2, hwnd2); + ShowWindow(hwnd2, SW_MINIMIZE); + todo_wine + check_active_state(hwnd3, hwnd3, hwnd3); + + /* hide a topmost window */ + ShowWindow(hwnd2, SW_RESTORE); + ShowWindow(hwnd3, SW_RESTORE); + ShowWindow(hwnd3, SW_MINIMIZE); + check_active_state(hwnd2, hwnd2, hwnd2); + ok(GetWindow(hwnd2, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd2, GW_HWNDNEXT)); + + DestroyWindow(hwnd3); + + /* hide an owned window */ + ShowWindow(hwnd, SW_RESTORE); + ShowWindow(hwnd2, SW_RESTORE); + hwnd3 = CreateWindowExA(0, "MainWindowClass", "Owned window 3", WS_POPUP|WS_VISIBLE, + 100, 100, 200, 200, hwnd, 0, GetModuleHandleA(NULL), NULL); + ShowWindow(hwnd3, SW_MINIMIZE); + todo_wine { + check_active_state(hwnd2, hwnd2, hwnd2); + ok(GetWindow(hwnd2, GW_HWNDNEXT) == hwnd3, "expected %p, got %p\n", hwnd3, GetWindow(hwnd2, GW_HWNDNEXT)); + ok(GetWindow(hwnd3, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd3, GW_HWNDNEXT)); + } + + /* hide an owner window */ + ShowWindow(hwnd, SW_RESTORE); + ShowWindow(hwnd2, SW_RESTORE); + ShowWindow(hwnd3, SW_RESTORE); + ShowWindow(hwnd, SW_MINIMIZE); + todo_wine { + check_active_state(hwnd2, hwnd2, hwnd2); + ok(GetWindow(hwnd3, GW_HWNDNEXT) == hwnd, "expected %p, got %p\n", hwnd, GetWindow(hwnd3, GW_HWNDNEXT)); + } + + DestroyWindow(hwnd3); + DestroyWindow(hwnd2); + DestroyWindow(hwnd); +} + static void test_desktop( void ) { HWND desktop = GetDesktopWindow(); @@ -10530,6 +10621,7 @@ START_TEST(win) test_LockWindowUpdate(hwndMain); test_desktop(); test_hide_window(); + test_minimize_window(hwndMain);
/* add the tests above this line */ if (hhook) UnhookWindowsHookEx(hhook);
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=34836
Your paranoid android.
=== wvistau64 (32 bit win) === win.c:9996: Test failed: expected 0009011E, got 00090112
=== w2008s64 (32 bit win) === win.c:9996: Test failed: expected 000900E6, got 000A001E
=== wvistau64 (64 bit win) === win.c:9996: Test failed: expected 00000000000A00D2, got 00000000000A0018
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v2: remove unreliable GW_HWNDNEXT tests
dlls/user32/tests/win.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 6a6a765..fc35542 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -9952,6 +9952,89 @@ static void test_hide_window(void) DestroyWindow(hwnd); }
+static void test_minimize_window(HWND hwndMain) +{ + HWND hwnd, hwnd2, hwnd3; + + hwnd = CreateWindowExA(0, "MainWindowClass", "Main window", WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + hwnd2 = CreateWindowExA(0, "MainWindowClass", "Main window 2", WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + trace("hwnd = %p, hwnd2 = %p\n", hwnd, hwnd2); + check_active_state(hwnd2, hwnd2, hwnd2); + + /* test hiding two normal windows */ + ShowWindow(hwnd2, SW_MINIMIZE); + todo_wine + check_active_state(hwnd, hwnd, hwnd); + + ShowWindow(hwnd, SW_MINIMIZE); + todo_wine + if (GetActiveWindow() == 0) + check_active_state(0, 0, 0); + + ShowWindow(hwnd, SW_RESTORE); + check_active_state(hwnd, hwnd, hwnd); + + ShowWindow(hwnd2, SW_RESTORE); + check_active_state(hwnd2, hwnd2, hwnd2); + + /* hide a non-active window */ + ShowWindow(hwnd, SW_MINIMIZE); + check_active_state(hwnd2, hwnd2, hwnd2); + + /* hide a window in the middle */ + ShowWindow(hwnd, SW_RESTORE); + ShowWindow(hwnd2, SW_RESTORE); + hwnd3 = CreateWindowExA(0, "MainWindowClass", "Main window 3", WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + SetActiveWindow(hwnd2); + ShowWindow(hwnd2, SW_MINIMIZE); + todo_wine + check_active_state(hwnd3, hwnd3, hwnd3); + + DestroyWindow(hwnd3); + + /* hide a normal window when there is a topmost window */ + hwnd3 = CreateWindowExA(WS_EX_TOPMOST, "MainWindowClass", "Topmost window 3", WS_POPUP|WS_VISIBLE, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + ShowWindow(hwnd, SW_RESTORE); + ShowWindow(hwnd2, SW_RESTORE); + check_active_state(hwnd2, hwnd2, hwnd2); + ShowWindow(hwnd2, SW_MINIMIZE); + todo_wine + check_active_state(hwnd3, hwnd3, hwnd3); + + /* hide a topmost window */ + ShowWindow(hwnd2, SW_RESTORE); + ShowWindow(hwnd3, SW_RESTORE); + ShowWindow(hwnd3, SW_MINIMIZE); + check_active_state(hwnd2, hwnd2, hwnd2); + + DestroyWindow(hwnd3); + + /* hide an owned window */ + ShowWindow(hwnd, SW_RESTORE); + ShowWindow(hwnd2, SW_RESTORE); + hwnd3 = CreateWindowExA(0, "MainWindowClass", "Owned window 3", WS_POPUP|WS_VISIBLE, + 100, 100, 200, 200, hwnd, 0, GetModuleHandleA(NULL), NULL); + ShowWindow(hwnd3, SW_MINIMIZE); + todo_wine + check_active_state(hwnd2, hwnd2, hwnd2); + + /* hide an owner window */ + ShowWindow(hwnd, SW_RESTORE); + ShowWindow(hwnd2, SW_RESTORE); + ShowWindow(hwnd3, SW_RESTORE); + ShowWindow(hwnd, SW_MINIMIZE); + todo_wine + check_active_state(hwnd2, hwnd2, hwnd2); + + DestroyWindow(hwnd3); + DestroyWindow(hwnd2); + DestroyWindow(hwnd); +} + static void test_desktop( void ) { HWND desktop = GetDesktopWindow(); @@ -10530,6 +10613,7 @@ START_TEST(win) test_LockWindowUpdate(hwndMain); test_desktop(); test_hide_window(); + test_minimize_window(hwndMain);
/* add the tests above this line */ if (hhook) UnhookWindowsHookEx(hhook);