[PATCH 1/6] user32/tests: Wait more for ShowWindow(SW_SHOWMINIMIZED):overlapped test.

Rémi Bernon rbernon at codeweavers.com
Tue Nov 5 13:44:47 CST 2019

The first messages in the sequence are generated right away by the
SW_MINIMIZE request, but the last ones are only a result of the native
driver implementation of the window minimization and may take some time
to be received, or may not be received at all.

The test spuriously succeeds in the case where the driver messages are
not received and only the optional messages at the end of the sequence
are missing.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>

    The test actually passes on all the testbot runs I could start. It
    fails locally though -testing with fvwm in Xephyr- from time to time
    because the WM sometimes reacts fast enough.
    I'm not sure if that's a specificity of the testbot WM configuration,
    it looks like minimizing windows there does not trigger anymore
    messages not matter how long we wait.

 dlls/user32/tests/msg.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 477661ab623..d0de1c6d8bd 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -5101,6 +5101,7 @@ static void test_messages(void)
     LRESULT res;
     POINT pos;
     BOOL ret;
+    DWORD minimize_timeout;
@@ -5163,7 +5164,13 @@ static void test_messages(void)
     ShowWindow(hwnd, SW_MINIMIZE);
-    ok_sequence(WmShowMinOverlappedSeq, "ShowWindow(SW_SHOWMINIMIZED):overlapped", TRUE);
+    /* Minimizing may take some time to complete or may not be supported
+     * at all and this spuriously failed because everything after the 16th
+     * message of the sequence is optional. */
+    minimize_timeout = GetTickCount() + 500;
+    while (sequence_cnt <= 16 && GetTickCount() < minimize_timeout) flush_events();
+    ok_sequence(WmShowMinOverlappedSeq, "ShowWindow(SW_SHOWMINIMIZED):overlapped", sequence_cnt > 16);
     if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_MINIMIZE)

More information about the wine-devel mailing list