Author: gadamopoulos
Date: Sat Sep 24 11:55:19 2011
New Revision: 53830
URL:
http://svn.reactos.org/svn/reactos?rev=53830&view=rev
Log:
[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
Modified:
trunk/rostests/apitests/user32/SetActiveWindow.c
trunk/rostests/apitests/user32/TrackMouseEvent.c
trunk/rostests/apitests/user32/helper.c
trunk/rostests/apitests/user32/helper.h
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] Sat Sep 24 11:55:19
2011
@@ -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,24 +26,43 @@
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 = get_iwnd(hWnd);
+
+ if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
+ return DefWindowProc(hWnd, message, wParam, lParam);
+
+ switch(message)
{
- int iwnd;
- iwnd = get_iwnd(hWnd);
- if(iwnd)
- record_message(iwnd, message, FALSE, 0,0);
+ 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()
@@ -58,17 +79,15 @@
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 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 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 @@
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 @@
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 @@
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 @@
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 @@
COMPARE_CACHE(Activate3_chain);
SetActiveWindow(hWnd1);
- FLUSH_MESSAGES(msg);
+ FlushMessages();
EXPECT_NEXT(hWnd2,hWnd4);
EXPECT_NEXT(hWnd4,hWnd1);
EXPECT_NEXT(hWnd1,hWnd3);
Modified: trunk/rostests/apitests/user32/TrackMouseEvent.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/TrackMous…
==============================================================================
--- trunk/rostests/apitests/user32/TrackMouseEvent.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/TrackMouseEvent.c [iso-8859-1] Sat Sep 24 11:55:19
2011
@@ -9,6 +9,7 @@
#include <wine/test.h>
#include <windows.h>
#include "helper.h"
+#include <undocuser.h>
HWND hWnd1, hWnd2, hWnd3;
HHOOK hMouseHookLL, hMouseHook;
@@ -23,21 +24,7 @@
LRESULT CALLBACK TmeTestProc(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 = get_iwnd(hWnd);
- if(iwnd)
- record_message(iwnd, message, FALSE,0,0);
- }
+ int iwnd = get_iwnd(hWnd);
if(message == WM_PAINT)
{
@@ -46,21 +33,52 @@
Rectangle(ps.hdc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right,
ps.rcPaint.bottom);
EndPaint(hWnd, &ps);
}
-
+
+ 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;
+ default:
+ record_message(iwnd, message, SENT, 0,0);
+ }
return DefWindowProc(hWnd, message, wParam, lParam);
}
static LRESULT CALLBACK MouseLLHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
- record_message(0, WH_MOUSE_LL, TRUE, wParam, 0);
+ record_message(0, WH_MOUSE_LL, HOOK, wParam, 0);
return CallNextHookEx(hMouseHookLL, nCode, wParam, lParam);
}
static LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
MOUSEHOOKSTRUCT *hs = (MOUSEHOOKSTRUCT*) lParam;
- record_message(get_iwnd(hs->hwnd), WH_MOUSE, TRUE, wParam, hs->wHitTestCode);
+ record_message(get_iwnd(hs->hwnd), WH_MOUSE, HOOK, wParam, hs->wHitTestCode);
return CallNextHookEx(hMouseHook, nCode, wParam, lParam);
+}
+
+static void FlushMessages()
+{
+ MSG msg;
+
+ while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
+ {
+ int iwnd = get_iwnd(msg.hwnd);
+ if(iwnd)
+ {
+ if(msg.message == WM_SYSTIMER)
+ record_message(iwnd, msg.message, POST,msg.wParam,0);
+ else 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()
@@ -114,73 +132,63 @@
return tme.dwFlags;
}
-#define FLUSH_MESSAGES(msg) while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
DispatchMessageA( &msg );
#define EXPECT_TME_FLAGS(hWnd, expected)
\
{ DWORD flags = TmeQuery(hWnd);
\
ok(flags == (expected),"wrong tme flags. expected %li, and got %li\n",
(DWORD)(expected), flags); \
}
-#define EXPECT_QUEUE_STATUS(expected, notexpected)
\
- {
\
- DWORD status = HIWORD(GetQueueStatus(QS_ALLEVENTS));
\
- ok(((status) & (expected))== (expected),"wrong queue status. expected
%li, and got %li\n", (DWORD)(expected), status); \
- if(notexpected)
\
- ok((status & (notexpected))!=(notexpected), "wrong queue status. got
non expected %li\n", (DWORD)(notexpected)); \
- }
-
MSG_ENTRY empty_chain[]= {{0,0}};
/* the mouse moves over hwnd2 */
MSG_ENTRY mousemove2_chain[]={{2, WM_NCHITTEST},
- {2, WH_MOUSE,1, WM_MOUSEMOVE, HTCLIENT},
+ {2, WH_MOUSE,HOOK, WM_MOUSEMOVE, HTCLIENT},
{2, WM_SETCURSOR},
{1, WM_SETCURSOR},
- {2, WM_MOUSEMOVE},
+ {2, WM_MOUSEMOVE, POST},
{0,0}};
/* the mouse hovers hwnd2 */
MSG_ENTRY mousehover2_chain[]={{2, WM_NCHITTEST},
- {2, WH_MOUSE,1, WM_MOUSEMOVE, HTCLIENT},
+ {2, WH_MOUSE,HOOK, WM_MOUSEMOVE, HTCLIENT},
{2, WM_SETCURSOR},
{1, WM_SETCURSOR},
- {2, WM_MOUSEMOVE},
- {2, WM_MOUSEHOVER},
+ {2, WM_MOUSEMOVE, POST},
+ {2, WM_SYSTIMER, POST, ID_TME_TIMER},
+ {2, WM_MOUSEHOVER, POST},
{0,0}};
/* the mouse leaves hwnd2 and moves to hwnd1 */
MSG_ENTRY mouseleave2to1_chain[]={{1, WM_NCHITTEST},
- {1, WH_MOUSE,1, WM_MOUSEMOVE, HTCLIENT},
+ {1, WH_MOUSE,HOOK, WM_MOUSEMOVE, HTCLIENT},
{1, WM_SETCURSOR},
- {1, WM_MOUSEMOVE},
- {2, WM_MOUSELEAVE},
+ {1, WM_MOUSEMOVE, POST},
+ {2, WM_MOUSELEAVE, POST},
{0,0}};
/* the mouse leaves hwnd2 and moves to hwnd3 */
MSG_ENTRY mouseleave2to3_chain[]={{3, WM_NCHITTEST},
- {3, WH_MOUSE,1, WM_MOUSEMOVE, HTCLIENT},
+ {3, WH_MOUSE,HOOK, WM_MOUSEMOVE, HTCLIENT},
{3, WM_SETCURSOR},
{1, WM_SETCURSOR},
- {3, WM_MOUSEMOVE},
- {2, WM_MOUSELEAVE},
+ {3, WM_MOUSEMOVE, POST},
+ {2, WM_MOUSELEAVE, POST},
{0,0}};
void Test_TrackMouseEvent()
{
- MSG msg;
-
SetCursorPos(0,0);
create_test_windows();
- FLUSH_MESSAGES(msg);
+ FlushMessages();
empty_message_cache();
/* the mouse moves over hwnd2 */
SetCursorPos(220,220);
- FLUSH_MESSAGES(msg);
+ FlushMessages();
COMPARE_CACHE(mousemove2_chain);
EXPECT_TME_FLAGS(hWnd2, 0);
TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE);
EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE);
- FLUSH_MESSAGES(msg);
+ FlushMessages();
COMPARE_CACHE(empty_chain);
/* the mouse hovers hwnd2 */
@@ -188,7 +196,7 @@
Sleep(100);
EXPECT_QUEUE_STATUS(QS_TIMER|QS_MOUSEMOVE, 0);
EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE);
- FLUSH_MESSAGES(msg);
+ FlushMessages();
EXPECT_TME_FLAGS(hWnd2, TME_LEAVE);
COMPARE_CACHE(mousehover2_chain);
@@ -196,17 +204,17 @@
SetCursorPos(150,150);
EXPECT_QUEUE_STATUS(QS_MOUSEMOVE,QS_TIMER );
EXPECT_TME_FLAGS(hWnd2, TME_LEAVE);
- FLUSH_MESSAGES(msg);
+ FlushMessages();
EXPECT_TME_FLAGS(hWnd2, 0);
COMPARE_CACHE(mouseleave2to1_chain);
- FLUSH_MESSAGES(msg);
+ FlushMessages();
COMPARE_CACHE(empty_chain);
/* the mouse moves over hwnd2 */
SetCursorPos(220,220);
EXPECT_QUEUE_STATUS(QS_MOUSEMOVE, QS_TIMER);
- FLUSH_MESSAGES(msg);
+ FlushMessages();
COMPARE_CACHE(mousemove2_chain);
EXPECT_TME_FLAGS(hWnd2, 0);
COMPARE_CACHE(empty_chain);
@@ -215,31 +223,31 @@
TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE);
TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE);
EXPECT_QUEUE_STATUS(0, QS_TIMER|QS_MOUSEMOVE);
- FLUSH_MESSAGES(msg);
- COMPARE_CACHE(empty_chain);
- EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE);
-
- FLUSH_MESSAGES(msg);
+ FlushMessages();
+ COMPARE_CACHE(empty_chain);
+ EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE);
+
+ FlushMessages();
COMPARE_CACHE(empty_chain);
/* the mouse moves from hwnd2 to the intersection of hwnd2 and hwnd3 */
SetCursorPos(300,300);
EXPECT_QUEUE_STATUS(QS_MOUSEMOVE, QS_TIMER);
- FLUSH_MESSAGES(msg);
+ FlushMessages();
EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE);
COMPARE_CACHE(mousemove2_chain);
- FLUSH_MESSAGES(msg);
+ FlushMessages();
COMPARE_CACHE(empty_chain);
/* the mouse moves from hwnd2 to hwnd3 */
SetCursorPos(400,400);
EXPECT_QUEUE_STATUS(QS_MOUSEMOVE, QS_TIMER);
- FLUSH_MESSAGES(msg);
+ FlushMessages();
EXPECT_TME_FLAGS(hWnd2, 0);
COMPARE_CACHE(mouseleave2to3_chain);
- FLUSH_MESSAGES(msg);
+ FlushMessages();
COMPARE_CACHE(empty_chain);
}
Modified: trunk/rostests/apitests/user32/helper.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/helper.c?…
==============================================================================
--- trunk/rostests/apitests/user32/helper.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/helper.c [iso-8859-1] Sat Sep 24 11:55:19 2011
@@ -9,7 +9,9 @@
#include <wine/test.h>
#include <windows.h>
#include "helper.h"
-
+#include <undocuser.h>
+
+MSG_ENTRY last_post_message;
MSG_ENTRY message_cache[100];
static int message_cache_size = 0;
@@ -38,6 +40,7 @@
case WM_NCHITTEST: return "WM_NCHITTEST";
case WM_SETCURSOR: return "WM_SETCURSOR";
case WM_MOUSEMOVE: return "WM_MOUSEMOVE";
+ case WM_SYSTIMER: return "WM_SYSTIMER";
default: return NULL;
}
}
@@ -56,6 +59,7 @@
void empty_message_cache()
{
+ memset(&last_post_message, 0, sizeof(last_post_message));
memset(message_cache, 0, sizeof(message_cache));
message_cache_size = 0;
}
@@ -68,8 +72,29 @@
}
else
{
- char* msgName = msg->hook ? get_hook_name(msg->msg) :
get_msg_name(msg->msg);
- char* msgType = msg->hook ? "hook" : "msg";
+ char* msgName;
+ char* msgType;
+
+ switch (msg->type)
+ {
+ case POST:
+ msgName = get_msg_name(msg->msg);
+ msgType = "post msg";
+ break;
+ case SENT:
+ msgName = get_msg_name(msg->msg);
+ msgType = "sent msg";
+ break;
+ case HOOK:
+ msgName = get_hook_name(msg->msg);
+ msgType = "hook";
+ break;
+ case EVENT:
+ msgName = NULL;
+ msgType = "event";
+ break;
+ }
+
if(msgName)
sprintf(buffer, "hwnd%d %s %s %d %d", msg->iwnd, msgType,
msgName, msg->param1, msg->param2);
else
@@ -126,18 +151,39 @@
empty_message_cache();
}
-void record_message(int iwnd, UINT message, BOOL hook, int param1,int param2)
+void record_message(int iwnd, UINT message, MSG_TYPE type, int param1,int param2)
{
if(message_cache_size>=100)
{
+ return;
+ }
+
+ /* do not report a post message a second time */
+ if(type == SENT &&
+ last_post_message.iwnd == iwnd &&
+ last_post_message.msg == message &&
+ last_post_message.param1 == param1 &&
+ last_post_message.param2 == param2)
+ {
+ memset(&last_post_message, 0, sizeof(last_post_message));
return;
}
message_cache[message_cache_size].iwnd = iwnd;
message_cache[message_cache_size].msg = message;
- message_cache[message_cache_size].hook = hook;
+ message_cache[message_cache_size].type = type;
message_cache[message_cache_size].param1 = param1;
message_cache[message_cache_size].param2 = param2;
+
+ if(message_cache[message_cache_size].type == POST)
+ {
+ last_post_message = message_cache[message_cache_size];
+ }
+ else
+ {
+ memset(&last_post_message, 0, sizeof(last_post_message));
+ }
+
message_cache_size++;
}
Modified: trunk/rostests/apitests/user32/helper.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/helper.h?…
==============================================================================
--- trunk/rostests/apitests/user32/helper.h [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/helper.h [iso-8859-1] Sat Sep 24 11:55:19 2011
@@ -1,24 +1,49 @@
+typedef enum _MSG_TYPE
+{
+ SENT,
+ POST,
+ HOOK,
+ EVENT
+} MSG_TYPE;
typedef struct _MSG_ENTRY
{
int iwnd;
UINT msg;
- BOOL hook;
+ MSG_TYPE type;
int param1;
int param2;
} MSG_ENTRY;
-void record_message(int iwnd, UINT message, BOOL hook, int param1,int param2);
+void record_message(int iwnd, UINT message, MSG_TYPE type, int param1,int param2);
void compare_cache(const char* file, int line, MSG_ENTRY *msg_chain);
void trace_cache(const char* file, int line);
void empty_message_cache();
ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName);
+/* filter messages that are affected by dwm */
+static _inline BOOL IsDWmMsg(UINT msg)
+{
+ switch(msg)
+ {
+ case WM_NCPAINT:
+ case WM_ERASEBKGND:
+ case WM_PAINT:
+ case 0x031f: /*WM_DWMNCRENDERINGCHANGED*/
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static _inline BOOL IseKeyMsg(UINT msg)
+{
+ return (msg == WM_KEYUP || msg == WM_KEYDOWN);
+}
+
#define COMPARE_CACHE(...) compare_cache(__FILE__, __LINE__, ##__VA_ARGS__)
#define TRACE_CACHE() trace_cache(__FILE__, __LINE__)
-#define FLUSH_MESSAGES(msg) while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
DispatchMessageA( &msg );
#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())