[PATCH 4/4] d3dx9/tests: Test D3DXCreateTexture.
Philip Nilsson
pnilsson at nullref.se
Fri Apr 18 12:07:58 CDT 2008
This was written assuming the other test catches most issues. MSDN says
D3DXCheckTextureRequirements is used internally, so I'll just go by
that.
---
dlls/d3dx9_36/tests/texture.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx9_36/tests/texture.c b/dlls/d3dx9_36/tests/texture.c
index 3b634a8..0fabaed 100644
--- a/dlls/d3dx9_36/tests/texture.c
+++ b/dlls/d3dx9_36/tests/texture.c
@@ -202,6 +202,43 @@ static void test_D3DXCheckTextureRequirements(IDirect3DDevice9* device)
ok(prevformat == format, "Format changed from %#x to %#x.\n", prevformat, format);
}
+/* TODO: Test invalid format. */
+static void test_D3DXCreateTexture(IDirect3DDevice9* dev)
+{
+ HRESULT hr;
+ IDirect3D9 *d3d9;
+ IDirect3DTexture9 *texture = NULL;
+
+ hr = IDirect3DDevice9_GetDirect3D(dev, &d3d9);
+ ok(hr == D3D_OK, "IDirect3DDevice9_GetDirect3D returned %#x\n", hr);
+
+ /* Verify that D3DXCreateTexture works. */
+ hr = D3DXCreateTexture(dev, 64, 64, 0, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &texture);
+ ok(hr == D3D_OK, "D3DXCreateTexture failed: %#x\n", hr);
+ if (texture) IDirect3DTexture9_Release(texture);
+ texture = NULL;
+
+ if (texture) IDirect3DTexture9_Release(texture);
+ texture = NULL;
+
+ /* Verify that NULL parameters return D3DERR_INVALIDCALL. */
+ hr = D3DXCreateTexture(NULL, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED, &texture);
+ ok(hr == D3DERR_INVALIDCALL, "D3DXCreateTexture did not return %#x: %#x\n", D3DERR_INVALIDCALL, hr);
+ if (texture) IDirect3DTexture9_Release(texture);
+ texture = NULL;
+
+ hr = D3DXCreateTexture(dev, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "D3DXCreateTexture did not return %#x: %#x\n", D3DERR_INVALIDCALL, hr);
+ if (texture) IDirect3DTexture9_Release(texture);
+ texture = NULL;
+
+ /* Test some usage parameters. */
+ hr = D3DXCreateTexture(dev, 64, 64, 0, D3DUSAGE_RENDERTARGET, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &texture);
+ ok(hr == D3D_OK, "D3DXCreateTexture failed: %#x\n", hr);
+ if (texture) IDirect3DTexture9_Release(texture);
+ texture = NULL;
+}
+
START_TEST(texture)
{
HMODULE d3d9_handle;
@@ -248,4 +285,5 @@ START_TEST(texture)
}
test_D3DXCheckTextureRequirements(device);
+ test_D3DXCreateTexture(device);
}
--
1.5.5
More information about the wine-patches
mailing list