user32: Cope with failing SetForegroundWindow().

Dmitry Timoshkov dmitry at codeweavers.com
Sat Feb 19 01:20:08 CST 2011


According the test results SetForegroundWindow() fails on some Windows
machines, and test_SetForegroundWindow() already copes with that. But
nevertheless even failing SetForegroundWindow() activates the window
and sets focus to it.
---
 dlls/user32/tests/win.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index e440a96..480f2f3 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -3346,6 +3346,7 @@ static void test_SetParent(void)
     HWND desktop = GetDesktopWindow();
     HMENU hMenu;
     HWND ret, parent, child1, child2, child3, child4, sibling, popup;
+    BOOL bret;
 
     parent = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW,
 			     100, 100, 200, 200, 0, 0, 0, NULL);
@@ -3474,10 +3475,16 @@ todo_wine
     SetFocus(parent);
     check_active_state(parent, 0, parent);
 
+    bret = SetForegroundWindow(popup);
+    if (!bret)
+    {
 todo_wine {
-    ok(SetForegroundWindow(popup), "SetForegroundWindow() failed\n");
-    check_active_state(popup, 0, popup);
+        ok(broken(bret), "SetForegroundWindow() failed\n");
+        check_active_state(popup, 0, popup);
+        }
     }
+    else
+        check_active_state(popup, popup, popup);
 
     ok(DestroyWindow(parent), "DestroyWindow() failed\n");
 
-- 
1.7.3.5




More information about the wine-patches mailing list