ReactOS 0.4.15-dev-5672-gf73ac17
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 , 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 ok_sequence_ (struct msg_sequence **seq, int sequence_index, const struct message *expected, 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 285 of file msg.h.

◆ SWP_NOCLIENTMOVE

#define SWP_NOCLIENTMOVE   0x1000

Definition at line 31 of file msg.h.

◆ SWP_NOCLIENTSIZE

#define SWP_NOCLIENTSIZE   0x0800

Definition at line 30 of file msg.h.

Enumeration Type Documentation

◆ msg_flags_t

Enumerator
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 33 of file msg.h.

34{
35 sent = 0x1,
36 posted = 0x2,
37 parent = 0x4,
38 wparam = 0x8,
39 lparam = 0x10,
40 defwinproc = 0x20,
41 beginpaint = 0x40,
42 optional = 0x80,
43 hook = 0x100,
44 winevent_hook =0x200,
45 id = 0x400
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
@ 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 65 of file msg.h.

67{
68 struct msg_sequence *msg_seq = seq[sequence_index];
69
70 if (!msg_seq->sequence)
71 {
72 msg_seq->size = 10;
73 msg_seq->sequence = heap_alloc(msg_seq->size * sizeof (struct message));
74 }
75
76 if (msg_seq->count == msg_seq->size)
77 {
78 msg_seq->size *= 2;
79 msg_seq->sequence = heap_realloc(msg_seq->sequence, msg_seq->size * sizeof (struct message));
80 }
81
82 assert(msg_seq->sequence);
83
84 msg_seq->sequence[msg_seq->count].message = msg->message;
85 msg_seq->sequence[msg_seq->count].flags = msg->flags;
86 msg_seq->sequence[msg_seq->count].wParam = msg->wParam;
87 msg_seq->sequence[msg_seq->count].lParam = msg->lParam;
88 msg_seq->sequence[msg_seq->count].id = msg->id;
89
90 msg_seq->count++;
91}
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
#define msg(x)
Definition: auth_time.c:54
#define assert(x)
Definition: debug.h:53
Definition: tftpd.h:60
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

◆ flush_sequence()

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

Definition at line 93 of file msg.h.

94{
95 struct msg_sequence *msg_seq = seg[sequence_index];
96 heap_free(msg_seq->sequence);
97 msg_seq->sequence = NULL;
98 msg_seq->count = msg_seq->size = 0;
99}
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define NULL
Definition: types.h:112

◆ flush_sequences()

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

Definition at line 101 of file msg.h.

102{
103 int i;
104
105 for (i = 0; i < n; i++)
106 flush_sequence(seq, i);
107}
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
static void flush_sequence(void)
Definition: subclass.c:136

◆ init_msg_sequences()

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

Definition at line 289 of file msg.h.

290{
291 int i;
292
293 for (i = 0; i < n; i++)
294 seq[i] = heap_alloc_zero(sizeof(struct msg_sequence));
295}

◆ ok_sequence_()

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

Definition at line 109 of file msg.h.

112{
113 struct msg_sequence *msg_seq = seq[sequence_index];
114 static const struct message end_of_sequence = {0, 0, 0, 0};
115 const struct message *actual, *sequence;
116 int failcount = 0;
117
118 add_message(seq, sequence_index, &end_of_sequence);
119
120 sequence = msg_seq->sequence;
121 actual = sequence;
122
123 while (expected->message && actual->message)
124 {
125 trace_( file, line)("expected %04x - actual %04x\n", expected->message, actual->message);
126
127 if (expected->message == actual->message)
128 {
129 if (expected->flags & wparam)
130 {
131 if (expected->wParam != actual->wParam && todo)
132 {
134 {
135 failcount++;
136 ok_(file, line) (FALSE,
137 "%s: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
138 context, expected->message, expected->wParam, actual->wParam);
139 }
140 }
141 else
142 {
143 ok_(file, line) (expected->wParam == actual->wParam,
144 "%s: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
145 context, expected->message, expected->wParam, actual->wParam);
146 }
147 }
148
149 if (expected->flags & lparam)
150 {
151 if (expected->lParam != actual->lParam && todo)
152 {
154 {
155 failcount++;
156 ok_(file, line) (FALSE,
157 "%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
158 context, expected->message, expected->lParam, actual->lParam);
159 }
160 }
161 else
162 {
163 ok_(file, line) (expected->lParam == actual->lParam,
164 "%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
165 context, expected->message, expected->lParam, actual->lParam);
166 }
167 }
168
169 if (expected->flags & id)
170 {
171 if (expected->id != actual->id && expected->flags & optional)
172 {
173 expected++;
174 continue;
175 }
176 if (expected->id != actual->id && todo)
177 {
179 {
180 failcount++;
181 ok_(file, line) (FALSE,
182 "%s: in msg 0x%04x expecting id 0x%x got 0x%x\n",
183 context, expected->message, expected->id, actual->id);
184 }
185 }
186 else
187 {
188 ok_(file, line) (expected->id == actual->id,
189 "%s: in msg 0x%04x expecting id 0x%x got 0x%x\n",
190 context, expected->message, expected->id, actual->id);
191 }
192 }
193
194 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) && todo)
195 {
197 {
198 failcount++;
199 ok_(file, line) (FALSE,
200 "%s: the msg 0x%04x should %shave been sent by DefWindowProc\n",
201 context, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
202 }
203 }
204 else
205 {
206 ok_(file, line) ((expected->flags & defwinproc) == (actual->flags & defwinproc),
207 "%s: the msg 0x%04x should %shave been sent by DefWindowProc\n",
208 context, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
209 }
210
211 ok_(file, line) ((expected->flags & beginpaint) == (actual->flags & beginpaint),
212 "%s: the msg 0x%04x should %shave been sent by BeginPaint\n",
213 context, expected->message, (expected->flags & beginpaint) ? "" : "NOT ");
214 ok_(file, line) ((expected->flags & (sent|posted)) == (actual->flags & (sent|posted)),
215 "%s: the msg 0x%04x should have been %s\n",
216 context, expected->message, (expected->flags & posted) ? "posted" : "sent");
217 ok_(file, line) ((expected->flags & parent) == (actual->flags & parent),
218 "%s: the msg 0x%04x was expected in %s\n",
219 context, expected->message, (expected->flags & parent) ? "parent" : "child");
220 ok_(file, line) ((expected->flags & hook) == (actual->flags & hook),
221 "%s: the msg 0x%04x should have been sent by a hook\n",
222 context, expected->message);
223 ok_(file, line) ((expected->flags & winevent_hook) == (actual->flags & winevent_hook),
224 "%s: the msg 0x%04x should have been sent by a winevent hook\n",
225 context, expected->message);
226 expected++;
227 actual++;
228 }
229 else if (expected->flags & optional)
230 expected++;
231 else if (todo)
232 {
233 failcount++;
235 {
236 ok_(file, line) (FALSE, "%s: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
237 context, expected->message, actual->message);
238 }
239
240 flush_sequence(seq, sequence_index);
241 return;
242 }
243 else
244 {
245 ok_(file, line) (FALSE, "%s: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
246 context, expected->message, actual->message);
247 expected++;
248 actual++;
249 }
250 }
251
252 /* skip all optional trailing messages */
253 while (expected->message && ((expected->flags & optional)))
254 expected++;
255
256 if (todo)
257 {
259 {
260 if (expected->message || actual->message)
261 {
262 failcount++;
263 ok_(file, line) (FALSE, "%s: the msg sequence is not complete: expected %04x - actual %04x\n",
264 context, expected->message, actual->message);
265 }
266 }
267 }
268 else if (expected->message || actual->message)
269 {
270 ok_(file, line) (FALSE, "%s: the msg sequence is not complete: expected %04x - actual %04x\n",
271 context, expected->message, actual->message);
272 }
273
274 if(todo && !failcount) /* succeeded yet marked todo */
275 {
277 {
278 ok_(file, line)(TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
279 }
280 }
281
282 flush_sequence(seq, sequence_index);
283}
#define ok_(x1, x2)
Definition: atltest.h:61
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define trace_(file, line,...)
Definition: kmt_test.h:223
BOOL todo
Definition: filedlg.c:313
BOOL expected
Definition: store.c:2063
#define todo_wine
Definition: custom.c:79
#define add_message(msg)
Definition: msg.c:2109
Definition: http.c:7252
Definition: fci.c:127
Definition: parser.c:49
UINT id
Definition: msg.h:54
UINT message
Definition: msg.h:50
msg_flags_t flags
Definition: msg.h:51
static struct message * sequence
Definition: subclass.c:46