Module: wine Branch: master Commit: 61a92af5cab3714ab747c3bb14fd0f0d917eca8e URL: http://source.winehq.org/git/wine.git/?a=commit;h=61a92af5cab3714ab747c3bb14...
Author: Piotr Caban piotr@codeweavers.com Date: Mon Mar 24 19:31:21 2014 +0100
user32/tests: Workaround SetForegroundWindow failure due to foreground lock timeout.
---
dlls/user32/tests/win.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 69f3270..f8c919a 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -3728,13 +3728,10 @@ todo_wine check_active_state(parent, 0, parent);
bret = SetForegroundWindow(popup); -todo_wine { - ok(bret || broken(!bret), "SetForegroundWindow() failed\n"); - if (!bret) - check_active_state(popup, 0, popup); - else +todo_wine + ok(bret, "SetForegroundWindow() failed\n"); + if (bret) check_active_state(popup, popup, popup); - }
ok(DestroyWindow(parent), "DestroyWindow() failed\n");
@@ -7507,6 +7504,32 @@ START_TEST(win)
if (!RegisterWindowClasses()) assert(0);
+ hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window", + WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | + WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, + 0, 0, GetModuleHandleA(NULL), NULL); + assert( hwndMain ); + + if(!SetForegroundWindow(hwndMain)) { + /* workaround for foreground lock timeout */ + INPUT input[2]; + UINT events_no; + + memset(input, 0, sizeof(input)); + input[0].type = INPUT_MOUSE; + input[0].mi.dx = 101; + input[0].mi.dy = 101; + input[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN; + input[0].type = INPUT_MOUSE; + input[0].mi.dx = 101; + input[0].mi.dy = 101; + input[0].mi.dwFlags = MOUSEEVENTF_LEFTUP; + events_no = SendInput(2, input, sizeof(input[0])); + ok(events_no == 2, "SendInput returned %d\n", events_no); + ok(SetForegroundWindow(hwndMain), "SetForegroundWindow failed\n"); + } + SetLastError(0xdeafbeef); GetWindowLongPtrW(GetDesktopWindow(), GWLP_WNDPROC); is_win9x = (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED); @@ -7518,17 +7541,11 @@ START_TEST(win) test_FindWindowEx(); test_SetParent();
- hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window", - WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | - WS_MAXIMIZEBOX | WS_POPUP, - 100, 100, 200, 200, - 0, 0, GetModuleHandleA(NULL), NULL); hwndMain2 = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window 2", WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP, 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); - assert( hwndMain ); assert( hwndMain2 );
our_pid = GetWindowThreadProcessId(hwndMain, NULL);