ReactOS 0.4.16-dev-178-g8ba6102
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 389 of file msg.h.

◆ SWP_NOCLIENTMOVE

#define SWP_NOCLIENTMOVE   0x1000

Definition at line 32 of file msg.h.

◆ SWP_NOCLIENTSIZE

#define SWP_NOCLIENTSIZE   0x0800

Definition at line 31 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 34 of file msg.h.

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

Function Documentation

◆ add_message()

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

Definition at line 68 of file msg.h.

70{
71 struct msg_sequence *msg_seq = seq[sequence_index];
72
73 if (!msg_seq->sequence)
74 {
75 msg_seq->size = 10;
76 msg_seq->sequence = heap_alloc(msg_seq->size * sizeof (*msg_seq->sequence));
77 }
78
79 if (msg_seq->count == msg_seq->size)
80 {
81 msg_seq->size *= 2;
82 msg_seq->sequence = heap_realloc(msg_seq->sequence, msg_seq->size * sizeof (*msg_seq->sequence));
83 }
84
85 assert(msg_seq->sequence);
86
87 msg_seq->sequence[msg_seq->count] = *msg;
88 msg_seq->count++;
89}
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:65
int count
Definition: msg.h:63
int size
Definition: msg.h:64
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 107 of file msg.h.

110{
111 struct msg_sequence *msg_seq = seq[sequence_index];
112 const struct message *actual, *sequence;
113 unsigned int count = 0;
114
115 sequence = msg_seq->sequence;
116 actual = sequence;
117
118 trace_(file, line)("Failed sequence %s:\n", context );
119 while (expected->message && actual->message)
120 {
121 trace_(file, line)( " %u: expected: %04x - actual: %04x wp %08lx lp %08lx\n",
122 count, expected->message, actual->message, actual->wParam, actual->lParam );
123
124 if (expected->message == actual->message)
125 {
126 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) &&
127 (expected->flags & optional))
128 {
129 /* don't match messages if their defwinproc status differs */
130 expected++;
131 }
132 else
133 {
134 expected++;
135 actual++;
136 }
137 }
138 else
139 {
140 expected++;
141 actual++;
142 }
143 count++;
144 }
145
146 /* optional trailing messages */
147 while (expected->message && expected->flags & optional)
148 {
149 trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
150 expected++;
151 count++;
152 }
153
154 if (expected->message)
155 {
156 trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
157 return;
158 }
159
160 while (actual->message)
161 {
162 trace_(file, line)( " %u: expected: nothing - actual: %04x wp %08lx lp %08lx\n",
163 count, actual->message, actual->wParam, actual->lParam );
164 actual++;
165 count++;
166 }
167}
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 91 of file msg.h.

92{
93 struct msg_sequence *msg_seq = seg[sequence_index];
94 heap_free(msg_seq->sequence);
95 msg_seq->sequence = NULL;
96 msg_seq->count = msg_seq->size = 0;
97}
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 99 of file msg.h.

100{
101 int i;
102
103 for (i = 0; i < n; i++)
104 flush_sequence(seq, i);
105}
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_images(), 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 
)
static

Definition at line 393 of file msg.h.

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

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 
)
static

Definition at line 169 of file msg.h.

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