d3dx9/tests: Add tests for D3DXCreateRenderToEnvMap.

This commit is contained in:
Józef Kucia 2012-06-10 21:29:13 +02:00 committed by Alexandre Julliard
parent 1325c400c1
commit f072404f61
3 changed files with 69 additions and 1 deletions

View File

@ -81,7 +81,7 @@
@ stub D3DXCreatePRTBufferTex(long long long long ptr)
@ stub D3DXCreatePRTCompBuffer(long long long ptr ptr ptr ptr)
@ stub D3DXCreatePRTEngine(ptr ptr long ptr ptr)
@ stub D3DXCreateRenderToEnvMap(ptr long long long long long ptr)
@ stdcall D3DXCreateRenderToEnvMap(ptr long long long long long ptr)
@ stdcall D3DXCreateRenderToSurface(ptr long long long long long ptr)
@ stub D3DXCreateSPMesh(ptr ptr ptr ptr ptr)
@ stdcall D3DXCreateSkinInfo(long ptr long ptr)

View File

@ -386,3 +386,19 @@ HRESULT WINAPI D3DXCreateRenderToSurface(IDirect3DDevice9 *device,
*out = &render->ID3DXRenderToSurface_iface;
return D3D_OK;
}
HRESULT WINAPI D3DXCreateRenderToEnvMap(IDirect3DDevice9 *device,
UINT size,
UINT mip_levels,
D3DFORMAT format,
BOOL depth_stencil,
D3DFORMAT depth_stencil_format,
ID3DXRenderToEnvMap **out)
{
FIXME("(%p, %u, %u, %#x, %d, %#x, %p): stub\n", device, size, mip_levels,
format, depth_stencil, depth_stencil_format, out);
if (!device || !out) return D3DERR_INVALIDCALL;
return E_NOTIMPL;
}

View File

@ -883,6 +883,57 @@ static void test_ID3DXRenderToSurface(IDirect3DDevice9 *device)
test_ID3DXRenderToSurface_device_state(device);
}
void test_D3DXCreateRenderToEnvMap(IDirect3DDevice9 *device)
{
int i;
HRESULT hr;
ULONG ref_count;
D3DXRTE_DESC desc;
ID3DXRenderToEnvMap *render;
static const struct {
D3DXRTE_DESC parameters;
D3DXRTE_DESC expected_values;
} tests[] = {
{ { 0, 0, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN }, { 1, 1, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN } },
{ { 256, 0, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN }, { 256, 9, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN } },
{ { 256, 4, D3DFMT_A8R8G8B8, FALSE, D3DFMT_D24S8 }, { 256, 4, D3DFMT_A8R8G8B8, FALSE, D3DFMT_D24S8 } },
{ { 256, 256, D3DFMT_UNKNOWN, FALSE, D3DFMT_R8G8B8 }, { 256, 9, D3DFMT_A8R8G8B8, FALSE, D3DFMT_R8G8B8 } },
{ { -1, -1, D3DFMT_A8R8G8B8, TRUE, D3DFMT_DXT1 }, { 256, 9, D3DFMT_A8R8G8B8, TRUE, D3DFMT_DXT1 } },
{ { 256, 1, D3DFMT_X8R8G8B8, TRUE, D3DFMT_UNKNOWN }, { 256, 1, D3DFMT_X8R8G8B8, TRUE, D3DFMT_UNKNOWN } }
};
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
{
const D3DXRTE_DESC *parameters = &tests[i].parameters;
const D3DXRTE_DESC *expected = &tests[i].expected_values;
hr = D3DXCreateRenderToEnvMap(device, parameters->Size, parameters->MipLevels, parameters->Format,
parameters->DepthStencil, parameters->DepthStencilFormat, &render);
todo_wine ok(hr == D3D_OK, "%d: D3DXCreateRenderToEnvMap returned %#x, expected %#x\n", i, hr, D3D_OK);
if (SUCCEEDED(hr))
{
hr = ID3DXRenderToEnvMap_GetDesc(render, &desc);
ok(hr == D3D_OK, "%d: GetDesc failed %#x\n", i, hr);
if (SUCCEEDED(hr))
{
ok(desc.Size == expected->Size, "%d: Got size %u, expected %u\n", i, desc.Size, expected->Size);
ok(desc.MipLevels == expected->MipLevels, "%d: Got miplevels %u, expected %u\n", i, desc.MipLevels, expected->MipLevels);
ok(desc.Format == expected->Format, "%d: Got format %#x, expected %#x\n", i, desc.Format, expected->Format);
ok(desc.DepthStencil == expected->DepthStencil, "%d: Got depth stencil %d, expected %d\n",
i, expected->DepthStencil, expected->DepthStencil);
ok(desc.DepthStencilFormat == expected->DepthStencilFormat, "%d: Got depth stencil format %#x, expected %#x\n",
i, expected->DepthStencilFormat, expected->DepthStencilFormat);
}
check_release((IUnknown *)render, 0);
}
}
/* check device ref count */
ref_count = get_ref((IUnknown *)device);
hr = D3DXCreateRenderToEnvMap(device, 0, 0, D3DFMT_UNKNOWN, FALSE, D3DFMT_UNKNOWN, &render);
todo_wine check_ref((IUnknown *)device, ref_count + 1);
if (SUCCEEDED(hr)) ID3DXRenderToEnvMap_Release(render);
}
START_TEST(core)
{
HWND wnd;
@ -919,6 +970,7 @@ START_TEST(core)
test_ID3DXFont(device);
test_D3DXCreateRenderToSurface(device);
test_ID3DXRenderToSurface(device);
test_D3DXCreateRenderToEnvMap(device);
check_release((IUnknown*)device, 0);
check_release((IUnknown*)d3d, 0);