[PATCH 10/10] d3dx9: Add basic test for D3DXCreateBox vertex buffer declaration. (try 2)

Misha Koshelev misha680 at gmail.com
Sat Jul 17 14:14:27 CDT 2010


---
 dlls/d3dx9_36/tests/mesh.c |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index d21303d..a2515ce 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -489,6 +489,7 @@ static void D3DXCreateBoxTest(void)
     D3DPRESENT_PARAMETERS d3dpp;
     ID3DXMesh* box = NULL;
     DWORD number_of_vertices, number_of_faces;
+    D3DVERTEXELEMENT9 decl[MAX_FVF_DECL_SIZE];
     IDirect3DVertexBuffer9* vertex_buffer = NULL;
     IDirect3DIndexBuffer9* index_buffer = NULL;
     D3DVERTEXBUFFER_DESC vertex_buffer_description;
@@ -496,7 +497,12 @@ static void D3DXCreateBoxTest(void)
     D3DXVECTOR3* vertex_data = NULL;
     D3DXVECTOR3 test_vertex_data[48];
     WORD* index_data = NULL;
-    int expected, i;
+    int expected, i, size;
+
+    static const D3DVERTEXELEMENT9 exp[3] = {
+        {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
+        {0, 0xC, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0},
+        D3DDECL_END(), };
 
     static const WORD test_index_data[36] = {
         0, 1, 2, /* side 1 */
@@ -567,10 +573,29 @@ static void D3DXCreateBoxTest(void)
 
     if (hr == D3D_OK && box)
     {
-        /* Vertex buffer */
+        /* Declaration */
         number_of_vertices = box->lpVtbl->GetNumVertices(box);
         todo_wine ok( number_of_vertices == 24, "Got result %u, expected 24\n",number_of_vertices);
 
+        hr = box->lpVtbl->GetDeclaration(box, decl);
+        todo_wine ok( hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n",hr);
+
+        if (hr == D3D_OK)
+        {
+            size = sizeof(exp)/sizeof(exp[0]);
+            for (i=0; i<size-1; i++)
+            {
+                ok(decl[i].Stream == exp[i].Stream, "Returned stream %d, expected %d\n", decl[i].Stream, exp[i].Stream);
+                ok(decl[i].Type == exp[i].Type, "Returned type %d, expected %d\n", decl[i].Type, exp[i].Type);
+                ok(decl[i].Method == exp[i].Method, "Returned method %d, expected %d\n", decl[i].Method, exp[i].Method);
+                ok(decl[i].Usage == exp[i].Usage, "Returned usage %d, expected %d\n", decl[i].Usage, exp[i].Usage);
+                ok(decl[i].UsageIndex == exp[i].UsageIndex, "Returned usage index %d, expected %d\n", decl[i].UsageIndex, exp[i].UsageIndex);
+                ok(decl[i].Offset == exp[i].Offset, "Returned offset %d, expected %d\n", decl[1].Offset, exp[i].Offset);
+            }
+            ok(decl[size-1].Stream == 0xFF, "Returned too long vertex declaration\n"); /* end element */
+        }
+
+        /* Vertex buffer */
         hr = box->lpVtbl->GetVertexBuffer(box, &vertex_buffer);
         todo_wine ok( hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n",hr);
 
-- 
1.7.1






More information about the wine-patches mailing list