user32: Add several more MsgWaitForMultipleObjects tests and split them out from the main message tests.

This commit is contained in:
Rob Shearman 2007-03-14 15:46:56 +00:00 committed by Alexandre Julliard
parent 8620d15d39
commit c3b30e5351
1 changed files with 44 additions and 16 deletions

View File

@ -3625,6 +3625,49 @@ static const struct message WmSetIcon_2[] = {
{ 0 }
};
static void test_MsgWaitForMultipleObjects(HWND hwnd)
{
DWORD ret;
MSG msg;
ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %x\n", ret);
PostMessageA(hwnd, WM_USER, 0, 0);
ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %x\n", ret);
ok(PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %x\n", ret);
PostMessageA(hwnd, WM_USER, 0, 0);
ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %x\n", ret);
ok(PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE ), "PeekMessage should succeed\n");
ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
/* shows QS_POSTMESSAGE flag is cleared in the PeekMessage call */
ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %x\n", ret);
PostMessageA(hwnd, WM_USER, 0, 0);
/* new incoming message causes it to become signaled again */
ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %x\n", ret);
ok(PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
ok(PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
}
/* test if we receive the right sequence of messages */
static void test_messages(void)
{
@ -3632,7 +3675,6 @@ static void test_messages(void)
HWND hchild2, hbutton;
HMENU hmenu;
MSG msg;
DWORD ret;
flush_sequence();
@ -3921,21 +3963,7 @@ static void test_messages(void)
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
flush_sequence();
/* MsgWaitForMultipleObjects test */
ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %x\n", ret);
PostMessageA(hparent, WM_USER, 0, 0);
ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %x\n", ret);
ok(PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %x\n", ret);
/* end of MsgWaitForMultipleObjects test */
test_MsgWaitForMultipleObjects(hparent);
/* the following test causes an exception in user.exe under win9x */
if (!PostMessageW( hparent, WM_USER, 0, 0 ))