shell32/tests: Wait for window to close in check_window_exists.

This fixes a race condition where the directory is deleted before the
window closes, which causes an error dialog to appear.

Cutting the number of iterations per wait loop in half is necessary so
that doubling the number of wait loops does not result in a timeout when
new tests are added.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alex Henrie 2022-02-07 00:54:29 -07:00 committed by Alexandre Julliard
parent 3cbccd4477
commit 4dcc7a5ae8

View file

@ -164,7 +164,7 @@ static BOOL check_window_exists(const char *name)
else
strcpy(title, name);
for (i = 0; i < 20; i++)
for (i = 0; i < 10; i++)
{
Sleep(100 * i);
if ((window = FindWindowA("ExplorerWClass", title)) ||
@ -175,7 +175,17 @@ static BOOL check_window_exists(const char *name)
}
}
return (window != NULL);
if (!window)
return FALSE;
for (i = 0; i < 10; i++)
{
Sleep(100 * i);
if (!IsWindow(window))
break;
}
return TRUE;
}
static BOOL check_exists(const char *name)