Author: gadamopoulos
Date: Wed Sep 7 23:08:14 2011
New Revision: 53632
URL:
http://svn.reactos.org/svn/reactos?rev=53632&view=rev
Log:
[user32_apitest]
- Add some more tests hoping that SetActiveWindow will reveal its secrets
Modified:
trunk/rostests/apitests/user32/SetActiveWindow.c
Modified: trunk/rostests/apitests/user32/SetActiveWindow.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/SetActive…
==============================================================================
--- trunk/rostests/apitests/user32/SetActiveWindow.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/SetActiveWindow.c [iso-8859-1] Wed Sep 7 23:08:14
2011
@@ -9,41 +9,81 @@
#include <wine/test.h>
#include <windows.h>
+
+#define EXPECT_NEXT(hWnd1, hWnd2) ok(GetWindow(hWnd1,GW_HWNDNEXT) == hWnd2,
"Expected %p after %p, not %p\n",hWnd2,hWnd1,GetWindow(hWnd1,GW_HWNDNEXT) )
+#define EXPECT_ACTIVE(hwnd) ok(GetActiveWindow() == hwnd, "Expected %p to be the
active window, not %p\n",hwnd,GetActiveWindow())
+
void Test_SetActiveWindow()
{
MSG msg;
- HWND hWnd, hWnd1, hWnd2;
+ HWND hWnd1, hWnd2, hWnd3, hWnd4;
- hWnd = CreateWindowW(L"BUTTON", L"ownertest",
WS_OVERLAPPEDWINDOW,
+ hWnd1 = 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,
+ 20, 350, 300, 300, hWnd1, NULL, 0, NULL);
- hWnd2 = CreateWindowW(L"BUTTON", L"ownertest",
WS_OVERLAPPEDWINDOW,
+ hWnd3 = CreateWindowW(L"BUTTON", L"ownertest",
WS_OVERLAPPEDWINDOW,
200, 200, 300, 300, NULL, NULL, 0, NULL);
- ShowWindow(hWnd, SW_SHOW);
- UpdateWindow(hWnd);
+ hWnd4 = CreateWindowW(L"BUTTON", L"ownertest",
WS_OVERLAPPEDWINDOW,
+ 250, 250, 200, 200, hWnd1, NULL, 0, NULL);
+
ShowWindow(hWnd1, SW_SHOW);
UpdateWindow(hWnd1);
+ while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
+
+ EXPECT_NEXT(hWnd4,hWnd2);
+ EXPECT_NEXT(hWnd1,hWnd3);
+
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());
+ EXPECT_NEXT(hWnd2,hWnd4);
+ EXPECT_NEXT(hWnd4,hWnd1);
- SetActiveWindow(hWnd);
-
+ ShowWindow(hWnd3, SW_SHOW);
+ UpdateWindow(hWnd3);
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) );
+ EXPECT_NEXT(hWnd3,hWnd2);
+ EXPECT_NEXT(hWnd2,hWnd4);
+ EXPECT_NEXT(hWnd4,hWnd1);
+
+ ShowWindow(hWnd4, SW_SHOW);
+ UpdateWindow(hWnd4);
+ while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
+
+ EXPECT_NEXT(hWnd4,hWnd2);
+ EXPECT_NEXT(hWnd2,hWnd1);
+ EXPECT_NEXT(hWnd1,hWnd3);
+ EXPECT_ACTIVE(hWnd4);
+
+ SetActiveWindow(hWnd1);
+ while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
+
+ EXPECT_NEXT(hWnd4,hWnd2);
+ EXPECT_NEXT(hWnd2,hWnd1);
+ EXPECT_NEXT(hWnd1,hWnd3);
+ EXPECT_ACTIVE(hWnd1);
+
+ SetActiveWindow(hWnd3);
+ while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
+
+ EXPECT_NEXT(hWnd3,hWnd4);
+ EXPECT_NEXT(hWnd4,hWnd2);
+ EXPECT_NEXT(hWnd2,hWnd1);
+ EXPECT_ACTIVE(hWnd3);
+
+ SetActiveWindow(hWnd2);
+ while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
+
+ EXPECT_NEXT(hWnd2,hWnd4);
+ EXPECT_NEXT(hWnd4,hWnd1);
+ EXPECT_NEXT(hWnd1,hWnd3);
+ EXPECT_ACTIVE(hWnd2);
}
START_TEST(SetActiveWindow)