[SHELL32_APITEST] -Add some tests for SHParseDisplayName for CORE-12882.
[reactos.git] / rostests / apitests / include / msgtrace.h
1 #ifndef APITESTS_MSGTRACE_H
2 #define APITESTS_MSGTRACE_H
3
4 typedef enum _MSG_TYPE
5 {
6 SENT,
7 POST,
8 HOOK,
9 EVENT
10 } MSG_TYPE;
11
12 typedef struct _MSG_ENTRY
13 {
14 int iwnd;
15 UINT msg;
16 MSG_TYPE type;
17 int param1;
18 int param2;
19 } MSG_ENTRY;
20
21 typedef struct _MSG_CACHE
22 {
23 MSG_ENTRY last_post_message;
24 MSG_ENTRY message_cache[100];
25 int count;
26 } MSG_CACHE;
27
28 extern MSG_ENTRY empty_chain[];
29 extern MSG_CACHE default_cache;
30
31 void record_message(MSG_CACHE* cache, int iwnd, UINT message, MSG_TYPE type, int param1,int param2);
32 void compare_cache(MSG_CACHE* cache, const char* file, int line, MSG_ENTRY *msg_chain);
33 void trace_cache(MSG_CACHE* cache, const char* file, int line);
34 void empty_message_cache(MSG_CACHE* cache);
35
36 /* filter messages that are affected by dwm */
37 static inline BOOL IsDWmMsg(UINT msg)
38 {
39 switch(msg)
40 {
41 case WM_NCPAINT:
42 case WM_ERASEBKGND:
43 case WM_PAINT:
44 case 0x031f: /*WM_DWMNCRENDERINGCHANGED*/
45 return TRUE;
46 }
47 return FALSE;
48 }
49
50 static inline BOOL IseKeyMsg(UINT msg)
51 {
52 return (msg == WM_KEYUP || msg == WM_KEYDOWN);
53 }
54
55 #define COMPARE_CACHE(msg_chain) compare_cache(&default_cache, __FILE__, __LINE__, msg_chain)
56 #define TRACE_CACHE() trace_cache(&default_cache, __FILE__, __LINE__)
57 #define EMPTY_CACHE() empty_message_cache(&default_cache);
58 #define RECORD_MESSAGE(...) record_message(&default_cache, ##__VA_ARGS__);
59
60 #define COMPARE_CACHE_(cache, msg_chain) compare_cache(cache, __FILE__, __LINE__, msg_chain)
61 #define TRACE_CACHE_(cache) trace_cache(cache, __FILE__, __LINE__)
62 #define EMPTY_CACHE_(cache) empty_message_cache(cache);
63
64 #define EXPECT_QUEUE_STATUS(expected, notexpected) \
65 { \
66 DWORD status = HIWORD(GetQueueStatus(QS_ALLEVENTS)); \
67 ok(((status) & (expected))== (expected),"wrong queue status. expected %li, and got %li\n", (DWORD)(expected), status); \
68 if(notexpected) \
69 ok((status & (notexpected))!=(notexpected), "wrong queue status. got non expected %li\n", (DWORD)(notexpected)); \
70 }
71
72 #endif