[RFC PATCH 1/2] d3d9/tests: Test that GetRasterStatus returns D3DERR_INVALIDCALL if D3DCAPS_READ_SCANLINE isn't set.

Florian Köberle florian at fkoeberle.de
Sat Jul 17 05:43:31 CDT 2010


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

diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index ba25760..0acedcb 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -2735,6 +2735,58 @@ done:
     if (d3d9) IDirect3D9_Release(d3d9);
 }
 
+static void test_get_raster_status(void)
+{
+    HRESULT                      hr;
+    HWND                         hwnd               = NULL;
+    IDirect3D9                  *pD3d               = NULL;
+    IDirect3DDevice9            *pDevice            = NULL;
+    D3DPRESENT_PARAMETERS        d3dpp;
+    D3DDISPLAYMODE               d3ddm;
+    D3DCAPS9                     caps;
+    D3DRASTER_STATUS rasterStatus;
+
+    pD3d = pDirect3DCreate9( D3D_SDK_VERSION );
+    ok(pD3d != NULL, "Failed to create IDirect3D9 object\n");
+    hwnd = CreateWindow( "static", "d3d9_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL );
+    ok(hwnd != NULL, "Failed to create window\n");
+    if (!pD3d || !hwnd) goto cleanup;
+
+    IDirect3D9_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm );
+    ZeroMemory( &d3dpp, sizeof(d3dpp) );
+    d3dpp.Windowed         = TRUE;
+    d3dpp.SwapEffect       = D3DSWAPEFFECT_DISCARD;
+    d3dpp.BackBufferFormat = d3ddm.Format;
+    d3dpp.BackBufferCount  = 0;
+
+    hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd,
+                                  D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
+    ok(hr == S_OK || hr == D3DERR_NOTAVAILABLE,
+       "Failed to create IDirect3D9Device (%08x)\n", hr);
+    if (FAILED(hr)) goto cleanup;
+    
+    hr = IDirect3DDevice9_GetDeviceCaps(pDevice, &caps);
+    ok(hr == D3D_OK, "IDirect3DDevice9_GetCaps failed with %08x\n", hr);
+
+    if ((caps.Caps & D3DCAPS_READ_SCANLINE) == 0) {
+        ZeroMemory( &rasterStatus, sizeof(rasterStatus) );
+        hr = IDirect3DDevice9_GetRasterStatus(pDevice, 0, &rasterStatus);
+        todo_wine
+        ok(hr == D3DERR_INVALIDCALL, "GetRasterStatus should return D3DERR_INVALIDCALL\n");
+    } else {
+        skip("Device supports D3DCAPS_READ_SCANLINE\n");
+    }
+
+cleanup:
+    if (pDevice)
+    {
+        UINT refcount = IDirect3DDevice9_Release(pDevice);
+        ok(!refcount, "Device has %u references left.\n", refcount);
+    }
+    if (pD3d) IDirect3D9_Release(pD3d);
+    DestroyWindow( hwnd );
+}
+
 START_TEST(device)
 {
     HMODULE d3d9_handle = LoadLibraryA( "d3d9.dll" );
@@ -2778,5 +2830,6 @@ START_TEST(device)
         test_scissor_size();
         test_wndproc();
         test_wndproc_windowed();
+        test_get_raster_status();
     }
 }
-- 
1.7.0.4




More information about the wine-devel mailing list