mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 02:05:57 +00:00
[user32_apitest]
- Implement logging post messages or winevents - For SetActiveWindow test, also test the parameters of WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED messages - For TrackMouseEvent test, also test the WM_SYSTIMER that is possible to be logged now svn path=/trunk/; revision=53830
This commit is contained in:
parent
0048dee2cc
commit
31eb9d7849
4 changed files with 199 additions and 103 deletions
|
@ -9,10 +9,12 @@
|
|||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
#include "helper.h"
|
||||
#include <undocuser.h>
|
||||
|
||||
MSG_ENTRY message_cache[100];
|
||||
HWND hWnd1, hWnd2, hWnd3, hWnd4;
|
||||
|
||||
/* FIXME: test for HWND_TOP, etc...*/
|
||||
static int get_iwnd(HWND hWnd)
|
||||
{
|
||||
if(hWnd == hWnd1) return 1;
|
||||
|
@ -24,26 +26,45 @@ static int get_iwnd(HWND hWnd)
|
|||
|
||||
LRESULT CALLBACK OwnerTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if(message < WM_USER &&
|
||||
message != WM_IME_SETCONTEXT &&
|
||||
message != WM_IME_NOTIFY &&
|
||||
message != WM_KEYUP &&
|
||||
message != WM_GETICON &&
|
||||
message != WM_GETTEXT && /* the following messages have to be ignroed because dwm changes the time they are sent */
|
||||
message != WM_NCPAINT &&
|
||||
message != WM_ERASEBKGND &&
|
||||
message != WM_PAINT &&
|
||||
message != 0x031f /*WM_DWMNCRENDERINGCHANGED*/)
|
||||
{
|
||||
int iwnd;
|
||||
iwnd = get_iwnd(hWnd);
|
||||
if(iwnd)
|
||||
record_message(iwnd, message, FALSE, 0,0);
|
||||
}
|
||||
int iwnd = get_iwnd(hWnd);
|
||||
|
||||
if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
|
||||
switch(message)
|
||||
{
|
||||
case WM_IME_SETCONTEXT:
|
||||
case WM_IME_NOTIFY :
|
||||
case WM_GETICON :
|
||||
case WM_GETTEXT:
|
||||
break;
|
||||
case WM_WINDOWPOSCHANGING:
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
{
|
||||
WINDOWPOS* pwp = (WINDOWPOS*)lParam;
|
||||
ok(wParam==0,"expected wParam=0\n");
|
||||
record_message(iwnd, message, SENT, get_iwnd(pwp->hwndInsertAfter), pwp->flags);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
record_message(iwnd, message, SENT, 0,0);
|
||||
}
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
static void FlushMessages()
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
|
||||
{
|
||||
int iwnd = get_iwnd(msg.hwnd);
|
||||
if(!(msg.message > WM_USER || !iwnd || IsDWmMsg(msg.message) || IseKeyMsg(msg.message)))
|
||||
record_message(iwnd, msg.message, POST,0,0);
|
||||
DispatchMessageA( &msg );
|
||||
}
|
||||
}
|
||||
|
||||
static void create_test_windows()
|
||||
{
|
||||
RegisterSimpleClass(OwnerTestProc, L"ownertest");
|
||||
|
@ -58,17 +79,15 @@ static void create_test_windows()
|
|||
|
||||
hWnd4 = CreateWindowW(L"ownertest", L"ownertest", WS_OVERLAPPEDWINDOW,
|
||||
250, 250, 200, 200, hWnd1, NULL, 0, NULL);
|
||||
|
||||
trace("1:%p, 2:%p, 3:%p,4:%p\n", hWnd1, hWnd2, hWnd3, hWnd4);
|
||||
}
|
||||
|
||||
/* the actual test begins here */
|
||||
|
||||
MSG_ENTRY Activate1_chain[]={{4,WM_NCACTIVATE},
|
||||
{4,WM_ACTIVATE},
|
||||
{4,WM_WINDOWPOSCHANGING},
|
||||
{2,WM_WINDOWPOSCHANGING},
|
||||
{1,WM_WINDOWPOSCHANGING},
|
||||
{4,WM_WINDOWPOSCHANGING,SENT,0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE},
|
||||
{2,WM_WINDOWPOSCHANGING,SENT,4,SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE},
|
||||
{1,WM_WINDOWPOSCHANGING,SENT,2,SWP_NOMOVE | SWP_NOSIZE},
|
||||
{1,WM_NCACTIVATE},
|
||||
{1,WM_ACTIVATE},
|
||||
{4,WM_KILLFOCUS},
|
||||
|
@ -77,8 +96,8 @@ MSG_ENTRY Activate1_chain[]={{4,WM_NCACTIVATE},
|
|||
|
||||
MSG_ENTRY Activate2_chain[]={{1,WM_NCACTIVATE},
|
||||
{1,WM_ACTIVATE},
|
||||
{3,WM_WINDOWPOSCHANGING},
|
||||
{3,WM_WINDOWPOSCHANGED},
|
||||
{3,WM_WINDOWPOSCHANGING,SENT, 0, SWP_NOMOVE | SWP_NOSIZE},
|
||||
{3,WM_WINDOWPOSCHANGED ,SENT, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOCLIENTMOVE|SWP_NOCLIENTSIZE},
|
||||
{3,WM_NCACTIVATE},
|
||||
{3,WM_ACTIVATE},
|
||||
{1,WM_KILLFOCUS},
|
||||
|
@ -87,23 +106,23 @@ MSG_ENTRY Activate2_chain[]={{1,WM_NCACTIVATE},
|
|||
|
||||
MSG_ENTRY Activate3_chain[]={{3,WM_NCACTIVATE},
|
||||
{3,WM_ACTIVATE},
|
||||
{2,WM_WINDOWPOSCHANGING},
|
||||
{4,WM_WINDOWPOSCHANGING},
|
||||
{1,WM_WINDOWPOSCHANGING},
|
||||
{2,WM_WINDOWPOSCHANGED},
|
||||
{4,WM_WINDOWPOSCHANGED},
|
||||
{1,WM_WINDOWPOSCHANGED},
|
||||
{2,WM_WINDOWPOSCHANGING, SENT,0, SWP_NOMOVE | SWP_NOSIZE },
|
||||
{4,WM_WINDOWPOSCHANGING, SENT,2, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE},
|
||||
{1,WM_WINDOWPOSCHANGING, SENT,4, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE},
|
||||
{2,WM_WINDOWPOSCHANGED, SENT,0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOCLIENTMOVE |SWP_NOCLIENTSIZE },
|
||||
{4,WM_WINDOWPOSCHANGED, SENT,2, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE |SWP_NOCLIENTMOVE|SWP_NOCLIENTSIZE},
|
||||
{1,WM_WINDOWPOSCHANGED, SENT,4, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE |SWP_NOCLIENTMOVE|SWP_NOCLIENTSIZE},
|
||||
{2,WM_NCACTIVATE},
|
||||
{2,WM_ACTIVATE},
|
||||
{3,WM_KILLFOCUS},
|
||||
{2,WM_SETFOCUS},
|
||||
{0,0}};
|
||||
|
||||
MSG_ENTRY Activate4_chain[]={{2,WM_NCACTIVATE},
|
||||
MSG_ENTRY Activate4_chain[]={{2,WM_NCACTIVATE, },
|
||||
{2,WM_ACTIVATE},
|
||||
{2,WM_WINDOWPOSCHANGING},
|
||||
{4,WM_WINDOWPOSCHANGING},
|
||||
{1,WM_WINDOWPOSCHANGING},
|
||||
{2,WM_WINDOWPOSCHANGING, SENT ,0 ,SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE},
|
||||
{4,WM_WINDOWPOSCHANGING, SENT, 2, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE} ,
|
||||
{1,WM_WINDOWPOSCHANGING, SENT, 4, SWP_NOMOVE | SWP_NOSIZE},
|
||||
{1,WM_NCACTIVATE},
|
||||
{1,WM_ACTIVATE},
|
||||
{2,WM_KILLFOCUS},
|
||||
|
@ -112,34 +131,32 @@ MSG_ENTRY Activate4_chain[]={{2,WM_NCACTIVATE},
|
|||
|
||||
void Test_SetActiveWindow()
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
SetCursorPos(0,0);
|
||||
|
||||
create_test_windows();
|
||||
|
||||
ShowWindow(hWnd1, SW_SHOW);
|
||||
UpdateWindow(hWnd1);
|
||||
FLUSH_MESSAGES(msg);
|
||||
FlushMessages();
|
||||
EXPECT_NEXT(hWnd4,hWnd2);
|
||||
EXPECT_NEXT(hWnd1,hWnd3);
|
||||
|
||||
ShowWindow(hWnd2, SW_SHOW);
|
||||
UpdateWindow(hWnd2);
|
||||
FLUSH_MESSAGES(msg);
|
||||
FlushMessages();
|
||||
EXPECT_NEXT(hWnd2,hWnd4);
|
||||
EXPECT_NEXT(hWnd4,hWnd1);
|
||||
|
||||
ShowWindow(hWnd3, SW_SHOW);
|
||||
UpdateWindow(hWnd3);
|
||||
FLUSH_MESSAGES(msg);
|
||||
FlushMessages();
|
||||
EXPECT_NEXT(hWnd3,hWnd2);
|
||||
EXPECT_NEXT(hWnd2,hWnd4);
|
||||
EXPECT_NEXT(hWnd4,hWnd1);
|
||||
|
||||
ShowWindow(hWnd4, SW_SHOW);
|
||||
UpdateWindow(hWnd4);
|
||||
FLUSH_MESSAGES(msg);
|
||||
FlushMessages();
|
||||
EXPECT_NEXT(hWnd4,hWnd2);
|
||||
EXPECT_NEXT(hWnd2,hWnd1);
|
||||
EXPECT_NEXT(hWnd1,hWnd3);
|
||||
|
@ -148,7 +165,7 @@ void Test_SetActiveWindow()
|
|||
empty_message_cache();
|
||||
|
||||
SetActiveWindow(hWnd1);
|
||||
FLUSH_MESSAGES(msg);
|
||||
FlushMessages();
|
||||
EXPECT_NEXT(hWnd4,hWnd2);
|
||||
EXPECT_NEXT(hWnd2,hWnd1);
|
||||
EXPECT_NEXT(hWnd1,hWnd3);
|
||||
|
@ -156,7 +173,7 @@ void Test_SetActiveWindow()
|
|||
COMPARE_CACHE(Activate1_chain);
|
||||
|
||||
SetActiveWindow(hWnd3);
|
||||
FLUSH_MESSAGES(msg);
|
||||
FlushMessages();
|
||||
EXPECT_NEXT(hWnd3,hWnd4);
|
||||
EXPECT_NEXT(hWnd4,hWnd2);
|
||||
EXPECT_NEXT(hWnd2,hWnd1);
|
||||
|
@ -164,7 +181,7 @@ void Test_SetActiveWindow()
|
|||
COMPARE_CACHE(Activate2_chain);
|
||||
|
||||
SetActiveWindow(hWnd2);
|
||||
FLUSH_MESSAGES(msg);
|
||||
FlushMessages();
|
||||
EXPECT_NEXT(hWnd2,hWnd4);
|
||||
EXPECT_NEXT(hWnd4,hWnd1);
|
||||
EXPECT_NEXT(hWnd1,hWnd3);
|
||||
|
@ -172,7 +189,7 @@ void Test_SetActiveWindow()
|
|||
COMPARE_CACHE(Activate3_chain);
|
||||
|
||||
SetActiveWindow(hWnd1);
|
||||
FLUSH_MESSAGES(msg);
|
||||
FlushMessages();
|
||||
EXPECT_NEXT(hWnd2,hWnd4);
|
||||
EXPECT_NEXT(hWnd4,hWnd1);
|
||||
EXPECT_NEXT(hWnd1,hWnd3);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue