d3dx9/tests: Add basic tests for D3DXCreateRenderToSurface.

This commit is contained in:
Józef Kucia 2012-06-05 12:05:42 +02:00 committed by Alexandre Julliard
parent ad5a00b7f8
commit 4200198355
1 changed files with 39 additions and 0 deletions

View File

@ -446,6 +446,44 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
} else skip("Failed to create a ID3DXFont object\n");
}
void test_D3DXCreateRenderToSurface(IDirect3DDevice9 *device)
{
HRESULT hr;
ULONG ref_count;
ID3DXRenderToSurface *render = (void *)0xdeadbeef;
hr = D3DXCreateRenderToSurface(NULL /* device */, 256, 256, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN, &render);
ok(hr == D3DERR_INVALIDCALL, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
ok(render == (void *)0xdeadbeef, "Got %p, expected %p\n", render, (void *)0xdeadbeef);
hr = D3DXCreateRenderToSurface(device, 256, 256, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN, NULL /* out */);
ok(hr == D3DERR_INVALIDCALL, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
todo_wine {
hr = D3DXCreateRenderToSurface(device, 0 /* width */, 256, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN, &render);
ok(hr == D3D_OK, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3D_OK);
if (SUCCEEDED(hr)) ID3DXRenderToSurface_Release(render);
hr = D3DXCreateRenderToSurface(device, 256, 0 /* height */, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN, &render);
ok(hr == D3D_OK, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3D_OK);
if (SUCCEEDED(hr)) ID3DXRenderToSurface_Release(render);
hr = D3DXCreateRenderToSurface(device, 256, 256, D3DFMT_UNKNOWN /* format */, FALSE, D3DFMT_UNKNOWN, &render);
ok(hr == D3D_OK, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3D_OK);
if (SUCCEEDED(hr)) ID3DXRenderToSurface_Release(render);
hr = D3DXCreateRenderToSurface(device, 0, 0, D3DFMT_UNKNOWN, FALSE, D3DFMT_UNKNOWN, &render);
ok(hr == D3D_OK, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3D_OK);
if (SUCCEEDED(hr)) ID3DXRenderToSurface_Release(render);
/* check device ref count */
ref_count = get_ref((IUnknown *)device);
hr = D3DXCreateRenderToSurface(device, 0, 0, D3DFMT_UNKNOWN, FALSE, D3DFMT_UNKNOWN, &render);
check_ref((IUnknown *)device, ref_count + 1);
if (SUCCEEDED(hr)) ID3DXRenderToSurface_Release(render);
}
}
START_TEST(core)
{
HWND wnd;
@ -480,6 +518,7 @@ START_TEST(core)
test_ID3DXBuffer();
test_ID3DXSprite(device);
test_ID3DXFont(device);
test_D3DXCreateRenderToSurface(device);
check_release((IUnknown*)device, 0);
check_release((IUnknown*)d3d, 0);