Tony Wasserka : d3dx9: Add tests for D3DXLoadSurfaceFromMemory.
Alexandre Julliard
julliard at winehq.org
Fri Jun 26 09:47:16 CDT 2009
Module: wine
Branch: master
Commit: be8afaff686eced0305fc5bd220bf16f8044aa80
URL: http://source.winehq.org/git/wine.git/?a=commit;h=be8afaff686eced0305fc5bd220bf16f8044aa80
Author: Tony Wasserka <tony.wasserka at freenet.de>
Date: Thu Jun 25 20:11:44 2009 +0200
d3dx9: Add tests for D3DXLoadSurfaceFromMemory.
---
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);
More information about the wine-cvs
mailing list