Commit c3b30e53 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

user32: Add several more MsgWaitForMultipleObjects tests and split them out from…

user32: Add several more MsgWaitForMultipleObjects tests and split them out from the main message tests.
parent 8620d15d
...@@ -3625,6 +3625,49 @@ static const struct message WmSetIcon_2[] = { ...@@ -3625,6 +3625,49 @@ static const struct message WmSetIcon_2[] = {
{ 0 } { 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 */ /* test if we receive the right sequence of messages */
static void test_messages(void) static void test_messages(void)
{ {
...@@ -3632,7 +3675,6 @@ static void test_messages(void) ...@@ -3632,7 +3675,6 @@ static void test_messages(void)
HWND hchild2, hbutton; HWND hchild2, hbutton;
HMENU hmenu; HMENU hmenu;
MSG msg; MSG msg;
DWORD ret;
flush_sequence(); flush_sequence();
...@@ -3921,21 +3963,7 @@ static void test_messages(void) ...@@ -3921,21 +3963,7 @@ static void test_messages(void)
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg ); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
flush_sequence(); flush_sequence();
/* MsgWaitForMultipleObjects test */ test_MsgWaitForMultipleObjects(hparent);
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 */
/* the following test causes an exception in user.exe under win9x */ /* the following test causes an exception in user.exe under win9x */
if (!PostMessageW( hparent, WM_USER, 0, 0 )) if (!PostMessageW( hparent, WM_USER, 0, 0 ))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment