Module: wine Branch: master Commit: 40c06ea2969fbc719a7c3207480ea255714123c1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=40c06ea2969fbc719a7c320748...
Author: Stefan Dösinger stefan@codeweavers.com Date: Fri Sep 19 13:12:30 2008 -0500
d3d9: Add a test for GetTexture with no texture set.
---
dlls/d3d9/device.c | 8 +++++--- dlls/d3d9/tests/texture.c | 12 ++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index db58689..697c202 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -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); diff --git a/dlls/d3d9/tests/texture.c b/dlls/d3d9/tests/texture.c index 7212d3c..515820b 100644 --- a/dlls/d3d9/tests/texture.c +++ b/dlls/d3d9/tests/texture.c @@ -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); }