d3d9/tests: Make sure the device is released properly.
This commit is contained in:
parent
ad05c39fd7
commit
c672071db7
|
@ -130,9 +130,13 @@ static void test_mipmap_levels(void)
|
|||
check_mipmap_levels(pDevice, 1, 256, 9);
|
||||
check_mipmap_levels(pDevice, 1, 1, 1);
|
||||
|
||||
cleanup:
|
||||
if (pD3d) IUnknown_Release( pD3d );
|
||||
if (pDevice) IUnknown_Release( pDevice );
|
||||
cleanup:
|
||||
if (pDevice)
|
||||
{
|
||||
UINT refcount = IUnknown_Release( pDevice );
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if (pD3d) IUnknown_Release( pD3d );
|
||||
DestroyWindow( hwnd );
|
||||
}
|
||||
|
||||
|
@ -186,8 +190,12 @@ static void test_checkdevicemultisampletype(void)
|
|||
ok(qualityLevels == 1,"qualitylevel is not 1 but %d\n",qualityLevels);
|
||||
|
||||
cleanup:
|
||||
if (pD3d) IUnknown_Release( pD3d );
|
||||
if (pDevice) IUnknown_Release( pDevice );
|
||||
if (pDevice)
|
||||
{
|
||||
UINT refcount = IUnknown_Release( pDevice );
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if (pD3d) IUnknown_Release( pD3d );
|
||||
DestroyWindow( hwnd );
|
||||
}
|
||||
|
||||
|
@ -326,12 +334,16 @@ static void test_swapchain(void)
|
|||
ok(swapchainX == NULL, "The swapchain pointer is %p\n", swapchainX);
|
||||
if(swapchainX && swapchainX != (void *) 0xdeadbeef ) IDirect3DSwapChain9_Release(swapchainX);
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
if(swapchain1) IDirect3DSwapChain9_Release(swapchain1);
|
||||
if(swapchain2) IDirect3DSwapChain9_Release(swapchain2);
|
||||
if(swapchain3) IDirect3DSwapChain9_Release(swapchain3);
|
||||
if(pDevice) IDirect3DDevice9_Release(pDevice);
|
||||
if(pD3d) IDirect3DDevice9_Release(pD3d);
|
||||
if (pDevice)
|
||||
{
|
||||
UINT refcount = IDirect3DDevice9_Release(pDevice);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if (pD3d) IDirect3D9_Release(pD3d);
|
||||
DestroyWindow( hwnd );
|
||||
}
|
||||
|
||||
|
@ -760,8 +772,12 @@ static void test_cursor(void)
|
|||
ok(info.hCursor == cur, "The cursor handle is %p\n", info.hCursor); /* unchanged */
|
||||
|
||||
cleanup:
|
||||
if(pDevice) IDirect3D9_Release(pDevice);
|
||||
if(pD3d) IDirect3D9_Release(pD3d);
|
||||
if (pDevice)
|
||||
{
|
||||
UINT refcount = IDirect3DDevice9_Release(pDevice);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if (pD3d) IDirect3D9_Release(pD3d);
|
||||
DestroyWindow( hwnd );
|
||||
}
|
||||
|
||||
|
@ -1145,8 +1161,12 @@ static void test_reset(void)
|
|||
|
||||
cleanup:
|
||||
HeapFree(GetProcessHeap(), 0, modes);
|
||||
if(pD3d) IDirect3D9_Release(pD3d);
|
||||
if(pDevice) IDirect3D9_Release(pDevice);
|
||||
if (pDevice)
|
||||
{
|
||||
UINT refcount = IDirect3DDevice9_Release(pDevice);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if (pD3d) IDirect3D9_Release(pD3d);
|
||||
}
|
||||
|
||||
/* Test adapter display modes */
|
||||
|
@ -1389,8 +1409,12 @@ cleanup:
|
|||
if(pSurface1) IDirect3DSurface9_Release(pSurface1);
|
||||
if(pSurface2) IDirect3DSurface9_Release(pSurface2);
|
||||
if(pSurface3) IDirect3DSurface9_Release(pSurface3);
|
||||
if(pD3d) IDirect3D9_Release(pD3d);
|
||||
if(pDevice) IDirect3D9_Release(pDevice);
|
||||
if (pDevice)
|
||||
{
|
||||
UINT refcount = IDirect3DDevice9_Release(pDevice);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if (pD3d) IDirect3D9_Release(pD3d);
|
||||
if(hwnd) DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
|
@ -1456,8 +1480,12 @@ static void test_limits(void)
|
|||
*/
|
||||
cleanup:
|
||||
if(pTexture) IDirect3DTexture9_Release(pTexture);
|
||||
if(pD3d) IDirect3D9_Release(pD3d);
|
||||
if(pDevice) IDirect3D9_Release(pDevice);
|
||||
if (pDevice)
|
||||
{
|
||||
UINT refcount = IDirect3D9_Release(pDevice);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if (pD3d) IDirect3D9_Release(pD3d);
|
||||
if(hwnd) DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
|
@ -1615,8 +1643,12 @@ static void test_depthstenciltest(void)
|
|||
|
||||
cleanup:
|
||||
if(pDepthStencil) IDirect3DSurface9_Release(pDepthStencil);
|
||||
if(pD3d) IDirect3D9_Release(pD3d);
|
||||
if(pDevice) IDirect3D9_Release(pDevice);
|
||||
if (pDevice)
|
||||
{
|
||||
UINT refcount = IDirect3D9_Release(pDevice);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if (pD3d) IDirect3D9_Release(pD3d);
|
||||
if(hwnd) DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
|
@ -1739,8 +1771,12 @@ static void test_draw_indexed(void)
|
|||
IDirect3DVertexDeclaration9_Release(vertex_declaration);
|
||||
|
||||
cleanup:
|
||||
if (device)
|
||||
{
|
||||
UINT refcount = IDirect3DDevice9_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if (d3d9) IDirect3D9_Release(d3d9);
|
||||
if (device) IDirect3DDevice9_Release(device);
|
||||
if (hwnd) DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
|
@ -1831,7 +1867,11 @@ cleanup:
|
|||
if (buffer) IDirect3DVertexBuffer9_Release(buffer);
|
||||
if(decl) IDirect3DVertexDeclaration9_Release(decl);
|
||||
if(shader) IDirect3DVertexShader9_Release(shader);
|
||||
if(device) IDirect3DDevice9_Release(device);
|
||||
if (device)
|
||||
{
|
||||
UINT refcount = IDirect3DDevice9_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if(d3d9) IDirect3D9_Release(d3d9);
|
||||
}
|
||||
|
||||
|
@ -1901,8 +1941,13 @@ static void test_vertex_buffer_alignment(void)
|
|||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if(d3d9) IDirect3D9_Release(d3d9);
|
||||
cleanup:
|
||||
if (device)
|
||||
{
|
||||
UINT refcount = IDirect3DDevice9_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if (d3d9) IDirect3D9_Release(d3d9);
|
||||
}
|
||||
|
||||
static void test_lights(void)
|
||||
|
@ -1963,8 +2008,12 @@ static void test_lights(void)
|
|||
ok(hr == D3D_OK, "Disabling light %u failed with %08x\n", i, hr);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if(device) IDirect3DDevice9_Release(device);
|
||||
cleanup:
|
||||
if (device)
|
||||
{
|
||||
UINT refcount = IDirect3DDevice9_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if(d3d9) IDirect3D9_Release(d3d9);
|
||||
}
|
||||
|
||||
|
@ -2037,9 +2086,13 @@ static void test_set_stream_source(void)
|
|||
hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 0, 0);
|
||||
ok(hr == D3D_OK, "Failed to set the stream source, offset 4, hr = %08x\n", hr);
|
||||
|
||||
if(pVertexBuffer) IDirect3DDevice9_Release(pVertexBuffer);
|
||||
cleanup:
|
||||
if(device) IDirect3DDevice9_Release(device);
|
||||
if (pVertexBuffer) IDirect3DVertexBuffer9_Release(pVertexBuffer);
|
||||
if (device)
|
||||
{
|
||||
UINT refcount = IDirect3DDevice9_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
if(d3d9) IDirect3D9_Release(d3d9);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,8 +130,12 @@ static void test_query_support(IDirect3D9 *pD3d, HWND hwnd)
|
|||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if(pDevice) IDirect3DDevice9_Release(pDevice);
|
||||
cleanup:
|
||||
if (pDevice)
|
||||
{
|
||||
UINT refcount = IDirect3DDevice9_Release(pDevice);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_occlusion_query_states(IDirect3D9 *pD3d, HWND hwnd)
|
||||
|
@ -226,10 +230,14 @@ static void test_occlusion_query_states(IDirect3D9 *pD3d, HWND hwnd)
|
|||
hr = IDirect3DQuery9_Issue(pQuery, D3DISSUE_END);
|
||||
ok(hr == D3D_OK, "IDirect3DQuery9_Issue(D3DISSUE_END) on a ended query returned %08x\n", hr);
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
HeapFree(GetProcessHeap(), 0, data);
|
||||
if (pQuery) IDirect3DQuery9_Release(pQuery);
|
||||
if(pDevice) IDirect3DDevice9_Release(pDevice);
|
||||
if (pDevice)
|
||||
{
|
||||
UINT refcount = IDirect3DDevice9_Release(pDevice);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(query)
|
||||
|
|
Loading…
Reference in New Issue