[PATCH] d3d9: Add a test for GetTexture with no texture set=0A=

Stefan Doesinger stefan at codeweavers.com
Fri Sep 19 13:12:30 CDT 2008


=0A=
---=0A=
 dlls/d3d9/device.c        |    8 +++++---=0A=
 dlls/d3d9/tests/texture.c |   12 ++++++++++++=0A=
 2 files changed, 17 insertions(+), 3 deletions(-)=0A=
=0A=
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c=0A=
index db58689..697c202 100644=0A=
--- a/dlls/d3d9/device.c=0A=
+++ b/dlls/d3d9/device.c=0A=
@@ -990,11 +990,13 @@ static HRESULT  WINAPI  =
IDirect3DDevice9Impl_GetTexture(LPDIRECT3DDEVICE9EX ifac=0A=
 =0A=
     EnterCriticalSection(&d3d9_cs);=0A=
     rc =3D IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, =
&retTexture);=0A=
-    if (rc =3D=3D D3D_OK && NULL !=3D retTexture) {=0A=
+    if (SUCCEEDED(rc) && NULL !=3D retTexture) {=0A=
         IWineD3DBaseTexture_GetParent(retTexture, (IUnknown =
**)ppTexture);=0A=
         IWineD3DBaseTexture_Release(retTexture);=0A=
-    }else{=0A=
-        FIXME("Call to get texture  (%d) failed (%p)\n", Stage, =
retTexture);=0A=
+    } else {=0A=
+        if(FAILED(rc)) {=0A=
+            WARN("Call to get texture  (%d) failed (%p)\n", Stage, =
retTexture);=0A=
+        }=0A=
         *ppTexture =3D NULL;=0A=
     }=0A=
     LeaveCriticalSection(&d3d9_cs);=0A=
diff --git a/dlls/d3d9/tests/texture.c b/dlls/d3d9/tests/texture.c=0A=
index 7212d3c..515820b 100644=0A=
--- a/dlls/d3d9/tests/texture.c=0A=
+++ b/dlls/d3d9/tests/texture.c=0A=
@@ -323,6 +323,17 @@ static void test_filter(IDirect3DDevice9 *device) {=0A=
     IDirect3D9_Release(d3d9);=0A=
 }=0A=
 =0A=
+static void test_gettexture(IDirect3DDevice9 *device) {=0A=
+    HRESULT hr;=0A=
+    IDirect3DBaseTexture9 *texture =3D (IDirect3DBaseTexture9 *) =
0xdeadbeef;=0A=
+=0A=
+    hr =3D IDirect3DDevice9_SetTexture(device, 0, NULL);=0A=
+    ok(hr =3D=3D D3D_OK, "IDirect3DDevice9_SetTexture failed, hr =3D =
0x%08x\n", hr);=0A=
+    hr =3D IDirect3DDevice9_GetTexture(device, 0, &texture);=0A=
+    ok(hr =3D=3D D3D_OK, "IDirect3DDevice9_GetTexture failed, hr =3D =
0x%08x\n", hr);=0A=
+    ok(texture =3D=3D NULL, "Texture returned is %p, expected NULL\n", =
texture);=0A=
+}=0A=
+=0A=
 START_TEST(texture)=0A=
 {=0A=
     D3DCAPS9 caps;=0A=
@@ -345,4 +356,5 @@ START_TEST(texture)=0A=
     test_cube_textures(device_ptr, caps.TextureCaps);=0A=
     test_mipmap_gen(device_ptr);=0A=
     test_filter(device_ptr);=0A=
+    test_gettexture(device_ptr);=0A=
 }=0A=
-- =0A=
1.5.6.4=0A=
=0A=

------=_NextPart_000_001D_01C93DE3.CC288D50--




More information about the wine-patches mailing list