mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 12:06:32 +00:00
d3d9/tests: Make test_reset more resilient against DPI scaling.
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7f8e30bd1a
commit
975a686aa0
2 changed files with 51 additions and 25 deletions
|
@ -934,7 +934,7 @@ static void test_reset(void)
|
|||
DWORD value;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
RECT rect;
|
||||
RECT rect, client_rect;
|
||||
LONG ret;
|
||||
struct
|
||||
{
|
||||
|
@ -1194,6 +1194,9 @@ static void test_reset(void)
|
|||
ok(SetWindowPos(window, NULL, 0, 0, rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_NOMOVE | SWP_NOZORDER), "Failed to set window position.\n");
|
||||
|
||||
/* Windows 10 gives us a different size than we requested with some DPI scaling settings (e.g. 172%). */
|
||||
ok(GetClientRect(window, &client_rect), "Failed to get client rect.\n");
|
||||
|
||||
memset(&d3dpp, 0, sizeof(d3dpp));
|
||||
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
d3dpp.Windowed = TRUE;
|
||||
|
@ -1205,8 +1208,10 @@ static void test_reset(void)
|
|||
hr = IDirect3DDevice9Ex_TestCooperativeLevel(device);
|
||||
ok(hr == D3D_OK, "Got unexpected cooperative level %#x.\n", hr);
|
||||
|
||||
ok(d3dpp.BackBufferWidth == 200, "Got unexpected BackBufferWidth %u.\n", d3dpp.BackBufferWidth);
|
||||
ok(d3dpp.BackBufferHeight == 150, "Got unexpected BackBufferHeight %u.\n", d3dpp.BackBufferHeight);
|
||||
ok(d3dpp.BackBufferWidth == client_rect.right,
|
||||
"Got unexpected BackBufferWidth %u, expected %d.\n", d3dpp.BackBufferWidth, client_rect.right);
|
||||
ok(d3dpp.BackBufferHeight == client_rect.bottom,
|
||||
"Got unexpected BackBufferHeight %u, expected %d.\n", d3dpp.BackBufferHeight, client_rect.bottom);
|
||||
ok(d3dpp.BackBufferFormat == d3ddm.Format, "Got unexpected BackBufferFormat %#x, expected %#x.\n",
|
||||
d3dpp.BackBufferFormat, d3ddm.Format);
|
||||
ok(d3dpp.BackBufferCount == 1, "Got unexpected BackBufferCount %u.\n", d3dpp.BackBufferCount);
|
||||
|
@ -1224,15 +1229,16 @@ static void test_reset(void)
|
|||
|
||||
hr = IDirect3DDevice9Ex_GetScissorRect(device, &rect);
|
||||
ok(SUCCEEDED(hr), "Failed to get scissor rect, hr %#x.\n", hr);
|
||||
ok(rect.left == 0 && rect.top == 0 && rect.right == 200 && rect.bottom == 150,
|
||||
"Got unexpected scissor rect %s.\n", wine_dbgstr_rect(&rect));
|
||||
ok(EqualRect(&rect, &client_rect), "Got unexpected scissor rect %s.\n", wine_dbgstr_rect(&rect));
|
||||
|
||||
hr = IDirect3DDevice9Ex_GetViewport(device, &vp);
|
||||
ok(SUCCEEDED(hr), "Failed to get viewport, hr %#x.\n", hr);
|
||||
ok(vp.X == 0, "Got unexpected vp.X %u.\n", vp.X);
|
||||
ok(vp.Y == 0, "Got unexpected vp.Y %u.\n", vp.Y);
|
||||
ok(vp.Width == 200, "Got unexpected vp.Width %u.\n", vp.Width);
|
||||
ok(vp.Height == 150, "Got unexpected vp.Height %u.\n", vp.Height);
|
||||
ok(vp.Width == client_rect.right, "Got unexpected vp.Width %u, expected %d.\n",
|
||||
vp.Width, client_rect.right);
|
||||
ok(vp.Height == client_rect.bottom, "Got unexpected vp.Height %u, expected %d.\n",
|
||||
vp.Height, client_rect.bottom);
|
||||
ok(vp.MinZ == 2.0f, "Got unexpected vp.MinZ %.8e.\n", vp.MinZ);
|
||||
ok(vp.MaxZ == 3.0f, "Got unexpected vp.MaxZ %.8e.\n", vp.MaxZ);
|
||||
|
||||
|
@ -1240,8 +1246,10 @@ static void test_reset(void)
|
|||
ok(SUCCEEDED(hr), "Failed to get swapchain, hr %#x.\n", hr);
|
||||
hr = IDirect3DSwapChain9_GetPresentParameters(swapchain, &d3dpp);
|
||||
ok(SUCCEEDED(hr), "Failed to get present parameters, hr %#x.\n", hr);
|
||||
ok(d3dpp.BackBufferWidth == 200, "Got unexpected backbuffer width %u.\n", d3dpp.BackBufferWidth);
|
||||
ok(d3dpp.BackBufferHeight == 150, "Got unexpected backbuffer height %u.\n", d3dpp.BackBufferHeight);
|
||||
ok(d3dpp.BackBufferWidth == client_rect.right, "Got unexpected backbuffer width %u, expected %d.\n",
|
||||
d3dpp.BackBufferWidth, client_rect.right);
|
||||
ok(d3dpp.BackBufferHeight == client_rect.bottom, "Got unexpected backbuffer height %u, expected %d.\n",
|
||||
d3dpp.BackBufferHeight, client_rect.bottom);
|
||||
ok(d3dpp.BackBufferFormat == d3ddm.Format, "Got unexpected BackBufferFormat %#x, expected %#x.\n",
|
||||
d3dpp.BackBufferFormat, d3ddm.Format);
|
||||
ok(d3dpp.BackBufferCount == 1, "Got unexpected BackBufferCount %u.\n", d3dpp.BackBufferCount);
|
||||
|
@ -1403,7 +1411,7 @@ static void test_reset_ex(void)
|
|||
DWORD value;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
RECT rect;
|
||||
RECT rect, client_rect;
|
||||
LONG ret;
|
||||
|
||||
window = create_window();
|
||||
|
@ -1728,6 +1736,9 @@ static void test_reset_ex(void)
|
|||
ok(SetWindowPos(window, NULL, 0, 0, rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_NOMOVE | SWP_NOZORDER), "Failed to set window position.\n");
|
||||
|
||||
/* Windows 10 gives us a different size than we requested with some DPI scaling settings (e.g. 172%). */
|
||||
ok(GetClientRect(window, &client_rect), "Failed to get client rect.\n");
|
||||
|
||||
memset(&d3dpp, 0, sizeof(d3dpp));
|
||||
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
d3dpp.Windowed = TRUE;
|
||||
|
@ -1739,8 +1750,10 @@ static void test_reset_ex(void)
|
|||
hr = IDirect3DDevice9Ex_TestCooperativeLevel(device);
|
||||
ok(hr == D3D_OK, "Got unexpected cooperative level %#x.\n", hr);
|
||||
|
||||
ok(d3dpp.BackBufferWidth == 200, "Got unexpected BackBufferWidth %u.\n", d3dpp.BackBufferWidth);
|
||||
ok(d3dpp.BackBufferHeight == 150, "Got unexpected BackBufferHeight %u.\n", d3dpp.BackBufferHeight);
|
||||
ok(d3dpp.BackBufferWidth == client_rect.right,
|
||||
"Got unexpected BackBufferWidth %u, expected %d.\n", d3dpp.BackBufferWidth, client_rect.right);
|
||||
ok(d3dpp.BackBufferHeight == client_rect.bottom,
|
||||
"Got unexpected BackBufferHeight %u, expected %d.\n", d3dpp.BackBufferHeight, client_rect.bottom);
|
||||
ok(d3dpp.BackBufferFormat == mode.Format, "Got unexpected BackBufferFormat %#x, expected %#x.\n",
|
||||
d3dpp.BackBufferFormat, mode.Format);
|
||||
ok(d3dpp.BackBufferCount == 1, "Got unexpected BackBufferCount %u.\n", d3dpp.BackBufferCount);
|
||||
|
@ -1758,15 +1771,17 @@ static void test_reset_ex(void)
|
|||
|
||||
hr = IDirect3DDevice9Ex_GetScissorRect(device, &rect);
|
||||
ok(SUCCEEDED(hr), "Failed to get scissor rect, hr %#x.\n", hr);
|
||||
ok(rect.left == 0 && rect.top == 0 && rect.right == 200 && rect.bottom == 150,
|
||||
"Got unexpected scissor rect %s.\n", wine_dbgstr_rect(&rect));
|
||||
ok(EqualRect(&rect, &client_rect), "Got unexpected scissor rect %s, expected %s.\n",
|
||||
wine_dbgstr_rect(&rect), wine_dbgstr_rect(&client_rect));
|
||||
|
||||
hr = IDirect3DDevice9Ex_GetViewport(device, &vp);
|
||||
ok(SUCCEEDED(hr), "Failed to get viewport, hr %#x.\n", hr);
|
||||
ok(vp.X == 0, "Got unexpected vp.X %u.\n", vp.X);
|
||||
ok(vp.Y == 0, "Got unexpected vp.Y %u.\n", vp.Y);
|
||||
ok(vp.Width == 200, "Got unexpected vp.Width %u.\n", vp.Width);
|
||||
ok(vp.Height == 150, "Got unexpected vp.Height %u.\n", vp.Height);
|
||||
ok(vp.Width == client_rect.right, "Got unexpected vp.Width %u, expected %d.\n",
|
||||
vp.Width, client_rect.right);
|
||||
ok(vp.Height == client_rect.bottom, "Got unexpected vp.Height %u, expected %d.\n",
|
||||
vp.Height, client_rect.bottom);
|
||||
ok(vp.MinZ == 2.0f, "Got unexpected vp.MinZ %.8e.\n", vp.MinZ);
|
||||
ok(vp.MaxZ == 3.0f, "Got unexpected vp.MaxZ %.8e.\n", vp.MaxZ);
|
||||
|
||||
|
@ -1774,8 +1789,10 @@ static void test_reset_ex(void)
|
|||
ok(SUCCEEDED(hr), "Failed to get swapchain, hr %#x.\n", hr);
|
||||
hr = IDirect3DSwapChain9_GetPresentParameters(swapchain, &d3dpp);
|
||||
ok(SUCCEEDED(hr), "Failed to get present parameters, hr %#x.\n", hr);
|
||||
ok(d3dpp.BackBufferWidth == 200, "Got unexpected backbuffer width %u.\n", d3dpp.BackBufferWidth);
|
||||
ok(d3dpp.BackBufferHeight == 150, "Got unexpected backbuffer height %u.\n", d3dpp.BackBufferHeight);
|
||||
ok(d3dpp.BackBufferWidth == client_rect.right,
|
||||
"Got unexpected backbuffer width %u, expected %d.\n", d3dpp.BackBufferWidth, client_rect.right);
|
||||
ok(d3dpp.BackBufferHeight == client_rect.bottom,
|
||||
"Got unexpected backbuffer height %u, expected %d.\n", d3dpp.BackBufferHeight, client_rect.bottom);
|
||||
ok(d3dpp.BackBufferFormat == mode.Format, "Got unexpected BackBufferFormat %#x, expected %#x.\n",
|
||||
d3dpp.BackBufferFormat, mode.Format);
|
||||
ok(d3dpp.BackBufferCount == 1, "Got unexpected BackBufferCount %u.\n", d3dpp.BackBufferCount);
|
||||
|
|
|
@ -1817,7 +1817,7 @@ cleanup:
|
|||
static void test_reset(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
RECT winrect;
|
||||
RECT winrect, client_rect;
|
||||
D3DPRESENT_PARAMETERS d3dpp;
|
||||
D3DDISPLAYMODE d3ddm, d3ddm2;
|
||||
D3DVIEWPORT9 vp;
|
||||
|
@ -2072,6 +2072,9 @@ static void test_reset(void)
|
|||
SWP_NOMOVE|SWP_NOZORDER),
|
||||
"SetWindowPos failed\n");
|
||||
|
||||
/* Windows 10 gives us a different size than we requested with some DPI scaling settings (e.g. 172%). */
|
||||
GetClientRect(hwnd, &client_rect);
|
||||
|
||||
ZeroMemory( &d3dpp, sizeof(d3dpp) );
|
||||
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
d3dpp.Windowed = TRUE;
|
||||
|
@ -2083,8 +2086,10 @@ static void test_reset(void)
|
|||
hr = IDirect3DDevice9_TestCooperativeLevel(device1);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_TestCooperativeLevel after a successful reset returned %#x\n", hr);
|
||||
|
||||
ok(d3dpp.BackBufferWidth == 200, "Got unexpected BackBufferWidth %u.\n", d3dpp.BackBufferWidth);
|
||||
ok(d3dpp.BackBufferHeight == 150, "Got unexpected BackBufferHeight %u.\n", d3dpp.BackBufferHeight);
|
||||
ok(d3dpp.BackBufferWidth == client_rect.right, "Got unexpected BackBufferWidth %u, expected %d.\n",
|
||||
d3dpp.BackBufferWidth, client_rect.right);
|
||||
ok(d3dpp.BackBufferHeight == client_rect.bottom, "Got unexpected BackBufferHeight %u, expected %d.\n",
|
||||
d3dpp.BackBufferHeight, client_rect.bottom);
|
||||
ok(d3dpp.BackBufferFormat == d3ddm.Format, "Got unexpected BackBufferFormat %#x, expected %#x.\n",
|
||||
d3dpp.BackBufferFormat, d3ddm.Format);
|
||||
ok(d3dpp.BackBufferCount == 1, "Got unexpected BackBufferCount %u.\n", d3dpp.BackBufferCount);
|
||||
|
@ -2105,8 +2110,10 @@ static void test_reset(void)
|
|||
ok(hr == D3D_OK, "IDirect3DDevice9_GetViewport failed with %08x\n", hr);
|
||||
ok(vp.X == 0, "D3DVIEWPORT->X = %d\n", vp.X);
|
||||
ok(vp.Y == 0, "D3DVIEWPORT->Y = %d\n", vp.Y);
|
||||
ok(vp.Width == 200, "D3DVIEWPORT->Width = %d\n", vp.Width);
|
||||
ok(vp.Height == 150, "D3DVIEWPORT->Height = %d\n", vp.Height);
|
||||
ok(vp.Width == client_rect.right, "D3DVIEWPORT->Width = %d, expected %d\n",
|
||||
vp.Width, client_rect.right);
|
||||
ok(vp.Height == client_rect.bottom, "D3DVIEWPORT->Height = %d, expected %d\n",
|
||||
vp.Height, client_rect.bottom);
|
||||
ok(vp.MinZ == 0, "D3DVIEWPORT->MinZ = %f\n", vp.MinZ);
|
||||
ok(vp.MaxZ == 1, "D3DVIEWPORT->MaxZ = %f\n", vp.MaxZ);
|
||||
|
||||
|
@ -2115,8 +2122,10 @@ static void test_reset(void)
|
|||
memset(&d3dpp, 0, sizeof(d3dpp));
|
||||
hr = IDirect3DSwapChain9_GetPresentParameters(swapchain, &d3dpp);
|
||||
ok(SUCCEEDED(hr), "Failed to get present parameters, hr %#x.\n", hr);
|
||||
ok(d3dpp.BackBufferWidth == 200, "Got unexpected BackBufferWidth %u.\n", d3dpp.BackBufferWidth);
|
||||
ok(d3dpp.BackBufferHeight == 150, "Got unexpected BackBufferHeight %u.\n", d3dpp.BackBufferHeight);
|
||||
ok(d3dpp.BackBufferWidth == client_rect.right,
|
||||
"Got unexpected BackBufferWidth %u, expected %d.\n", d3dpp.BackBufferWidth, client_rect.right);
|
||||
ok(d3dpp.BackBufferHeight == client_rect.bottom,
|
||||
"Got unexpected BackBufferHeight %u, expected %d.\n", d3dpp.BackBufferHeight, client_rect.bottom);
|
||||
ok(d3dpp.BackBufferFormat == d3ddm.Format, "Got unexpected BackBufferFormat %#x, expected %#x.\n",
|
||||
d3dpp.BackBufferFormat, d3ddm.Format);
|
||||
ok(d3dpp.BackBufferCount == 1, "Got unexpected BackBufferCount %u.\n", d3dpp.BackBufferCount);
|
||||
|
|
Loading…
Reference in a new issue