Commit 262b9cc6 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw/tests: Test WM_SYSCOMMAND handling.

parent bd91c559
......@@ -2233,6 +2233,30 @@ static void test_coop_level_mode_set(void)
{WM_SIZE, TRUE, SIZE_RESTORED}, /* DefWindowProc. */
{0, FALSE, 0},
};
static const struct message sc_restore_messages[] =
{
{WM_SYSCOMMAND, TRUE, SC_RESTORE},
{WM_WINDOWPOSCHANGING, FALSE, 0},
{WM_WINDOWPOSCHANGED, FALSE, 0},
{WM_SIZE, TRUE, SIZE_RESTORED},
{0, FALSE, 0},
};
static const struct message sc_minimize_messages[] =
{
{WM_SYSCOMMAND, TRUE, SC_MINIMIZE},
{WM_WINDOWPOSCHANGING, FALSE, 0},
{WM_WINDOWPOSCHANGED, FALSE, 0},
{WM_SIZE, TRUE, SIZE_MINIMIZED},
{0, FALSE, 0},
};
static const struct message sc_maximize_messages[] =
{
{WM_SYSCOMMAND, TRUE, SC_MAXIMIZE},
{WM_WINDOWPOSCHANGING, FALSE, 0},
{WM_WINDOWPOSCHANGED, FALSE, 0},
{WM_SIZE, TRUE, SIZE_MAXIMIZED},
{0, FALSE, 0},
};
static const struct message normal_messages[] =
{
......@@ -2400,6 +2424,24 @@ static void test_coop_level_mode_set(void)
* testbot. Another Restore call would presumably avoid the crash, but it also moots
* the point of the GetSurfaceDesc call. */
expect_messages = sc_minimize_messages;
SendMessageA(window, WM_SYSCOMMAND, SC_MINIMIZE, 0);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
expect_messages = sc_restore_messages;
SendMessageA(window, WM_SYSCOMMAND, SC_RESTORE, 0);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
expect_messages = sc_maximize_messages;
SendMessageA(window, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
......
......@@ -2432,6 +2432,30 @@ static void test_coop_level_mode_set(void)
{WM_SIZE, TRUE, SIZE_RESTORED}, /* DefWindowProc. */
{0, FALSE, 0},
};
static const struct message sc_restore_messages[] =
{
{WM_SYSCOMMAND, TRUE, SC_RESTORE},
{WM_WINDOWPOSCHANGING, FALSE, 0},
{WM_WINDOWPOSCHANGED, FALSE, 0},
{WM_SIZE, TRUE, SIZE_RESTORED},
{0, FALSE, 0},
};
static const struct message sc_minimize_messages[] =
{
{WM_SYSCOMMAND, TRUE, SC_MINIMIZE},
{WM_WINDOWPOSCHANGING, FALSE, 0},
{WM_WINDOWPOSCHANGED, FALSE, 0},
{WM_SIZE, TRUE, SIZE_MINIMIZED},
{0, FALSE, 0},
};
static const struct message sc_maximize_messages[] =
{
{WM_SYSCOMMAND, TRUE, SC_MAXIMIZE},
{WM_WINDOWPOSCHANGING, FALSE, 0},
{WM_WINDOWPOSCHANGED, FALSE, 0},
{WM_SIZE, TRUE, SIZE_MAXIMIZED},
{0, FALSE, 0},
};
static const struct message normal_messages[] =
{
......@@ -2606,6 +2630,24 @@ static void test_coop_level_mode_set(void)
* testbot. Another Restore call would presumably avoid the crash, but it also moots
* the point of the GetSurfaceDesc call. */
expect_messages = sc_minimize_messages;
SendMessageA(window, WM_SYSCOMMAND, SC_MINIMIZE, 0);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
expect_messages = sc_restore_messages;
SendMessageA(window, WM_SYSCOMMAND, SC_RESTORE, 0);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
expect_messages = sc_maximize_messages;
SendMessageA(window, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
......
......@@ -2619,6 +2619,30 @@ static void test_coop_level_mode_set(void)
{WM_SIZE, TRUE, SIZE_RESTORED}, /* DefWindowProc. */
{0, FALSE, 0},
};
static const struct message sc_restore_messages[] =
{
{WM_SYSCOMMAND, TRUE, SC_RESTORE},
{WM_WINDOWPOSCHANGING, FALSE, 0},
{WM_WINDOWPOSCHANGED, FALSE, 0},
{WM_SIZE, TRUE, SIZE_RESTORED},
{0, FALSE, 0},
};
static const struct message sc_minimize_messages[] =
{
{WM_SYSCOMMAND, TRUE, SC_MINIMIZE},
{WM_WINDOWPOSCHANGING, FALSE, 0},
{WM_WINDOWPOSCHANGED, FALSE, 0},
{WM_SIZE, TRUE, SIZE_MINIMIZED},
{0, FALSE, 0},
};
static const struct message sc_maximize_messages[] =
{
{WM_SYSCOMMAND, TRUE, SC_MAXIMIZE},
{WM_WINDOWPOSCHANGING, FALSE, 0},
{WM_WINDOWPOSCHANGED, FALSE, 0},
{WM_SIZE, TRUE, SIZE_MAXIMIZED},
{0, FALSE, 0},
};
static const struct message normal_messages[] =
{
......@@ -2793,6 +2817,24 @@ static void test_coop_level_mode_set(void)
* testbot. Another Restore call would presumably avoid the crash, but it also moots
* the point of the GetSurfaceDesc call. */
expect_messages = sc_minimize_messages;
SendMessageA(window, WM_SYSCOMMAND, SC_MINIMIZE, 0);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
expect_messages = sc_restore_messages;
SendMessageA(window, WM_SYSCOMMAND, SC_RESTORE, 0);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
expect_messages = sc_maximize_messages;
SendMessageA(window, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 0;
......
......@@ -2296,6 +2296,30 @@ static void test_coop_level_mode_set(void)
{WM_SIZE, TRUE, SIZE_RESTORED}, /* DefWindowProc. */
{0, FALSE, 0},
};
static const struct message sc_restore_messages[] =
{
{WM_SYSCOMMAND, TRUE, SC_RESTORE},
{WM_WINDOWPOSCHANGING, FALSE, 0},
{WM_WINDOWPOSCHANGED, FALSE, 0},
{WM_SIZE, TRUE, SIZE_RESTORED},
{0, FALSE, 0},
};
static const struct message sc_minimize_messages[] =
{
{WM_SYSCOMMAND, TRUE, SC_MINIMIZE},
{WM_WINDOWPOSCHANGING, FALSE, 0},
{WM_WINDOWPOSCHANGED, FALSE, 0},
{WM_SIZE, TRUE, SIZE_MINIMIZED},
{0, FALSE, 0},
};
static const struct message sc_maximize_messages[] =
{
{WM_SYSCOMMAND, TRUE, SC_MAXIMIZE},
{WM_WINDOWPOSCHANGING, FALSE, 0},
{WM_WINDOWPOSCHANGED, FALSE, 0},
{WM_SIZE, TRUE, SIZE_MAXIMIZED},
{0, FALSE, 0},
};
static const struct message normal_messages[] =
{
......@@ -2470,6 +2494,24 @@ static void test_coop_level_mode_set(void)
* testbot. Another Restore call would presumably avoid the crash, but it also moots
* the point of the GetSurfaceDesc call. */
expect_messages = sc_minimize_messages;
SendMessageA(window, WM_SYSCOMMAND, SC_MINIMIZE, 0);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
expect_messages = sc_restore_messages;
SendMessageA(window, WM_SYSCOMMAND, SC_RESTORE, 0);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
expect_messages = sc_maximize_messages;
SendMessageA(window, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
expect_messages = exclusive_messages;
screen_size.cx = 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