ReactOS 0.4.15-dev-7906-g1b85a5f
msg.h File Reference
#include <assert.h>
#include <windows.h>
#include "wine/heap.h"
#include "wine/test.h"
Include dependency graph for msg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  message
 
struct  msg_sequence
 

Macros

#define SWP_NOCLIENTSIZE   0x0800
 
#define SWP_NOCLIENTMOVE   0x1000
 
#define ok_sequence(seq, index, exp, contx, todo)    ok_sequence_(seq, index, (exp), (contx), (todo), __FILE__, __LINE__)
 

Enumerations

enum  msg_flags_t {
  sent = 0x1 , posted = 0x2 , parent = 0x4 , wparam = 0x8 ,
  lparam = 0x10 , defwinproc = 0x20 , beginpaint = 0x40 , optional = 0x80 ,
  hook = 0x100 , winevent_hook = 0x200 , kbd_hook = 0x400 , sent = 0x1 ,
  posted = 0x2 , parent = 0x4 , wparam = 0x8 , lparam = 0x10 ,
  defwinproc = 0x20 , beginpaint = 0x40 , optional = 0x80 , hook = 0x100 ,
  winevent_hook =0x200 , id = 0x400 , custdraw = 0x800 , sent = 0x1 ,
  posted = 0x2 , parent = 0x4 , wparam = 0x8 , lparam = 0x10 ,
  defwinproc = 0x20 , beginpaint = 0x40 , optional = 0x80 , hook = 0x100 ,
  winevent_hook =0x200 , id = 0x400 , sent =0x1 , posted =0x2 ,
  parent =0x4 , wparam =0x8 , lparam =0x10 , defwinproc =0x20 ,
  beginpaint =0x40 , optional =0x80 , hook =0x100 , winevent_hook =0x200 ,
  sent =0x1 , posted =0x2 , parent =0x4 , wparam =0x8 ,
  lparam =0x10 , defwinproc =0x20 , beginpaint =0x40 , optional =0x80 ,
  hook =0x100 , winevent_hook =0x200 , kbd_hook =0x400
}
 

Functions

static void add_message (struct msg_sequence **seq, int sequence_index, const struct message *msg)
 
static void flush_sequence (struct msg_sequence **seg, int sequence_index)
 
static void flush_sequences (struct msg_sequence **seq, int n)
 
static void dump_sequence (struct msg_sequence **seq, int sequence_index, const struct message *expected, const char *context, const char *file, int line)
 
static void ok_sequence_ (struct msg_sequence **seq, int sequence_index, const struct message *expected_list, const char *context, BOOL todo, const char *file, int line)
 
static void init_msg_sequences (struct msg_sequence **seq, int n)
 

Macro Definition Documentation

◆ ok_sequence

#define ok_sequence (   seq,
  index,
  exp,
  contx,
  todo 
)     ok_sequence_(seq, index, (exp), (contx), (todo), __FILE__, __LINE__)

Definition at line 387 of file msg.h.

◆ SWP_NOCLIENTMOVE

#define SWP_NOCLIENTMOVE   0x1000

Definition at line 30 of file msg.h.

◆ SWP_NOCLIENTSIZE

#define SWP_NOCLIENTSIZE   0x0800

Definition at line 29 of file msg.h.

Enumeration Type Documentation

◆ msg_flags_t

Enumerator
sent 
posted 
parent 
wparam 
lparam 
defwinproc 
beginpaint 
optional 
hook 
winevent_hook 
kbd_hook 
sent 
posted 
parent 
wparam 
lparam 
defwinproc 
beginpaint 
optional 
hook 
winevent_hook 
id 
custdraw 
sent 
posted 
parent 
wparam 
lparam 
defwinproc 
beginpaint 
optional 
hook 
winevent_hook 
id 
sent 
posted 
parent 
wparam 
lparam 
defwinproc 
beginpaint 
optional 
hook 
winevent_hook 
sent 
posted 
parent 
wparam 
lparam 
defwinproc 
beginpaint 
optional 
hook 
winevent_hook 
kbd_hook 

Definition at line 32 of file msg.h.

33{
34 sent = 0x1,
35 posted = 0x2,
36 parent = 0x4,
37 wparam = 0x8,
38 lparam = 0x10,
39 defwinproc = 0x20,
40 beginpaint = 0x40,
41 optional = 0x80,
42 hook = 0x100,
43 winevent_hook =0x200,
44 id = 0x400,
45 custdraw = 0x800
msg_flags_t
Definition: msg.h:33
@ sent
Definition: msg.h:34
@ beginpaint
Definition: msg.h:40
@ defwinproc
Definition: msg.h:39
@ parent
Definition: msg.h:36
@ posted
Definition: msg.h:35
@ lparam
Definition: msg.h:38
@ hook
Definition: msg.h:42
@ winevent_hook
Definition: msg.h:43
@ custdraw
Definition: msg.h:45
@ wparam
Definition: msg.h:37
@ optional
Definition: msg.h:41

Function Documentation

◆ add_message()

static void add_message ( struct msg_sequence **  seq,
int  sequence_index,
const struct message msg 
)
static

Definition at line 66 of file msg.h.

68{
69 struct msg_sequence *msg_seq = seq[sequence_index];
70
71 if (!msg_seq->sequence)
72 {
73 msg_seq->size = 10;
74 msg_seq->sequence = heap_alloc(msg_seq->size * sizeof (*msg_seq->sequence));
75 }
76
77 if (msg_seq->count == msg_seq->size)
78 {
79 msg_seq->size *= 2;
80 msg_seq->sequence = heap_realloc(msg_seq->sequence, msg_seq->size * sizeof (*msg_seq->sequence));
81 }
82
83 assert(msg_seq->sequence);
84
85 msg_seq->sequence[msg_seq->count] = *msg;
86 msg_seq->count++;
87}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
#define msg(x)
Definition: auth_time.c:54
#define assert(x)
Definition: debug.h:53
struct message * sequence
Definition: msg.h:63
int count
Definition: msg.h:61
int size
Definition: msg.h:62
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

◆ dump_sequence()

static void dump_sequence ( struct msg_sequence **  seq,
int  sequence_index,
const struct message expected,
const char context,
const char file,
int  line 
)
static

Definition at line 105 of file msg.h.

108{
109 struct msg_sequence *msg_seq = seq[sequence_index];
110 const struct message *actual, *sequence;
111 unsigned int count = 0;
112
113 sequence = msg_seq->sequence;
114 actual = sequence;
115
116 trace_(file, line)("Failed sequence %s:\n", context );
117 while (expected->message && actual->message)
118 {
119 trace_(file, line)( " %u: expected: %04x - actual: %04x wp %08lx lp %08lx\n",
120 count, expected->message, actual->message, actual->wParam, actual->lParam );
121
122 if (expected->message == actual->message)
123 {
124 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) &&
125 (expected->flags & optional))
126 {
127 /* don't match messages if their defwinproc status differs */
128 expected++;
129 }
130 else
131 {
132 expected++;
133 actual++;
134 }
135 }
136 else
137 {
138 expected++;
139 actual++;
140 }
141 count++;
142 }
143
144 /* optional trailing messages */
145 while (expected->message && expected->flags & optional)
146 {
147 trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
148 expected++;
149 count++;
150 }
151
152 if (expected->message)
153 {
154 trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
155 return;
156 }
157
158 while (actual->message)
159 {
160 trace_(file, line)( " %u: expected: nothing - actual: %04x wp %08lx lp %08lx\n",
161 count, actual->message, actual->wParam, actual->lParam );
162 actual++;
163 count++;
164 }
165}
static struct recvd_message * sequence
Definition: SystemMenu.c:63
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define trace_(file, line,...)
Definition: kmt_test.h:223
BOOL expected
Definition: store.c:2063
Definition: http.c:7252
Definition: fci.c:127
Definition: parser.c:49
Definition: tftpd.h:60
UINT message
Definition: SystemMenu.c:42
msg_flags_t flags
Definition: SystemMenu.c:43

Referenced by ok_sequence_().

◆ flush_sequence()

static void flush_sequence ( struct msg_sequence **  seg,
int  sequence_index 
)
inlinestatic

Definition at line 89 of file msg.h.

90{
91 struct msg_sequence *msg_seq = seg[sequence_index];
92 heap_free(msg_seq->sequence);
93 msg_seq->sequence = NULL;
94 msg_seq->count = msg_seq->size = 0;
95}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define NULL
Definition: types.h:112

◆ flush_sequences()

static void flush_sequences ( struct msg_sequence **  seq,
int  n 
)
inlinestatic

Definition at line 97 of file msg.h.

98{
99 int i;
100
101 for (i = 0; i < n; i++)
102 flush_sequence(seq, i);
103}
static void flush_sequence(void)
Definition: SystemMenu.c:184
GLdouble n
Definition: glext.h:7729
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by create_custom_header_control(), create_parent_window(), run_test_(), START_TEST(), test_button_messages(), test_callback(), test_callback_mask(), test_canceleditlabel(), test_change_focus(), test_color(), test_columns(), test_comboex_get_set_item(), test_create(), test_create_syslink(), test_curfocus(), test_currdate(), test_cursel(), test_customdraw(), test_delete_focus(), test_delete_items(), test_destroy(), test_destroynotify(), test_dtm_get_monthcal(), test_dtm_set_and_get_mccolor(), test_dtm_set_and_get_mcfont(), test_dtm_set_and_get_range(), test_dtm_set_and_get_system_time(), test_dtm_set_and_get_systemtime_with_limits(), test_dtm_set_format(), test_dtm_set_range_swap_min_max(), test_editbox(), test_expandnotify(), test_extendedstyle(), test_fillroot(), test_firstDay(), test_focus(), test_get_set_bkcolor(), test_get_set_imagelist(), test_get_set_indent(), test_get_set_insertmark(), test_get_set_item(), test_get_set_itemheight(), test_get_set_scrolltime(), test_get_set_textcolor(), test_get_set_tooltips(), test_get_set_unicodeformat(), test_getitemposition(), test_getitemtext(), test_GetListBoxInfo(), test_getorigin(), test_getset_item(), test_getset_tooltips(), test_GetSetCurrentViewMode(), test_hdm_bitmapmarginMessages(), test_hdm_filterMessages(), test_hdm_getitemrect(), test_hdm_hittest(), test_hdm_imageMessages(), test_hdm_index_messages(), test_hdm_layout(), test_hdm_ordertoindex(), test_hdm_sethotdivider(), test_hdm_unicodeformatMessages(), test_header_notification(), test_header_notification2(), test_hittest(), test_hover(), test_icon_spacing(), test_IFolderView(), test_ignore_selection(), test_imagelists(), test_indentation(), test_insert_focus(), test_insertitem(), test_item_count(), test_item_position(), test_items(), test_line_size(), test_LVN_ENDLABELEDIT(), test_LVS_EX_TRANSPARENTBKGND(), test_maxselday(), test_monthrange(), test_multiselect(), test_norecompute(), test_ownerdata(), test_page_size(), test_pager(), test_position(), test_range(), test_redraw(), test_right_click(), test_save(), test_scroll(), test_scrollnotify(), test_select(), test_selection(), test_setredraw(), test_subitem_rect(), test_TCM_GETROWCOUNT(), test_TCN_SELCHANGING(), test_thumb_length(), test_tic_placement(), test_tic_settings(), test_today(), test_todaylink(), test_tool_tips(), test_tooltip(), test_trackbar_buddy(), test_TTN_SHOW(), test_TVS_SINGLEEXPAND(), test_unicode(), test_unicodeformat(), test_updown_base(), test_updown_buddy(), test_updown_create(), test_updown_pos(), test_updown_pos32(), test_updown_pos_notifications(), test_updown_unicode(), test_WM_CONTEXTMENU(), test_WM_KEYDOWN(), test_WM_MEASUREITEM(), and verify_msgs_in_().

◆ init_msg_sequences()

static void init_msg_sequences ( struct msg_sequence **  seq,
int  n 
)
inlinestatic

Definition at line 391 of file msg.h.

392{
393 int i;
394
395 for (i = 0; i < n; i++)
396 seq[i] = heap_alloc_zero(sizeof(*seq[i]));
397}

Referenced by START_TEST(), and test_messages().

◆ ok_sequence_()

static void ok_sequence_ ( struct msg_sequence **  seq,
int  sequence_index,
const struct message expected_list,
const char context,
BOOL  todo,
const char file,
int  line 
)
inlinestatic

Definition at line 167 of file msg.h.

170{
171 static const struct message end_of_sequence = {0, 0, 0, 0};
172 struct msg_sequence *msg_seq = seq[sequence_index];
173 const struct message *expected = expected_list;
174 const struct message *actual, *sequence;
175 int failcount = 0, dump = 0;
176
177 add_message(seq, sequence_index, &end_of_sequence);
178
179 sequence = msg_seq->sequence;
180 actual = sequence;
181
182 while (expected->message && actual->message)
183 {
184 if (expected->message == actual->message)
185 {
186 if (expected->flags & wparam)
187 {
188 if (expected->wParam != actual->wParam && todo)
189 {
191 {
192 failcount++;
193 dump++;
194 ok_(file, line) (FALSE,
195 "%s: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
196 context, expected->message, expected->wParam, actual->wParam);
197 }
198 }
199 else
200 {
201 ok_(file, line) (expected->wParam == actual->wParam,
202 "%s: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
203 context, expected->message, expected->wParam, actual->wParam);
204 if (expected->wParam != actual->wParam) dump++;
205 }
206 }
207
208 if (expected->flags & lparam)
209 {
210 if (expected->lParam != actual->lParam && todo)
211 {
213 {
214 failcount++;
215 dump++;
216 ok_(file, line) (FALSE,
217 "%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
218 context, expected->message, expected->lParam, actual->lParam);
219 }
220 }
221 else
222 {
223 ok_(file, line) (expected->lParam == actual->lParam,
224 "%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
225 context, expected->message, expected->lParam, actual->lParam);
226 if (expected->lParam != actual->lParam) dump++;
227 }
228 }
229
230 if (expected->flags & custdraw)
231 {
232 if (expected->stage != actual->stage && todo)
233 {
235 {
236 failcount++;
237 dump++;
238 ok_(file, line) (FALSE,
239 "%s: in msg 0x%04x expecting cd stage 0x%08x got 0x%08x\n",
240 context, expected->message, expected->stage, actual->stage);
241 }
242 }
243 else
244 {
245 ok_(file, line) (expected->stage == actual->stage,
246 "%s: in msg 0x%04x expecting cd stage 0x%08x got 0x%08x\n",
247 context, expected->message, expected->stage, actual->stage);
248 if (expected->stage != actual->stage) dump++;
249 }
250 }
251
252 if (expected->flags & id)
253 {
254 if (expected->id != actual->id && expected->flags & optional)
255 {
256 expected++;
257 continue;
258 }
259 if (expected->id != actual->id && todo)
260 {
262 {
263 failcount++;
264 dump++;
265 ok_(file, line) (FALSE,
266 "%s: in msg 0x%04x expecting id 0x%x got 0x%x\n",
267 context, expected->message, expected->id, actual->id);
268 }
269 }
270 else
271 {
272 ok_(file, line) (expected->id == actual->id,
273 "%s: in msg 0x%04x expecting id 0x%x got 0x%x\n",
274 context, expected->message, expected->id, actual->id);
275 if (expected->id != actual->id) dump++;
276 }
277 }
278
279 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) && todo)
280 {
282 {
283 failcount++;
284 dump++;
285 ok_(file, line) (FALSE,
286 "%s: the msg 0x%04x should %shave been sent by DefWindowProc\n",
287 context, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
288 }
289 }
290 else
291 {
292 ok_(file, line) ((expected->flags & defwinproc) == (actual->flags & defwinproc),
293 "%s: the msg 0x%04x should %shave been sent by DefWindowProc\n",
294 context, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
295 if ((expected->flags & defwinproc) != (actual->flags & defwinproc)) dump++;
296 }
297
298 ok_(file, line) ((expected->flags & beginpaint) == (actual->flags & beginpaint),
299 "%s: the msg 0x%04x should %shave been sent by BeginPaint\n",
300 context, expected->message, (expected->flags & beginpaint) ? "" : "NOT ");
301 if ((expected->flags & beginpaint) != (actual->flags & beginpaint)) dump++;
302
303 ok_(file, line) ((expected->flags & (sent|posted)) == (actual->flags & (sent|posted)),
304 "%s: the msg 0x%04x should have been %s\n",
305 context, expected->message, (expected->flags & posted) ? "posted" : "sent");
306 if ((expected->flags & (sent|posted)) != (actual->flags & (sent|posted))) dump++;
307
308 ok_(file, line) ((expected->flags & parent) == (actual->flags & parent),
309 "%s: the msg 0x%04x was expected in %s\n",
310 context, expected->message, (expected->flags & parent) ? "parent" : "child");
311 if ((expected->flags & parent) != (actual->flags & parent)) dump++;
312
313 ok_(file, line) ((expected->flags & hook) == (actual->flags & hook),
314 "%s: the msg 0x%04x should have been sent by a hook\n",
315 context, expected->message);
316 if ((expected->flags & hook) != (actual->flags & hook)) dump++;
317
318 ok_(file, line) ((expected->flags & winevent_hook) == (actual->flags & winevent_hook),
319 "%s: the msg 0x%04x should have been sent by a winevent hook\n",
320 context, expected->message);
321 if ((expected->flags & winevent_hook) != (actual->flags & winevent_hook)) dump++;
322
323 expected++;
324 actual++;
325 }
326 else if (expected->flags & optional)
327 expected++;
328 else if (todo)
329 {
330 failcount++;
331 dump++;
333 {
334 ok_(file, line) (FALSE, "%s: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
335 context, expected->message, actual->message);
336 }
337 goto done;
338 }
339 else
340 {
341 ok_(file, line) (FALSE, "%s: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
342 context, expected->message, actual->message);
343 dump++;
344 expected++;
345 actual++;
346 }
347 }
348
349 /* skip all optional trailing messages */
350 while (expected->message && ((expected->flags & optional)))
351 expected++;
352
353 if (todo)
354 {
356 {
357 if (expected->message || actual->message)
358 {
359 failcount++;
360 dump++;
361 ok_(file, line) (FALSE, "%s: the msg sequence is not complete: expected %04x - actual %04x\n",
362 context, expected->message, actual->message);
363 }
364 }
365 }
366 else if (expected->message || actual->message)
367 {
368 dump++;
369 ok_(file, line) (FALSE, "%s: the msg sequence is not complete: expected %04x - actual %04x\n",
370 context, expected->message, actual->message);
371 }
372
373 if(todo && !failcount) /* succeeded yet marked todo */
374 {
375 if (!strcmp(winetest_platform, "wine")) dump++;
377 {
378 ok_(file, line)(TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
379 }
380 }
381
382done:
383 if (dump) dump_sequence( seq, sequence_index, expected_list, context, file, line );
384 flush_sequence(seq, sequence_index);
385}
#define add_message(msg)
Definition: SystemMenu.c:98
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define ok_(x1, x2)
Definition: atltest.h:61
static void dump_sequence(struct msg_sequence **seq, int sequence_index, const struct message *expected, const char *context, const char *file, int line)
Definition: msg.h:105
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL todo
Definition: filedlg.c:313
#define todo_wine
Definition: custom.c:79
static void dump(const void *ptr, unsigned len)
Definition: msc.c:95
const char * winetest_platform
UINT id
Definition: msg.h:54
DWORD stage
Definition: msg.h:56