Commit 1af267f6 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw/tests: Try to make test_coop_level_mode_set() more reliable.

It appears that particularly on slower setups, on occasion we don't receive WM_DISPLAYCHANGE messages after a mode change. The theory is that the SendMessageTimeoutW() call in X11DRV_resize_desktop() ends up hitting the is_queue_hung() check in the send_message handler in the server, and the PeekMessage() calls should avoid that.
parent 54029915
......@@ -2074,6 +2074,7 @@ static void test_coop_level_mode_set(void)
HWND window;
HRESULT hr;
ULONG ref;
MSG msg;
static const UINT exclusive_messages[] =
{
......@@ -2130,6 +2131,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2175,6 +2177,7 @@ static void test_coop_level_mode_set(void)
s.left, s.top, s.right, s.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2255,6 +2258,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2305,6 +2309,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2386,6 +2391,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2429,6 +2435,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......
......@@ -2288,6 +2288,7 @@ static void test_coop_level_mode_set(void)
HWND window, window2;
HRESULT hr;
ULONG ref;
MSG msg;
static const UINT exclusive_messages[] =
{
......@@ -2349,6 +2350,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2394,6 +2396,7 @@ static void test_coop_level_mode_set(void)
s.left, s.top, s.right, s.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2474,6 +2477,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2524,6 +2528,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2605,6 +2610,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2648,6 +2654,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2698,6 +2705,7 @@ static void test_coop_level_mode_set(void)
hr = set_display_mode(ddraw, 640, 480);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2764,6 +2772,7 @@ static void test_coop_level_mode_set(void)
hr = set_display_mode(ddraw, 640, 480);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......
......@@ -2446,6 +2446,7 @@ static void test_coop_level_mode_set(void)
HWND window, window2;
HRESULT hr;
ULONG ref;
MSG msg;
static const UINT exclusive_messages[] =
{
......@@ -2507,6 +2508,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2552,6 +2554,7 @@ static void test_coop_level_mode_set(void)
s.left, s.top, s.right, s.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2632,6 +2635,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2675,6 +2679,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2756,6 +2761,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2799,6 +2805,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2849,6 +2856,7 @@ static void test_coop_level_mode_set(void)
hr = set_display_mode(ddraw, 640, 480);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2915,6 +2923,7 @@ static void test_coop_level_mode_set(void)
hr = set_display_mode(ddraw, 640, 480);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......
......@@ -2174,6 +2174,7 @@ static void test_coop_level_mode_set(void)
HWND window, window2;
HRESULT hr;
ULONG ref;
MSG msg;
static const UINT exclusive_messages[] =
{
......@@ -2235,6 +2236,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2280,6 +2282,7 @@ static void test_coop_level_mode_set(void)
s.left, s.top, s.right, s.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2360,6 +2363,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2403,6 +2407,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2484,6 +2489,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2527,6 +2533,7 @@ static void test_coop_level_mode_set(void)
fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
r.left, r.top, r.right, r.bottom);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = normal_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2577,6 +2584,7 @@ static void test_coop_level_mode_set(void)
hr = set_display_mode(ddraw, 640, 480);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......@@ -2643,6 +2651,7 @@ static void test_coop_level_mode_set(void)
hr = set_display_mode(ddraw, 640, 480);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
screen_size.cy = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment