Alexandre Julliard : comctl32/tests: Flush pending events before progress repaint tests.
Alexandre Julliard
julliard at winehq.org
Tue Nov 6 08:24:46 CST 2007
Module: wine
Branch: master
Commit: a1b02c2cecfd3a0af509c0cc94108048e5cff84f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a1b02c2cecfd3a0af509c0cc94108048e5cff84f
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Nov 6 14:39:41 2007 +0100
comctl32/tests: Flush pending events before progress repaint tests.
---
dlls/comctl32/tests/progress.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/dlls/comctl32/tests/progress.c b/dlls/comctl32/tests/progress.c
index a13d01a..42c1e8d 100644
--- a/dlls/comctl32/tests/progress.c
+++ b/dlls/comctl32/tests/progress.c
@@ -33,6 +33,21 @@ static HWND hProgressParentWnd, hProgressWnd;
static const char progressTestClass[] = "ProgressBarTestClass";
+/* try to make sure pending X events have been processed before continuing */
+static void flush_events(void)
+{
+ MSG msg;
+ int diff = 100;
+ DWORD time = GetTickCount() + diff;
+
+ while (diff > 0)
+ {
+ if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min(10,diff), QS_ALLINPUT ) == WAIT_TIMEOUT) break;
+ while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ diff = time - GetTickCount();
+ }
+}
+
static LRESULT CALLBACK ProgressTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
@@ -113,6 +128,7 @@ static void init(void)
ShowWindow(hProgressParentWnd, SW_SHOWNORMAL);
ok(GetUpdateRect(hProgressParentWnd, NULL, FALSE), "GetUpdateRect: There should be a region that needs to be updated\n");
+ flush_events();
update_window(hProgressParentWnd);
}
More information about the wine-cvs
mailing list