ddraw/tests: Test WM_SYSCOMMAND handling.
This commit is contained in:
parent
bd91c559ae
commit
262b9cc62e
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue