[PATCH] d3dx9: Add tests for D3DXLoadSurfaceFromMemory
Tony Wasserka
tony.wasserka at freenet.de
Thu Jun 25 13:11:44 CDT 2009
---
dlls/d3dx9_36/tests/texture.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx9_36/tests/texture.c b/dlls/d3dx9_36/tests/texture.c
index 27610b8..3fc43e6 100644
--- a/dlls/d3dx9_36/tests/texture.c
+++ b/dlls/d3dx9_36/tests/texture.c
@@ -50,6 +50,11 @@ static const unsigned char bmp01[66] = {
0x00,0x00
};
+/* 2x2 A8R8G8B8 pixel data */
+static const unsigned char pixdata[] = {
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
+};
+
/* invalid image file */
static const unsigned char noimage[4] = {
0x11,0x22,0x33,0x44
@@ -205,6 +210,7 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
HRESULT hr;
BOOL testdummy_ok, testbitmap_ok;
IDirect3DSurface9 *surf;
+ RECT rect;
hr = create_file("testdummy.bmp", noimage, sizeof(noimage)); /* invalid image */
testdummy_ok = SUCCEEDED(hr);
@@ -289,6 +295,30 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
ok(hr == D3DERR_INVALIDCALL, "D3DXLoadSurfaceFromFileInMemory returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
+ /* D3DXLoadSurfaceFromMemory */
+ SetRect(&rect, 0, 0, 2, 2);
+
+ todo_wine {
+ hr = D3DXLoadSurfaceFromMemory(surf, NULL, NULL, pixdata, D3DFMT_A8R8G8B8, sizeof(pixdata), NULL, &rect, D3DX_DEFAULT, 0);
+ ok(hr == D3D_OK, "D3DXLoadSurfaceFromMemory returned %#x, expected %#x\n", hr, D3D_OK);
+
+ hr = D3DXLoadSurfaceFromMemory(surf, NULL, NULL, pixdata, D3DFMT_A8R8G8B8, 0, NULL, &rect, D3DX_DEFAULT, 0);
+ ok(hr == D3D_OK, "D3DXLoadSurfaceFromMemory returned %#x, expected %#x\n", hr, D3D_OK);
+ }
+
+ hr = D3DXLoadSurfaceFromMemory(surf, NULL, NULL, NULL, D3DFMT_A8R8G8B8, sizeof(pixdata), NULL, &rect, D3DX_DEFAULT, 0);
+ ok(hr == D3DERR_INVALIDCALL, "D3DXLoadSurfaceFromMemory returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
+
+ hr = D3DXLoadSurfaceFromMemory(NULL, NULL, NULL, pixdata, D3DFMT_A8R8G8B8, sizeof(pixdata), NULL, &rect, D3DX_DEFAULT, 0);
+ ok(hr == D3DERR_INVALIDCALL, "D3DXLoadSurfaceFromMemory returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
+
+ hr = D3DXLoadSurfaceFromMemory(surf, NULL, NULL, pixdata, D3DFMT_A8R8G8B8, sizeof(pixdata), NULL, NULL, D3DX_DEFAULT, 0);
+ ok(hr == D3DERR_INVALIDCALL, "D3DXLoadSurfaceFromMemory returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
+
+ hr = D3DXLoadSurfaceFromMemory(surf, NULL, NULL, pixdata, D3DFMT_UNKNOWN, sizeof(pixdata), NULL, &rect, D3DX_DEFAULT, 0);
+ ok(hr == E_FAIL, "D3DXLoadSurfaceFromMemory returned %#x, expected %#x\n", hr, E_FAIL);
+
+
/* cleanup */
check_release((IUnknown*)surf, 0);
--
1.6.0.2
--------------020407050206050201080506--
More information about the wine-patches
mailing list