From af63977750b224893ff210572cfa925cefc5f2de Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 14 Mar 2014 10:25:04 +0100 Subject: [PATCH] d3d9/tests: Use a separate device for zenable_test(). --- dlls/d3d9/tests/visual.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 7771ea71c96..7f5f923a5be 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -14333,7 +14333,7 @@ static void resz_test(void) IDirect3D9_Release(d3d); } -static void zenable_test(IDirect3DDevice9 *device) +static void zenable_test(void) { static const struct { @@ -14347,12 +14347,26 @@ static void zenable_test(IDirect3DDevice9 *device) {{640.0f, 480.0f, 1.5f, 1.0f}, 0xff00ff00}, {{640.0f, 0.0f, 1.5f, 1.0f}, 0xff00ff00}, }; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; D3DCOLOR color; + ULONG refcount; D3DCAPS9 caps; + HWND window; HRESULT hr; UINT x, y; UINT i, j; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); ok(SUCCEEDED(hr), "Failed to disable z-buffering, hr %#x.\n", hr); hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZRHW | D3DFVF_DIFFUSE); @@ -14462,6 +14476,12 @@ static void zenable_test(IDirect3DDevice9 *device) IDirect3DPixelShader9_Release(ps); IDirect3DVertexShader9_Release(vs); } + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void fog_special_test(void) @@ -15543,11 +15563,11 @@ START_TEST(visual) srgbwrite_format_test(device_ptr); update_surface_test(device_ptr); multisample_get_rtdata_test(device_ptr); - zenable_test(device_ptr); cleanup_device(device_ptr); device_ptr = NULL; + zenable_test(); fog_special_test(); volume_srgb_test(); volume_dxt5_test(); -- 2.11.4.GIT