mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
cc2b468b62
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
113 lines
3 KiB
C
113 lines
3 KiB
C
/* Message Sequence Testing Code
|
|
*
|
|
* Copyright (C) 2007 James Hawkins
|
|
* Copyright (C) 2007 Lei Zhang
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
*/
|
|
|
|
#include <assert.h>
|
|
#include <windows.h>
|
|
#include "wine/test.h"
|
|
|
|
/* undocumented SWP flags - from SDK 3.1 */
|
|
#define SWP_NOCLIENTSIZE 0x0800
|
|
#define SWP_NOCLIENTMOVE 0x1000
|
|
|
|
typedef enum
|
|
{
|
|
sent = 0x1,
|
|
posted = 0x2,
|
|
parent = 0x4,
|
|
wparam = 0x8,
|
|
lparam = 0x10,
|
|
defwinproc = 0x20,
|
|
beginpaint = 0x40,
|
|
optional = 0x80,
|
|
hook = 0x100,
|
|
winevent_hook =0x200,
|
|
id = 0x400
|
|
} msg_flags_t;
|
|
|
|
struct message
|
|
{
|
|
UINT message; /* the WM_* code */
|
|
msg_flags_t flags; /* message props */
|
|
WPARAM wParam; /* expected value of wParam */
|
|
LPARAM lParam; /* expected value of lParam */
|
|
UINT id; /* extra message data: id of the window,
|
|
notify code etc. */
|
|
};
|
|
|
|
struct msg_sequence
|
|
{
|
|
int count;
|
|
int size;
|
|
struct message *sequence;
|
|
};
|
|
|
|
static void add_message(struct msg_sequence **seq, int sequence_index,
|
|
const struct message *msg)
|
|
{
|
|
struct msg_sequence *msg_seq = seq[sequence_index];
|
|
|
|
if (!msg_seq->sequence)
|
|
{
|
|
msg_seq->size = 10;
|
|
msg_seq->sequence = malloc(msg_seq->size * sizeof (struct message));
|
|
}
|
|
|
|
if (msg_seq->count == msg_seq->size)
|
|
{
|
|
msg_seq->size *= 2;
|
|
msg_seq->sequence = realloc(msg_seq->sequence, msg_seq->size * sizeof (struct message));
|
|
}
|
|
|
|
assert(msg_seq->sequence);
|
|
|
|
msg_seq->sequence[msg_seq->count].message = msg->message;
|
|
msg_seq->sequence[msg_seq->count].flags = msg->flags;
|
|
msg_seq->sequence[msg_seq->count].wParam = msg->wParam;
|
|
msg_seq->sequence[msg_seq->count].lParam = msg->lParam;
|
|
msg_seq->sequence[msg_seq->count].id = msg->id;
|
|
|
|
msg_seq->count++;
|
|
}
|
|
|
|
static void flush_sequence(struct msg_sequence **seg, int sequence_index)
|
|
{
|
|
struct msg_sequence *msg_seq = seg[sequence_index];
|
|
free(msg_seq->sequence);
|
|
msg_seq->sequence = NULL;
|
|
msg_seq->count = msg_seq->size = 0;
|
|
}
|
|
|
|
static void flush_sequences(struct msg_sequence **seq, int n)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < n; i++)
|
|
flush_sequence(seq, i);
|
|
}
|
|
|
|
/* ok_sequence is stripped out as it is not currently used. */
|
|
|
|
static void init_msg_sequences(struct msg_sequence **seq, int n)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < n; i++)
|
|
seq[i] = calloc(1, sizeof(**seq));
|
|
}
|