Module: wine Branch: master Commit: 9ae22f1a765e2d9ffc8dd4eccafe4210c2ea5750 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9ae22f1a765e2d9ffc8dd4ecca...
Author: Stefan Dösinger stefan@codeweavers.com Date: Tue Jul 24 21:29:19 2007 +0200
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 ec54ea4..c2012fc 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 72e1018..9f2b5b3 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 9c34043..0465cee 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 b209115..c84e933 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 79d855d..cb7b781 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 1d92d22..65e33bb 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);