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

Alexandre Julliard julliard at wine.codeweavers.com
Thu Mar 15 08:19:17 CDT 2007


Module: wine
Branch: master
Commit: c3b30e535102ddfffa8f97a8bed8a94176f95cd0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c3b30e535102ddfffa8f97a8bed8a94176f95cd0

Author: Rob Shearman <rob at codeweavers.com>
Date:   Wed Mar 14 15:46:56 2007 +0000

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

---

 dlls/user32/tests/msg.c |   60 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index a380883..50b00c8 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -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 ))




More information about the wine-cvs mailing list