d3d8/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:
Stefan Dösinger 2017-10-19 10:09:21 +02:00 committed by Alexandre Julliard
parent 975a686aa0
commit 1acef2b93d
1 changed files with 12 additions and 5 deletions

View File

@ -1312,7 +1312,7 @@ static void test_reset(void)
UINT mode_count = 0; UINT mode_count = 0;
DEVMODEW devmode; DEVMODEW devmode;
IDirect3D8 *d3d8; IDirect3D8 *d3d8;
RECT winrect; RECT winrect, client_rect;
D3DVIEWPORT8 vp; D3DVIEWPORT8 vp;
D3DCAPS8 caps; D3DCAPS8 caps;
DWORD shader; DWORD shader;
@ -1579,6 +1579,9 @@ static void test_reset(void)
SWP_NOMOVE|SWP_NOZORDER), SWP_NOMOVE|SWP_NOZORDER),
"SetWindowPos failed\n"); "SetWindowPos failed\n");
/* Windows 10 gives us a different size than we requested with some DPI scaling settings (e.g. 172%). */
GetClientRect(window, &client_rect);
memset(&d3dpp, 0, sizeof(d3dpp)); memset(&d3dpp, 0, sizeof(d3dpp));
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.Windowed = TRUE; d3dpp.Windowed = TRUE;
@ -1614,8 +1617,10 @@ static void test_reset(void)
{ {
ok(vp.X == 0, "D3DVIEWPORT->X = %u, expected 0.\n", vp.X); ok(vp.X == 0, "D3DVIEWPORT->X = %u, expected 0.\n", vp.X);
ok(vp.Y == 0, "D3DVIEWPORT->Y = %u, expected 0.\n", vp.Y); ok(vp.Y == 0, "D3DVIEWPORT->Y = %u, expected 0.\n", vp.Y);
ok(vp.Width == 200, "D3DVIEWPORT->Width = %u, expected 200.\n", vp.Width); ok(vp.Width == client_rect.right, "D3DVIEWPORT->Width = %d, expected %d\n",
ok(vp.Height == 150, "D3DVIEWPORT->Height = %u, expected 150.\n", vp.Height); 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 = %.8e, expected 0.\n", vp.MinZ); ok(vp.MinZ == 0, "D3DVIEWPORT->MinZ = %.8e, expected 0.\n", vp.MinZ);
ok(vp.MaxZ == 1, "D3DVIEWPORT->MaxZ = %.8e, expected 1.\n", vp.MaxZ); ok(vp.MaxZ == 1, "D3DVIEWPORT->MaxZ = %.8e, expected 1.\n", vp.MaxZ);
} }
@ -1627,8 +1632,10 @@ static void test_reset(void)
ok(surface_desc.Format == d3ddm.Format, "Got unexpected Format %#x, expected %#x.\n", ok(surface_desc.Format == d3ddm.Format, "Got unexpected Format %#x, expected %#x.\n",
surface_desc.Format, d3ddm.Format); surface_desc.Format, d3ddm.Format);
ok(!surface_desc.MultiSampleType, "Got unexpected MultiSampleType %u.\n", d3dpp.MultiSampleType); ok(!surface_desc.MultiSampleType, "Got unexpected MultiSampleType %u.\n", d3dpp.MultiSampleType);
ok(surface_desc.Width == 200, "Back buffer width is %u, expected 200.\n", surface_desc.Width); ok(surface_desc.Width == client_rect.right,
ok(surface_desc.Height == 150, "Back buffer height is %u, expected 150.\n", surface_desc.Height); "Back buffer width is %u, expected %d.\n", surface_desc.Width, client_rect.right);
ok(surface_desc.Height == client_rect.bottom,
"Back buffer height is %u, expected %d.\n", surface_desc.Height, client_rect.bottom);
IDirect3DSurface8_Release(surface); IDirect3DSurface8_Release(surface);
memset(&d3dpp, 0, sizeof(d3dpp)); memset(&d3dpp, 0, sizeof(d3dpp));