msctf/tests: Give time for the messages to arrive.

Francois Gouget fgouget at free.fr
Sun Sep 11 16:16:59 CDT 2011


This fixes some flackiness in Wine due to occasionally delayed focus X messages.
---

This fixes the test's flakiness for me.

 dlls/msctf/tests/inputprocessor.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c
index 3262c6b..8f409c3 100644
--- a/dlls/msctf/tests/inputprocessor.c
+++ b/dlls/msctf/tests/inputprocessor.c
@@ -1993,9 +1993,20 @@ static void test_Compartments(void)
 static void processPendingMessages(void)
 {
     MSG msg;
-    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
-        TranslateMessage(&msg);
-        DispatchMessage(&msg);
+    int diff = 200;
+    int min_timeout = 100;
+    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();
     }
 }
 
-- 
1.7.5.4




More information about the wine-patches mailing list