ddraw/tests: Test messages on window reactivation.

This commit is contained in:
Stefan Dösinger 2014-11-19 20:13:51 +01:00 committed by Alexandre Julliard
parent 09a91231a6
commit 0edb13a20f
4 changed files with 84 additions and 0 deletions

View File

@ -2219,6 +2219,20 @@ static void test_coop_level_mode_set(void)
{WM_ACTIVATEAPP, TRUE, FALSE},
{0, FALSE, 0},
};
static const struct message exclusive_focus_restore_messages[] =
{
{WM_WINDOWPOSCHANGING, FALSE, 0}, /* From the ShowWindow(SW_RESTORE). */
{WM_WINDOWPOSCHANGING, FALSE, 0}, /* Generated by ddraw, matches d3d9 behavior. */
{WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching previous message. */
{WM_SIZE, FALSE, 0}, /* DefWindowProc. */
{WM_DISPLAYCHANGE, FALSE, 0}, /* Ddraw restores mode. */
/* Native redundantly sets the window size here. */
{WM_ACTIVATEAPP, TRUE, TRUE}, /* End of ddraw's hooks. */
{WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching the one from ShowWindow. */
{WM_MOVE, FALSE, 0}, /* DefWindowProc. */
{WM_SIZE, TRUE, SIZE_RESTORED}, /* DefWindowProc. */
{0, FALSE, 0},
};
static const struct message normal_messages[] =
{
@ -2365,7 +2379,14 @@ static void test_coop_level_mode_set(void)
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n",
devmode.dmPelsWidth, devmode.dmPelsHeight);
expect_messages = exclusive_focus_restore_messages;
ShowWindow(window, SW_RESTORE);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
GetWindowRect(window, &r);
ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom,
r.left, r.top, r.right, r.bottom);
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
ok(devmode.dmPelsWidth == param.ddraw_width

View File

@ -2418,6 +2418,20 @@ static void test_coop_level_mode_set(void)
{WM_ACTIVATEAPP, TRUE, FALSE},
{0, FALSE, 0},
};
static const struct message exclusive_focus_restore_messages[] =
{
{WM_WINDOWPOSCHANGING, FALSE, 0}, /* From the ShowWindow(SW_RESTORE). */
{WM_WINDOWPOSCHANGING, FALSE, 0}, /* Generated by ddraw, matches d3d9 behavior. */
{WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching previous message. */
{WM_SIZE, FALSE, 0}, /* DefWindowProc. */
{WM_DISPLAYCHANGE, FALSE, 0}, /* Ddraw restores mode. */
/* Native redundantly sets the window size here. */
{WM_ACTIVATEAPP, TRUE, TRUE}, /* End of ddraw's hooks. */
{WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching the one from ShowWindow. */
{WM_MOVE, FALSE, 0}, /* DefWindowProc. */
{WM_SIZE, TRUE, SIZE_RESTORED}, /* DefWindowProc. */
{0, FALSE, 0},
};
static const struct message normal_messages[] =
{
@ -2571,7 +2585,14 @@ static void test_coop_level_mode_set(void)
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n",
devmode.dmPelsWidth, devmode.dmPelsHeight);
expect_messages = exclusive_focus_restore_messages;
ShowWindow(window, SW_RESTORE);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
GetWindowRect(window, &r);
ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom,
r.left, r.top, r.right, r.bottom);
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
ok(devmode.dmPelsWidth == param.ddraw_width

View File

@ -2605,6 +2605,20 @@ static void test_coop_level_mode_set(void)
{WM_ACTIVATEAPP, TRUE, FALSE},
{0, FALSE, 0},
};
static const struct message exclusive_focus_restore_messages[] =
{
{WM_WINDOWPOSCHANGING, FALSE, 0}, /* From the ShowWindow(SW_RESTORE). */
{WM_WINDOWPOSCHANGING, FALSE, 0}, /* Generated by ddraw, matches d3d9 behavior. */
{WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching previous message. */
{WM_SIZE, FALSE, 0}, /* DefWindowProc. */
{WM_DISPLAYCHANGE, FALSE, 0}, /* Ddraw restores mode. */
/* Native redundantly sets the window size here. */
{WM_ACTIVATEAPP, TRUE, TRUE}, /* End of ddraw's hooks. */
{WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching the one from ShowWindow. */
{WM_MOVE, FALSE, 0}, /* DefWindowProc. */
{WM_SIZE, TRUE, SIZE_RESTORED}, /* DefWindowProc. */
{0, FALSE, 0},
};
static const struct message normal_messages[] =
{
@ -2758,7 +2772,14 @@ static void test_coop_level_mode_set(void)
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n",
devmode.dmPelsWidth, devmode.dmPelsHeight);
expect_messages = exclusive_focus_restore_messages;
ShowWindow(window, SW_RESTORE);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
GetWindowRect(window, &r);
ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom,
r.left, r.top, r.right, r.bottom);
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
ok(devmode.dmPelsWidth == param.ddraw_width

View File

@ -2282,6 +2282,20 @@ static void test_coop_level_mode_set(void)
{WM_ACTIVATEAPP, TRUE, FALSE},
{0, FALSE, 0},
};
static const struct message exclusive_focus_restore_messages[] =
{
{WM_WINDOWPOSCHANGING, FALSE, 0}, /* From the ShowWindow(SW_RESTORE). */
{WM_WINDOWPOSCHANGING, FALSE, 0}, /* Generated by ddraw, matches d3d9 behavior. */
{WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching previous message. */
{WM_SIZE, FALSE, 0}, /* DefWindowProc. */
{WM_DISPLAYCHANGE, FALSE, 0}, /* Ddraw restores mode. */
/* Native redundantly sets the window size here. */
{WM_ACTIVATEAPP, TRUE, TRUE}, /* End of ddraw's hooks. */
{WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching the one from ShowWindow. */
{WM_MOVE, FALSE, 0}, /* DefWindowProc. */
{WM_SIZE, TRUE, SIZE_RESTORED}, /* DefWindowProc. */
{0, FALSE, 0},
};
static const struct message normal_messages[] =
{
@ -2435,7 +2449,14 @@ static void test_coop_level_mode_set(void)
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n",
devmode.dmPelsWidth, devmode.dmPelsHeight);
expect_messages = exclusive_focus_restore_messages;
ShowWindow(window, SW_RESTORE);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
GetWindowRect(window, &r);
ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom,
r.left, r.top, r.right, r.bottom);
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
ok(devmode.dmPelsWidth == param.ddraw_width