d3d9: Add a test for GetTexture with no texture set.

This commit is contained in:
Stefan Dösinger 2008-09-19 13:12:30 -05:00 committed by Alexandre Julliard
parent 620a423b22
commit 40c06ea296
2 changed files with 17 additions and 3 deletions

View File

@ -990,11 +990,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetTexture(LPDIRECT3DDEVICE9EX ifac
EnterCriticalSection(&d3d9_cs);
rc = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, &retTexture);
if (rc == D3D_OK && NULL != retTexture) {
if (SUCCEEDED(rc) && NULL != retTexture) {
IWineD3DBaseTexture_GetParent(retTexture, (IUnknown **)ppTexture);
IWineD3DBaseTexture_Release(retTexture);
}else{
FIXME("Call to get texture (%d) failed (%p)\n", Stage, retTexture);
} else {
if(FAILED(rc)) {
WARN("Call to get texture (%d) failed (%p)\n", Stage, retTexture);
}
*ppTexture = NULL;
}
LeaveCriticalSection(&d3d9_cs);

View File

@ -323,6 +323,17 @@ static void test_filter(IDirect3DDevice9 *device) {
IDirect3D9_Release(d3d9);
}
static void test_gettexture(IDirect3DDevice9 *device) {
HRESULT hr;
IDirect3DBaseTexture9 *texture = (IDirect3DBaseTexture9 *) 0xdeadbeef;
hr = IDirect3DDevice9_SetTexture(device, 0, NULL);
ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture failed, hr = 0x%08x\n", hr);
hr = IDirect3DDevice9_GetTexture(device, 0, &texture);
ok(hr == D3D_OK, "IDirect3DDevice9_GetTexture failed, hr = 0x%08x\n", hr);
ok(texture == NULL, "Texture returned is %p, expected NULL\n", texture);
}
START_TEST(texture)
{
D3DCAPS9 caps;
@ -345,4 +356,5 @@ START_TEST(texture)
test_cube_textures(device_ptr, caps.TextureCaps);
test_mipmap_gen(device_ptr);
test_filter(device_ptr);
test_gettexture(device_ptr);
}