Stefan Dösinger : d3d8: Skip tests if d3d is not supported.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 6 08:03:31 CDT 2007


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue Jul 24 21:56:03 2007 +0200

d3d8: Skip tests if d3d is not supported.

---

 dlls/d3d8/tests/device.c  |   38 ++++++++++++++++++++++++++------------
 dlls/d3d8/tests/surface.c |    2 +-
 dlls/d3d8/tests/texture.c |    2 +-
 dlls/d3d8/tests/visual.c  |    8 ++++++--
 dlls/d3d8/tests/volume.c  |    2 +-
 5 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index c32eedd..fb9d5da 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -136,7 +136,7 @@ static void test_mipmap_levels(void)
                                   D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
     if(FAILED(hr))
     {
-        trace("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
+        skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
         goto cleanup;
     }
 
@@ -181,7 +181,7 @@ static void test_swapchain(void)
                                   D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
     if(FAILED(hr))
     {
-        trace("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
+        skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
         goto cleanup;
     }
 
@@ -324,7 +324,7 @@ static void test_refcount(void)
                                   D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
     if(FAILED(hr))
     {
-        trace("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
+        skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
         goto cleanup;
     }
     IDirect3DDevice8_GetDeviceCaps(pDevice, &caps);
@@ -638,7 +638,7 @@ static void test_cursor(void)
                                   D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
     if(FAILED(hr))
     {
-        trace("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
+        skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
         goto cleanup;
     }
 
@@ -717,7 +717,7 @@ static void test_states(void)
                                   D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
     if(FAILED(hr))
     {
-        trace("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
+        skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
         goto cleanup;
     }
 
@@ -741,10 +741,12 @@ static void test_shader_versions(void)
     ok(pD3d != NULL, "Failed to create IDirect3D8 object\n");
     if (pD3d != NULL) {
         hr = IDirect3D8_GetDeviceCaps(pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dcaps);
-        ok(SUCCEEDED(hr), "Failed to get D3D8 caps (%s)\n", DXGetErrorString8(hr));
+        ok(SUCCEEDED(hr) || hr == D3DERR_NOTAVAILABLE, "Failed to get D3D8 caps (%08x)\n", hr);
         if (SUCCEEDED(hr)) {
             ok(d3dcaps.VertexShaderVersion <= D3DVS_VERSION(1,1), "Unexpected VertexShaderVersion (%#x > %#x)\n", d3dcaps.VertexShaderVersion, D3DVS_VERSION(1,1));
             ok(d3dcaps.PixelShaderVersion <= D3DPS_VERSION(1,4), "Unexpected PixelShaderVersion (%#x > %#x)\n", d3dcaps.PixelShaderVersion, D3DPS_VERSION(1,4));
+        } else {
+            skip("No Direct3D support\n");
         }
         IDirect3D8_Release(pD3d);
     }
@@ -805,8 +807,12 @@ static void test_scene(void)
 
     hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd,
                                   D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
-    ok(hr == D3D_OK, "IDirect3D8_CreateDevice failed with %s\n", DXGetErrorString8(hr));
-    if(!pDevice) goto cleanup;
+    ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "IDirect3D8_CreateDevice failed with %08x\n", hr);
+    if(!pDevice)
+    {
+        skip("could not create device, IDirect3D8_CreateDevice returned %08x\n", hr);
+        goto cleanup;
+    }
 
     /* Test an EndScene without beginscene. Should return an error */
     hr = IDirect3DDevice8_EndScene(pDevice);
@@ -885,8 +891,12 @@ static void test_shader(void)
 
     hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd,
                                   D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
-    ok(hr == D3D_OK, "IDirect3D8_CreateDevice failed with %s\n", DXGetErrorString8(hr));
-    if(!pDevice) goto cleanup;
+    ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "IDirect3D8_CreateDevice failed with %08x\n", hr);
+    if(!pDevice)
+    {
+        skip("could not create device, IDirect3D8_CreateDevice returned %08x\n", hr);
+        goto cleanup;
+    }
     IDirect3DDevice8_GetDeviceCaps(pDevice, &caps);
 
     /* First create a vertex shader */
@@ -1053,8 +1063,12 @@ static void test_limits(void)
 
     hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd,
                                   D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
-    ok(hr == D3D_OK, "IDirect3D8_CreateDevice failed with %s\n", DXGetErrorString8(hr));
-    if(!pDevice) goto cleanup;
+    ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "IDirect3D8_CreateDevice failed with %08x\n", hr);
+    if(!pDevice)
+    {
+        skip("could not create device, IDirect3D8_CreateDevice returned %08x\n", hr);
+        goto cleanup;
+    }
 
     hr = IDirect3DDevice8_CreateTexture(pDevice, 16, 16, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &pTexture);
     ok(hr == D3D_OK, "IDirect3DDevice8_CreateTexture failed with %s\n", DXGetErrorString8(hr));
diff --git a/dlls/d3d8/tests/surface.c b/dlls/d3d8/tests/surface.c
index 1503581..71dce2f 100644
--- a/dlls/d3d8/tests/surface.c
+++ b/dlls/d3d8/tests/surface.c
@@ -59,7 +59,7 @@ static IDirect3DDevice8 *init_d3d8(HMODULE d3d8_handle)
 
     if(FAILED(hr))
     {
-        trace("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
+        skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
         return NULL;
     }
 
diff --git a/dlls/d3d8/tests/texture.c b/dlls/d3d8/tests/texture.c
index df7da8b..5c92271 100644
--- a/dlls/d3d8/tests/texture.c
+++ b/dlls/d3d8/tests/texture.c
@@ -59,7 +59,7 @@ static IDirect3DDevice8 *init_d3d8(HMODULE d3d8_handle)
 
     if(FAILED(hr))
     {
-        trace("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
+        skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
         return NULL;
     }
 
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index a23c322..d2c8327 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -120,7 +120,7 @@ static IDirect3DDevice8 *init_d3d8(void)
     present_parameters.AutoDepthStencilFormat = D3DFMT_D16;
 
     hr = IDirect3D8_CreateDevice(d3d8_ptr, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device_ptr);
-    ok(hr == D3D_OK, "IDirect3D_CreateDevice returned: %s\n", DXGetErrorString8(hr));
+    ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "IDirect3D_CreateDevice returned: %s\n", DXGetErrorString8(hr));
 
     return device_ptr;
 }
@@ -625,7 +625,11 @@ START_TEST(visual)
     }
 
     device_ptr = init_d3d8();
-    if (!device_ptr) return;
+    if (!device_ptr)
+    {
+        skip("Could not initialize direct3d\n");
+        return;
+    }
 
     IDirect3DDevice8_GetDeviceCaps(device_ptr, &caps);
 
diff --git a/dlls/d3d8/tests/volume.c b/dlls/d3d8/tests/volume.c
index 09767c2..66f5a3c 100644
--- a/dlls/d3d8/tests/volume.c
+++ b/dlls/d3d8/tests/volume.c
@@ -59,7 +59,7 @@ static IDirect3DDevice8 *init_d3d8(HMODULE d3d8_handle)
 
     if(FAILED(hr))
     {
-        trace("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
+        skip("could not create device, IDirect3D8_CreateDevice returned %#x\n", hr);
         return NULL;
     }
 




More information about the wine-cvs mailing list