user32: Add a test showing that SetForegroundWindow() on a visible child of invisible parent does activate the parent and sets focus to the child. (Resend)

Dmitry Timoshkov dmitry at codeweavers.com
Mon Jul 19 05:36:08 CDT 2010


This test is supposed to replicate one of the focus/activations problems.
---
 dlls/user32/tests/win.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index d9219f5..323a61f 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -2526,6 +2526,27 @@ static void test_SetForegroundWindow(HWND hwnd)
 
     /*trace("testing SetForegroundWindow %p\n", hwnd);*/
 
+    hwnd2 = CreateWindowExA(0, "static", NULL, WS_CHILD|WS_VISIBLE, 0, 0, 0, 0, hwnd, 0, 0, NULL);
+    check_wnd_state(0, 0, 0, 0);
+
+    SetForegroundWindow(hwnd2);
+    if (0) check_wnd_state(hwnd, 0, hwnd2, 0);
+    else {
+    todo_wine ok(GetActiveWindow() == hwnd, "Expected active window %p, got %p.\n", hwnd, GetActiveWindow());
+    todo_wine ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus());
+    }
+
+    DestroyWindow(hwnd2);
+    if (0) check_wnd_state(hwnd, 0, hwnd, 0);
+    else {
+    todo_wine ok(GetActiveWindow() == hwnd, "Expected active window %p, got %p.\n", hwnd, GetActiveWindow());
+    todo_wine ok(GetFocus() == hwnd, "Expected focus window %p, got %p.\n", hwnd, GetFocus());
+    }
+
+    SetFocus(0);
+    SetActiveWindow(0);
+    check_wnd_state(0, 0, 0, 0);
+
     ShowWindow(hwnd, SW_SHOW);
     check_wnd_state(hwnd, hwnd, hwnd, 0);
 
@@ -2608,8 +2629,10 @@ static void test_SetForegroundWindow(HWND hwnd)
 
     while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
     if (0) check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
+    else {
     todo_wine ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow());
     todo_wine ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus());
+    }
 
     SetEvent(thread_params.test_finished);
     WaitForSingleObject(thread, INFINITE);
-- 
1.7.0.6




More information about the wine-patches mailing list