From 9ae22f1a765e2d9ffc8dd4eccafe4210c2ea5750 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20D=C3=B6singer?= Date: Tue, 24 Jul 2007 21:29:19 +0200 Subject: [PATCH] d3d9: Do not fail if d3d9 is not available. --- dlls/d3d9/tests/device.c | 26 +++++++++++++++++++------- dlls/d3d9/tests/query.c | 8 ++++++-- dlls/d3d9/tests/shader.c | 2 +- dlls/d3d9/tests/surface.c | 2 +- dlls/d3d9/tests/texture.c | 2 +- dlls/d3d9/tests/visual.c | 8 ++++++-- 6 files changed, 34 insertions(+), 14 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index ec54ea4ecee..c2012fceefe 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -739,7 +739,7 @@ static void test_reset(void) if(FAILED(hr)) { - trace("could not create device, IDirect3D9_CreateDevice returned %#x\n", hr); + skip("could not create device, IDirect3D9_CreateDevice returned %#x\n", hr); goto cleanup; } @@ -975,8 +975,12 @@ static void test_scene(void) hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(hr == D3D_OK, "IDirect3D9_CreateDevice failed with %s\n", DXGetErrorString9(hr)); - if(!pDevice) goto cleanup; + ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D9_CreateDevice failed with %s\n", DXGetErrorString9(hr)); + if(!pDevice) + { + skip("Failed to create a d3d device\n"); + goto cleanup; + } /* Get the caps, they will be needed to tell if an operation is supposed to be valid */ memset(&caps, 0, sizeof(caps)); @@ -1124,8 +1128,12 @@ static void test_limits(void) hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(hr == D3D_OK, "IDirect3D9_CreateDevice failed with %s\n", DXGetErrorString9(hr)); - if(!pDevice) goto cleanup; + ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D9_CreateDevice failed with %s\n", DXGetErrorString9(hr)); + if(!pDevice) + { + skip("Failed to create a d3d device\n"); + goto cleanup; + } hr = IDirect3DDevice9_CreateTexture(pDevice, 16, 16, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &pTexture, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_CreateTexture failed with %s\n", DXGetErrorString9(hr)); @@ -1187,8 +1195,12 @@ static void test_depthstenciltest(void) hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(hr == D3D_OK, "IDirect3D9_CreateDevice failed with %s\n", DXGetErrorString9(hr)); - if(!pDevice) goto cleanup; + ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D9_CreateDevice failed with %s\n", DXGetErrorString9(hr)); + if(!pDevice) + { + skip("Failed to create a d3d device\n"); + goto cleanup; + } hr = IDirect3DDevice9_GetDepthStencilSurface(pDevice, &pDepthStencil); ok(hr == D3D_OK && pDepthStencil != NULL, "IDirect3DDevice9_GetDepthStencilSurface failed with %s\n", DXGetErrorString9(hr)); diff --git a/dlls/d3d9/tests/query.c b/dlls/d3d9/tests/query.c index 72e1018b9b3..9f2b5b3a33c 100644 --- a/dlls/d3d9/tests/query.c +++ b/dlls/d3d9/tests/query.c @@ -96,8 +96,12 @@ static void test_query_support(IDirect3D9 *pD3d, HWND hwnd) hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(SUCCEEDED(hr), "Failed to create IDirect3D9Device (%s)\n", DXGetErrorString9(hr)); - if (FAILED(hr)) goto cleanup; + ok(SUCCEEDED(hr) || hr == D3DERR_NOTAVAILABLE, "Failed to create IDirect3D9Device (%s)\n", DXGetErrorString9(hr)); + if (FAILED(hr)) + { + skip("Failed to create a d3d device\n"); + goto cleanup; + } for(i = 0; i < sizeof(queries) / sizeof(queries[0]); i++) { diff --git a/dlls/d3d9/tests/shader.c b/dlls/d3d9/tests/shader.c index 9c340431a7c..0465cee82c7 100644 --- a/dlls/d3d9/tests/shader.c +++ b/dlls/d3d9/tests/shader.c @@ -58,7 +58,7 @@ static IDirect3DDevice9 *init_d3d9(void) if(FAILED(hres)) { - trace("could not create device, IDirect3D9_CreateDevice returned %#x\n", hres); + skip("could not create device, IDirect3D9_CreateDevice returned %#x\n", hres); return NULL; } diff --git a/dlls/d3d9/tests/surface.c b/dlls/d3d9/tests/surface.c index b2091153e63..c84e9332bd0 100644 --- a/dlls/d3d9/tests/surface.c +++ b/dlls/d3d9/tests/surface.c @@ -57,7 +57,7 @@ static IDirect3DDevice9 *init_d3d9(HMODULE d3d9_handle) if(FAILED(hr)) { - trace("could not create device, IDirect3D9_CreateDevice returned %#x\n", hr); + skip("could not create device, IDirect3D9_CreateDevice returned %#x\n", hr); return NULL; } diff --git a/dlls/d3d9/tests/texture.c b/dlls/d3d9/tests/texture.c index 79d855dcc95..cb7b781d002 100644 --- a/dlls/d3d9/tests/texture.c +++ b/dlls/d3d9/tests/texture.c @@ -56,7 +56,7 @@ static IDirect3DDevice9 *init_d3d9(HMODULE d3d9_handle) if(FAILED(hr)) { - trace("could not create device, IDirect3D9_CreateDevice returned %#x\n", hr); + skip("could not create device, IDirect3D9_CreateDevice returned %#x\n", hr); return NULL; } diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 1d92d22e45a..65e33bb9d64 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -120,7 +120,7 @@ static IDirect3DDevice9 *init_d3d9(void) present_parameters.AutoDepthStencilFormat = D3DFMT_D16; hr = IDirect3D9_CreateDevice(d3d9_ptr, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device_ptr); - ok(hr == D3D_OK, "IDirect3D_CreateDevice returned: %s\n", DXGetErrorString9(hr)); + ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D_CreateDevice returned: %s\n", DXGetErrorString9(hr)); return device_ptr; } @@ -1199,7 +1199,11 @@ START_TEST(visual) } device_ptr = init_d3d9(); - if (!device_ptr) return; + if (!device_ptr) + { + skip("Creating the device failed\n"); + return; + } IDirect3DDevice9_GetDeviceCaps(device_ptr, &caps); -- 2.11.4.GIT