[PATCH 7/7] d3dx9/tests: Test D3DXCreateTexture.
Philip Nilsson
pnilsson at nullref.se
Fri Sep 19 10:48:38 CDT 2008
---
dlls/d3dx9_36/tests/texture.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx9_36/tests/texture.c b/dlls/d3dx9_36/tests/texture.c
index 6e2599c..554e24f 100644
--- a/dlls/d3dx9_36/tests/texture.c
+++ b/dlls/d3dx9_36/tests/texture.c
@@ -266,6 +266,46 @@ static void test_D3DXCheckTextureRequirements(IDirect3DDevice9* device)
ok(prevmiplevels == miplevels, "Miplevels changed from %u to %u.\n", prevmiplevels, miplevels);
}
+static void test_D3DXCreateTexture(IDirect3DDevice9* dev)
+{
+ HRESULT hr;
+ IDirect3DTexture9 *texture = NULL;
+
+ /* 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;
+
+ /* 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;
+
+ hr = D3DXCreateTexture(dev, 64, 64, 0, D3DUSAGE_DEPTHSTENCIL, D3DFMT_D16, D3DPOOL_DEFAULT, &texture);
+ ok(hr == D3D_OK, "D3DXCreateTexture failed: %#x\n", hr);
+ if (texture) IDirect3DTexture9_Release(texture);
+ texture = NULL;
+
+ /* Test an invalid format, should be replaced. */
+ hr = D3DXCreateTexture(dev, 64, 64, 0, 0, 0xdeadbeef, 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;
@@ -311,4 +351,5 @@ START_TEST(texture)
}
test_D3DXCheckTextureRequirements(device);
+ test_D3DXCreateTexture(device);
}
--
1.6.0.2
More information about the wine-patches
mailing list