ddraw/tests: Port tests for fullscreen window size reset from d3d9.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2021-12-29 14:01:07 +03:00 committed by Alexandre Julliard
parent 29c9cf6429
commit c52f7de248
4 changed files with 156 additions and 4 deletions

View File

@ -14191,7 +14191,7 @@ static void test_vtbl_protection(void)
static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect, static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect,
LPARAM lparam) LPARAM lparam)
{ {
RECT primary_rect, window_rect; RECT primary_rect, window_rect, new_rect;
IDirectDraw *ddraw; IDirectDraw *ddraw;
HWND window; HWND window;
HRESULT hr; HRESULT hr;
@ -14214,6 +14214,44 @@ static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *mo
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n", ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect)); wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
new_rect = window_rect;
--new_rect.right;
--new_rect.bottom;
ret = MoveWindow(window, new_rect.left, new_rect.top, new_rect.right - new_rect.left,
new_rect.bottom - new_rect.top, TRUE);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ok(EqualRect(&window_rect, &new_rect),
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
/* After processing window events window rectangle gets restored. But only once, the size set
* on the second resize remains. */
flush_events();
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
/* Both Windows and Wine change the size of the window. On Windows it is exactly the new size but in Wine
* it may get adjusted depending on window manager. */
ok(window_rect.right != monitor_rect->right && window_rect.bottom != monitor_rect->bottom,
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
ret = MoveWindow(window, new_rect.left, new_rect.top, new_rect.right - new_rect.left,
new_rect.bottom - new_rect.top, TRUE);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ok(EqualRect(&window_rect, &new_rect),
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
flush_events();
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ok(window_rect.right != monitor_rect->right && window_rect.bottom != monitor_rect->bottom,
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
/* Window activation should restore the window to fit the whole primary monitor */ /* Window activation should restore the window to fit the whole primary monitor */
ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0, ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0,
SWP_NOZORDER | SWP_NOSIZE); SWP_NOZORDER | SWP_NOSIZE);

View File

@ -15115,7 +15115,7 @@ done:
static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect, static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect,
LPARAM lparam) LPARAM lparam)
{ {
RECT primary_rect, window_rect; RECT primary_rect, window_rect, new_rect;
IDirectDraw2 *ddraw; IDirectDraw2 *ddraw;
HWND window; HWND window;
HRESULT hr; HRESULT hr;
@ -15138,6 +15138,44 @@ static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *mo
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n", ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect)); wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
new_rect = window_rect;
--new_rect.right;
--new_rect.bottom;
ret = MoveWindow(window, new_rect.left, new_rect.top, new_rect.right - new_rect.left,
new_rect.bottom - new_rect.top, TRUE);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ok(EqualRect(&window_rect, &new_rect),
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
/* After processing window events window rectangle gets restored. But only once, the size set
* on the second resize remains. */
flush_events();
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
/* Both Windows and Wine change the size of the window. On Windows it is exactly the new size but in Wine
* it may get adjusted depending on window manager. */
ok(window_rect.right != monitor_rect->right && window_rect.bottom != monitor_rect->bottom,
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
ret = MoveWindow(window, new_rect.left, new_rect.top, new_rect.right - new_rect.left,
new_rect.bottom - new_rect.top, TRUE);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ok(EqualRect(&window_rect, &new_rect),
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
flush_events();
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ok(window_rect.right != monitor_rect->right && window_rect.bottom != monitor_rect->bottom,
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
/* Window activation should restore the window to fit the whole primary monitor */ /* Window activation should restore the window to fit the whole primary monitor */
ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0, ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0,
SWP_NOZORDER | SWP_NOSIZE); SWP_NOZORDER | SWP_NOSIZE);

View File

@ -18152,7 +18152,7 @@ done:
static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect, static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect,
LPARAM lparam) LPARAM lparam)
{ {
RECT primary_rect, window_rect; RECT primary_rect, window_rect, new_rect;
IDirectDraw4 *ddraw; IDirectDraw4 *ddraw;
HWND window; HWND window;
HRESULT hr; HRESULT hr;
@ -18175,6 +18175,44 @@ static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *mo
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n", ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect)); wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
new_rect = window_rect;
--new_rect.right;
--new_rect.bottom;
ret = MoveWindow(window, new_rect.left, new_rect.top, new_rect.right - new_rect.left,
new_rect.bottom - new_rect.top, TRUE);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ok(EqualRect(&window_rect, &new_rect),
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
/* After processing window events window rectangle gets restored. But only once, the size set
* on the second resize remains. */
flush_events();
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
/* Both Windows and Wine change the size of the window. On Windows it is exactly the new size but in Wine
* it may get adjusted depending on window manager. */
ok(window_rect.right != monitor_rect->right && window_rect.bottom != monitor_rect->bottom,
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
ret = MoveWindow(window, new_rect.left, new_rect.top, new_rect.right - new_rect.left,
new_rect.bottom - new_rect.top, TRUE);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ok(EqualRect(&window_rect, &new_rect),
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
flush_events();
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ok(window_rect.right != monitor_rect->right && window_rect.bottom != monitor_rect->bottom,
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
/* Window activation should restore the window to fit the whole primary monitor */ /* Window activation should restore the window to fit the whole primary monitor */
ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0, ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0,
SWP_NOZORDER | SWP_NOSIZE); SWP_NOZORDER | SWP_NOSIZE);

View File

@ -18419,7 +18419,7 @@ done:
static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect, static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *monitor_rect,
LPARAM lparam) LPARAM lparam)
{ {
RECT primary_rect, window_rect; RECT primary_rect, window_rect, new_rect;
IDirectDraw7 *ddraw; IDirectDraw7 *ddraw;
HWND window; HWND window;
HRESULT hr; HRESULT hr;
@ -18442,6 +18442,44 @@ static BOOL CALLBACK test_window_position_cb(HMONITOR monitor, HDC hdc, RECT *mo
ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n", ok(EqualRect(&window_rect, &primary_rect), "Expect window rect %s, got %s.\n",
wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect)); wine_dbgstr_rect(&primary_rect), wine_dbgstr_rect(&window_rect));
new_rect = window_rect;
--new_rect.right;
--new_rect.bottom;
ret = MoveWindow(window, new_rect.left, new_rect.top, new_rect.right - new_rect.left,
new_rect.bottom - new_rect.top, TRUE);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ok(EqualRect(&window_rect, &new_rect),
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
/* After processing window events window rectangle gets restored. But only once, the size set
* on the second resize remains. */
flush_events();
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
/* Both Windows and Wine change the size of the window. On Windows it is exactly the new size but in Wine
* it may get adjusted depending on window manager. */
ok(window_rect.right != monitor_rect->right && window_rect.bottom != monitor_rect->bottom,
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
ret = MoveWindow(window, new_rect.left, new_rect.top, new_rect.right - new_rect.left,
new_rect.bottom - new_rect.top, TRUE);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ok(EqualRect(&window_rect, &new_rect),
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
flush_events();
ret = GetWindowRect(window, &window_rect);
ok(ret, "Got unexpected ret %#x, error %#x.\n", ret, GetLastError());
ok(window_rect.right != monitor_rect->right && window_rect.bottom != monitor_rect->bottom,
"Expected window rect %s, got %s.\n",
wine_dbgstr_rect(monitor_rect), wine_dbgstr_rect(&window_rect));
/* Window activation should restore the window to fit the whole primary monitor */ /* Window activation should restore the window to fit the whole primary monitor */
ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0, ret = SetWindowPos(window, 0, monitor_rect->left, monitor_rect->top, 0, 0,
SWP_NOZORDER | SWP_NOSIZE); SWP_NOZORDER | SWP_NOSIZE);