Author: gadamopoulos Date: Wed Sep 7 14:05:58 2011 New Revision: 53621
URL: http://svn.reactos.org/svn/reactos?rev=53621&view=rev Log: [user32_apitest] - Add a test case for SetActiveWindow that shows its behavior related to owner windows. It should point the bug observed in bug 1239
Added: trunk/rostests/apitests/user32/SetActiveWindow.c (with props) Modified: trunk/rostests/apitests/user32/CMakeLists.txt trunk/rostests/apitests/user32/testlist.c trunk/rostests/apitests/user32/user32_apitest.rbuild
Modified: trunk/rostests/apitests/user32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CMakeLists... ============================================================================== --- trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] Wed Sep 7 14:05:58 2011 @@ -14,6 +14,7 @@ ScrollDC.c ScrollWindowEx.c SetCursorPos.c + SetActiveWindow.c WndProc.c testlist.c user32_apitest.rc)
Added: trunk/rostests/apitests/user32/SetActiveWindow.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/SetActiveW... ============================================================================== --- trunk/rostests/apitests/user32/SetActiveWindow.c (added) +++ trunk/rostests/apitests/user32/SetActiveWindow.c [iso-8859-1] Wed Sep 7 14:05:58 2011 @@ -1,0 +1,52 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPL - See COPYING in the top level directory + * PURPOSE: Test for SetActiveWindow + * PROGRAMMERS: Giannis Adamopoulos + */ + +#include <stdio.h> +#include <wine/test.h> +#include <windows.h> + +void Test_SetActiveWindow() +{ + MSG msg; + HWND hWnd, hWnd1, hWnd2; + + hWnd = CreateWindowW(L"BUTTON", L"ownertest", WS_OVERLAPPEDWINDOW, + 20, 20, 300, 300, NULL, NULL, 0, NULL); + + hWnd1 = CreateWindowW(L"BUTTON", L"ownertest", WS_OVERLAPPEDWINDOW, + 20, 350, 300, 300, hWnd, NULL, 0, NULL); + + hWnd2 = CreateWindowW(L"BUTTON", L"ownertest", WS_OVERLAPPEDWINDOW, + 200, 200, 300, 300, NULL, NULL, 0, NULL); + + ShowWindow(hWnd, SW_SHOW); + UpdateWindow(hWnd); + ShowWindow(hWnd1, SW_SHOW); + UpdateWindow(hWnd1); + ShowWindow(hWnd2, SW_SHOW); + UpdateWindow(hWnd2); + + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + ok(GetWindow(hWnd2,GW_HWNDNEXT) == hWnd1, "Expected %p after %p, not %p\n",hWnd1,hWnd2,GetWindow(hWnd2,GW_HWNDNEXT) ); + ok(GetWindow(hWnd1,GW_HWNDNEXT) == hWnd, "Expected %p after %p, not %p\n",hWnd,hWnd1,GetWindow(hWnd1,GW_HWNDNEXT)); + ok(GetActiveWindow() == hWnd2, "Expected %p to be the active window, not %p\n",hWnd2,GetActiveWindow()); + + SetActiveWindow(hWnd); + + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + /* note: the owned is moved on top of the three windows */ + ok(GetActiveWindow() == hWnd, "Expected %p to be the active window, not %p\n",hWnd,GetActiveWindow()); + ok(GetWindow(hWnd1,GW_HWNDNEXT) == hWnd, "Expected %p after %p, not %p\n",hWnd,hWnd1,GetWindow(hWnd1,GW_HWNDNEXT) ); + ok(GetWindow(hWnd,GW_HWNDNEXT) == hWnd2, "Expected %p after %p, not %p\n",hWnd2,hWnd,GetWindow(hWnd,GW_HWNDNEXT) ); +} + +START_TEST(SetActiveWindow) +{ + Test_SetActiveWindow(); +}
Propchange: trunk/rostests/apitests/user32/SetActiveWindow.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/rostests/apitests/user32/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/testlist.c... ============================================================================== --- trunk/rostests/apitests/user32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/testlist.c [iso-8859-1] Wed Sep 7 14:05:58 2011 @@ -15,6 +15,7 @@ extern void func_DeferWindowPos(void); extern void func_GetKeyState(void); extern void func_SetCursorPos(void); +extern void func_SetActiveWindow(void); extern void func_WndProc(void);
const struct test winetest_testlist[] = @@ -29,6 +30,7 @@ { "DeferWindowPos", func_DeferWindowPos }, { "GetKeyState", func_GetKeyState }, { "SetCursorPos", func_SetCursorPos }, + { "SetActiveWindow", func_SetActiveWindow }, { "WndProc", func_WndProc }, { 0, 0 } };
Modified: trunk/rostests/apitests/user32/user32_apitest.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/user32_api... ============================================================================== --- trunk/rostests/apitests/user32/user32_apitest.rbuild [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/user32_apitest.rbuild [iso-8859-1] Wed Sep 7 14:05:58 2011 @@ -19,6 +19,7 @@ <file>GetIconInfo.c</file> <file>GetPeekMessage.c</file> <file>DeferWindowPos.c</file> + <file>SetActiveWindow.c</file> <file>SetCursorPos.c</file> <file>WndProc.c</file>