From e21a4b291c45f1b079ffcc4ddcda7a74e6486516 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 6 Nov 2012 06:34:58 -0700 Subject: [PATCH] d3d9/tests: Add test for IDirect3DDevice9_Reset with BackBufferWidth/Height = 0. --- dlls/d3d9/tests/device.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 8fd72cfd3f7..614538a7c8f 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -860,6 +860,7 @@ static void test_reset(void) { HRESULT hr; HWND hwnd = NULL; + RECT winrect; IDirect3D9 *pD3d = NULL; D3DPRESENT_PARAMETERS d3dpp; D3DDISPLAYMODE d3ddm, d3ddm2; @@ -1064,6 +1065,55 @@ static void test_reset(void) IDirect3DSwapChain9_Release(pSwapchain); } + winrect.left = 0; + winrect.top = 0; + winrect.right = 200; + winrect.bottom = 150; + ok(AdjustWindowRect(&winrect, WS_OVERLAPPEDWINDOW, FALSE), "AdjustWindowRect failed\n"); + ok(SetWindowPos(hwnd, NULL, 0, 0, + winrect.right-winrect.left, + winrect.bottom-winrect.top, + SWP_NOMOVE|SWP_NOZORDER), + "SetWindowPos failed\n"); + + ZeroMemory( &d3dpp, sizeof(d3dpp) ); + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + d3dpp.Windowed = TRUE; + d3dpp.BackBufferWidth = 0; + d3dpp.BackBufferHeight = 0; + hr = IDirect3DDevice9_Reset(device1, &d3dpp); + ok(hr == D3D_OK, "IDirect3DDevice9_Reset failed with %08x\n", hr); + hr = IDirect3DDevice9_TestCooperativeLevel(device1); + ok(hr == D3D_OK, "IDirect3DDevice9_TestCooperativeLevel after a successful reset returned %#x\n", hr); + + ZeroMemory(&vp, sizeof(vp)); + hr = IDirect3DDevice9_GetViewport(device1, &vp); + ok(hr == D3D_OK, "IDirect3DDevice9_GetViewport failed with %08x\n", hr); + if(SUCCEEDED(hr)) + { + ok(vp.X == 0, "D3DVIEWPORT->X = %d\n", vp.X); + ok(vp.Y == 0, "D3DVIEWPORT->Y = %d\n", vp.Y); + todo_wine ok(vp.Width == 200, "D3DVIEWPORT->Width = %d\n", vp.Width); + todo_wine ok(vp.Height == 150, "D3DVIEWPORT->Height = %d\n", vp.Height); + ok(vp.MinZ == 0, "D3DVIEWPORT->MinZ = %f\n", vp.MinZ); + ok(vp.MaxZ == 1, "D3DVIEWPORT->MaxZ = %f\n", vp.MaxZ); + } + + hr = IDirect3DDevice9_GetSwapChain(device1, 0, &pSwapchain); + ok(hr == D3D_OK, "IDirect3DDevice9_GetSwapChain returned %08x\n", hr); + if(SUCCEEDED(hr)) + { + ZeroMemory(&d3dpp, sizeof(d3dpp)); + hr = IDirect3DSwapChain9_GetPresentParameters(pSwapchain, &d3dpp); + ok(hr == D3D_OK, "IDirect3DSwapChain9_GetPresentParameters returned %08x\n", hr); + if(SUCCEEDED(hr)) + { + todo_wine ok(d3dpp.BackBufferWidth == 200, "Back buffer width is %d\n", d3dpp.BackBufferWidth); + todo_wine ok(d3dpp.BackBufferHeight == 150, "Back buffer height is %d\n", d3dpp.BackBufferHeight); + } + IDirect3DSwapChain9_Release(pSwapchain); + } + ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.Windowed = TRUE; -- 2.11.4.GIT