Sam Edwards : d3d9/tests: Add test for IDirect3DDevice9_Reset with BackBufferWidth/Height = 0.

Alexandre Julliard julliard at winehq.org
Wed Nov 7 14:02:27 CST 2012


Module: wine
Branch: master
Commit: e21a4b291c45f1b079ffcc4ddcda7a74e6486516
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e21a4b291c45f1b079ffcc4ddcda7a74e6486516

Author: Sam Edwards <CFSworks at gmail.com>
Date:   Tue Nov  6 06:34:58 2012 -0700

d3d9/tests: Add test for IDirect3DDevice9_Reset with BackBufferWidth/Height = 0.

---

 dlls/d3d9/tests/device.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 8fd72cf..614538a 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;




More information about the wine-cvs mailing list