Vitaliy Margolen : user32/tests: Use empty_message_queue with timeouts.

Alexandre Julliard julliard at winehq.org
Tue Sep 30 11:16:25 CDT 2008


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

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Thu Sep 25 08:26:09 2008 -0600

user32/tests: Use empty_message_queue with timeouts.

---

 dlls/user32/tests/input.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index aac6d61..c5a15cd 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -360,11 +360,24 @@ static void test_Input_whitebox(void)
     DestroyWindow(hWndTest);
 }
 
-static void empty_message_queue(void) {
+/* try to make sure pending X events have been processed before continuing */
+static void empty_message_queue(void)
+{
     MSG msg;
-    while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
-        TranslateMessage(&msg);
-        DispatchMessage(&msg);
+    int diff = 200;
+    int min_timeout = 50;
+    DWORD time = GetTickCount() + diff;
+
+    while (diff > 0)
+    {
+        if (MsgWaitForMultipleObjects(0, NULL, FALSE, min_timeout, QS_ALLINPUT) == WAIT_TIMEOUT) break;
+        while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+        {
+            TranslateMessage(&msg);
+            DispatchMessage(&msg);
+        }
+        diff = time - GetTickCount();
+        min_timeout = 20;
     }
 }
 




More information about the wine-cvs mailing list