Commit 447e6477 authored by Alexandre Julliard's avatar Alexandre Julliard

Added a couple of tests for SetActiveWindow.

parent 1cda8c77
......@@ -1607,6 +1607,34 @@ static void test_SetFocus(HWND hwnd)
DestroyWindow( child );
}
static void test_SetActiveWindow(HWND hwnd)
{
HWND hwnd2;
ShowWindow(hwnd, SW_SHOW);
SetActiveWindow(0);
SetActiveWindow(hwnd);
ok( GetActiveWindow() == hwnd, "Failed to set focus to visible window %p\n", hwnd );
SetWindowPos(hwnd,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_HIDEWINDOW);
ok( GetActiveWindow() == hwnd, "Window %p no longer active\n", hwnd );
SetWindowPos(hwnd,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_SHOWWINDOW);
ShowWindow(hwnd, SW_HIDE);
ok( GetActiveWindow() != hwnd, "Window %p is still active\n", hwnd );
ShowWindow(hwnd, SW_SHOW);
hwnd2 = CreateWindowExA(0, "static", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 0, 0, hwnd, 0, 0, NULL);
ok( GetActiveWindow() == hwnd2, "Window %p is not active\n", hwnd2 );
DestroyWindow(hwnd2);
ok( GetActiveWindow() != hwnd2, "Window %p is still active\n", hwnd2 );
hwnd2 = CreateWindowExA(0, "static", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 0, 0, hwnd, 0, 0, NULL);
ok( GetActiveWindow() == hwnd2, "Window %p is not active\n", hwnd2 );
SetWindowPos(hwnd2,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_HIDEWINDOW);
ok( GetActiveWindow() == hwnd2, "Window %p no longer active (%p)\n", hwnd2, GetActiveWindow() );
DestroyWindow(hwnd2);
ok( GetActiveWindow() != hwnd2, "Window %p is still active\n", hwnd2 );
}
START_TEST(win)
{
pGetAncestor = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetAncestor" );
......@@ -1653,6 +1681,7 @@ START_TEST(win)
test_SetWindowPos(hwndMain);
test_SetMenu(hwndMain);
test_SetFocus(hwndMain);
test_SetActiveWindow(hwndMain);
test_children_zorder(hwndMain);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment