[PATCH 3/6] d3dx9: Add framework for a more sophisticated D3DXCreateSphere test.

Misha Koshelev misha680 at gmail.com
Fri Jun 25 21:19:37 CDT 2010


---
 dlls/d3dx9_36/tests/mesh.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index 0554340..78f8851 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -479,6 +479,11 @@ static void D3DXIntersectTriTest(void)
 static void D3DXCreateSphereTest(void)
 {
     HRESULT hr;
+    HWND wnd;
+    IDirect3D9* d3d;
+    IDirect3DDevice9* device;
+    D3DPRESENT_PARAMETERS d3dpp;
+    ID3DXMesh* sphere = NULL;
 
     hr = D3DXCreateSphere(NULL, 0.0f, 0, 0, NULL, NULL);
     todo_wine ok( hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n",hr,D3DERR_INVALIDCALL);
@@ -491,6 +496,42 @@ static void D3DXCreateSphereTest(void)
 
     hr = D3DXCreateSphere(NULL, 0.0f, 0, 1, NULL, NULL);
     todo_wine ok( hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n",hr,D3DERR_INVALIDCALL);
+
+    wnd = CreateWindow("static", "d3dx9_test", 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
+    d3d = Direct3DCreate9(D3D_SDK_VERSION);
+    if (!wnd) {
+        skip("Couldn't create application window\n");
+        return;
+    }
+    if (!d3d) {
+        skip("Couldn't create IDirect3D9 object\n");
+        DestroyWindow(wnd);
+        return;
+    }
+
+    ZeroMemory(&d3dpp, sizeof(d3dpp));
+    d3dpp.Windowed = TRUE;
+    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
+    hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device);
+    if (FAILED(hr)) {
+        skip("Failed to create IDirect3DDevice9 object %#x\n", hr);
+        IDirect3D9_Release(d3d);
+        DestroyWindow(wnd);
+        return;
+    }
+
+    hr = D3DXCreateSphere(device, 1.0f, 1, 1, &sphere, NULL);
+    todo_wine ok( hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n",hr,D3DERR_INVALIDCALL);
+
+    hr = D3DXCreateSphere(device, 1.0f, 2, 2, &sphere, NULL);
+    todo_wine ok( hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n",hr);
+
+    if (sphere)
+        sphere->lpVtbl->Release(sphere);
+
+    IDirect3DDevice9_Release(device);
+    IDirect3D9_Release(d3d);
+    DestroyWindow(wnd);
 }
 
 static void test_get_decl_vertex_size(void)
-- 
1.7.1







More information about the wine-patches mailing list