user32: Make sure that main window state is consistent during the tests.

Dmitry Timoshkov dmitry at codeweavers.com
Mon Jul 12 03:17:29 CDT 2010


---
 dlls/user32/tests/win.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index eadad3a..d9219f5 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -2324,6 +2324,8 @@ static void test_SetFocus(HWND hwnd)
     HWND child, child2;
     WNDPROC old_wnd_proc;
 
+    ok(!IsWindowVisible(hwnd), "main window needs to be invisible at this point\n");
+
     /* check if we can set focus to non-visible windows */
 
     ShowWindow(hwnd, SW_SHOW);
@@ -2401,6 +2403,9 @@ todo_wine
 
     DestroyWindow( child2 );
     DestroyWindow( child );
+
+    /* restore window state */
+    ShowWindow(hwnd, SW_HIDE);
 }
 
 #define check_wnd_state(a,b,c,d) check_wnd_state_(__FILE__,__LINE__,a,b,c,d)
@@ -2421,6 +2426,8 @@ static void test_SetActiveWindow(HWND hwnd)
 {
     HWND hwnd2;
 
+    ok(!IsWindowVisible(hwnd), "main window needs to be invisible at this point\n");
+
     flush_events( TRUE );
     ShowWindow(hwnd, SW_HIDE);
     SetFocus(0);
@@ -2472,6 +2479,9 @@ static void test_SetActiveWindow(HWND hwnd)
 
     DestroyWindow(hwnd2);
     check_wnd_state(hwnd, hwnd, hwnd, 0);
+
+    /* restore window state */
+    ShowWindow(hwnd, SW_HIDE);
 }
 
 struct create_window_thread_params
@@ -2756,9 +2766,6 @@ static void test_capture_3(HWND hwnd1, HWND hwnd2)
 {
     BOOL ret;
 
-    ShowWindow(hwnd1, SW_HIDE);
-    ShowWindow(hwnd2, SW_HIDE);
-
     ok(!IsWindowVisible(hwnd1), "%p should be invisible\n", hwnd1);
     ok(!IsWindowVisible(hwnd2), "%p should be invisible\n", hwnd2);
 
@@ -2775,6 +2782,9 @@ static void test_capture_3(HWND hwnd1, HWND hwnd2)
     ok (ret, "releasecapture did not return TRUE.\n");
     ret = ReleaseCapture();
     ok (ret, "releasecapture did not return TRUE after second try.\n");
+
+    /* restore window state */
+    ShowWindow(hwnd1, SW_HIDE);
 }
 
 static LRESULT CALLBACK test_capture_4_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-- 
1.7.0.6




More information about the wine-patches mailing list