d3dx9: Add tests for D3DXCreateSphere vertex buffer description.

Misha Koshelev misha680 at gmail.com
Wed Jul 7 09:59:52 CDT 2010


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

diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index b747761..32ad124 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -489,7 +489,9 @@ static void D3DXCreateSphereTest(void)
     ID3DXMesh* sphere = NULL;
     DWORD number_of_vertices;
     IDirect3DVertexBuffer9* vertex_buffer = NULL;
-    BYTE* vertex_data = NULL;
+    D3DVERTEXBUFFER_DESC vertex_buffer_description;
+    D3DXVECTOR3* vertex_data = NULL;
+    int expected;
 
     hr = D3DXCreateSphere(NULL, 0.0f, 0, 0, NULL, NULL);
     todo_wine ok( hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n",hr,D3DERR_INVALIDCALL);
@@ -545,6 +547,20 @@ static void D3DXCreateSphereTest(void)
 
         if (vertex_buffer)
         {
+            hr = IDirect3DVertexBuffer9_GetDesc(vertex_buffer, &vertex_buffer_description);
+            todo_wine ok( hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n",hr);
+
+            if (hr == D3D_OK)
+            {
+                todo_wine ok( vertex_buffer_description.Format == D3DFMT_VERTEXDATA, "Got result %x, expected %x (D3DFMT_VERTEXDATA)\n",vertex_buffer_description.Format,D3DFMT_VERTEXDATA);
+                todo_wine ok( vertex_buffer_description.Type == D3DRTYPE_VERTEXBUFFER, "Got result %x, expected %x (D3DRTYPE_VERTEXBUFFER)\n",vertex_buffer_description.Type,D3DRTYPE_VERTEXBUFFER);
+                todo_wine ok( vertex_buffer_description.Usage == 0, "Got result %x, expected %x\n",vertex_buffer_description.Usage,0);
+                todo_wine ok( vertex_buffer_description.Pool == D3DPOOL_MANAGED, "Got result %x, expected %x (D3DPOOL_DEFAULT)\n",vertex_buffer_description.Pool,D3DPOOL_DEFAULT);
+                expected = number_of_vertices * sizeof(D3DXVECTOR3) * 2;
+                todo_wine ok( vertex_buffer_description.Size == expected, "Got result %x, expected %x\n",vertex_buffer_description.Size,expected);
+                todo_wine ok( vertex_buffer_description.FVF == (D3DFVF_XYZ | D3DFVF_NORMAL), "Got result %x, expected %x (D3DFVF_XYZ | D3DFVF_NORMAL)\n",vertex_buffer_description.FVF,D3DFVF_XYZ | D3DFVF_NORMAL);
+            }
+
             /* Specify offset and size to avoid potential overruns */
             hr = IDirect3DVertexBuffer9_Lock(vertex_buffer, 0, number_of_vertices * sizeof(D3DXVECTOR3) * 2, (LPVOID *)&vertex_data, D3DLOCK_DISCARD);
             todo_wine ok( hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n",hr);
-- 
1.7.1


--=-ou1xPQ5wtqgvy0dE3mPu
Content-Disposition: attachment; filename="diff"
Content-Type: text/plain; name="diff"; charset="UTF-8"
Content-Transfer-Encoding: 7bit

1c1
< From bd8d73a0e398db2f9fed27de0a657e31e18d86b1 Mon Sep 17 00:00:00 2001
---
> From 03180708b36aab9efd566c8971da7b60924500bf Mon Sep 17 00:00:00 2001
4c4
< Subject: d3dx9: Add tests for D3DXCreateSphere vertex buffer description.
---
> Subject: d3dx9: Test number of vertices for D3DXCreateSphere, retrieve vertex buffer.
9,10c9,10
<  dlls/d3dx9_36/tests/mesh.c |   18 +++++++++++++++++-
<  1 files changed, 17 insertions(+), 1 deletions(-)
---
>  dlls/d3dx9_36/tests/mesh.c |   22 ++++++++++++++++++++++
>  1 files changed, 22 insertions(+), 0 deletions(-)
13c13
< index b747761..32ad124 100644
---
> index f3a629d..b747761 100644
16c16,18
< @@ -489,7 +489,9 @@ static void D3DXCreateSphereTest(void)
---
> @@ -487,6 +487,9 @@ static void D3DXCreateSphereTest(void)
>      IDirect3DDevice9* device;
>      D3DPRESENT_PARAMETERS d3dpp;
18,23c20,22
<      DWORD number_of_vertices;
<      IDirect3DVertexBuffer9* vertex_buffer = NULL;
< -    BYTE* vertex_data = NULL;
< +    D3DVERTEXBUFFER_DESC vertex_buffer_description;
< +    D3DXVECTOR3* vertex_data = NULL;
< +    int expected;
---
> +    DWORD number_of_vertices;
> +    IDirect3DVertexBuffer9* vertex_buffer = NULL;
> +    BYTE* vertex_data = NULL;
27c26,27
< @@ -545,6 +547,20 @@ static void D3DXCreateSphereTest(void)
---
> @@ -533,7 +536,26 @@ static void D3DXCreateSphereTest(void)
>      todo_wine ok( hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n",hr);
29,31c29,40
<          if (vertex_buffer)
<          {
< +            hr = IDirect3DVertexBuffer9_GetDesc(vertex_buffer, &vertex_buffer_description);
---
>      if (sphere)
> +    {
> +        number_of_vertices = sphere->lpVtbl->GetNumVertices(sphere);
> +        todo_wine ok( number_of_vertices == 4, "Got result %u, expected 4\n",number_of_vertices);
> +
> +        hr = sphere->lpVtbl->GetVertexBuffer(sphere, &vertex_buffer);
> +        todo_wine ok( hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n",hr);
> +
> +        if (vertex_buffer)
> +        {
> +            /* Specify offset and size to avoid potential overruns */
> +            hr = IDirect3DVertexBuffer9_Lock(vertex_buffer, 0, number_of_vertices * sizeof(D3DXVECTOR3) * 2, (LPVOID *)&vertex_data, D3DLOCK_DISCARD);
34,43c43
< +            if (hr == D3D_OK)
< +            {
< +                todo_wine ok( vertex_buffer_description.Format == D3DFMT_VERTEXDATA, "Got result %x, expected %x (D3DFMT_VERTEXDATA)\n",vertex_buffer_description.Format,D3DFMT_VERTEXDATA);
< +                todo_wine ok( vertex_buffer_description.Type == D3DRTYPE_VERTEXBUFFER, "Got result %x, expected %x (D3DRTYPE_VERTEXBUFFER)\n",vertex_buffer_description.Type,D3DRTYPE_VERTEXBUFFER);
< +                todo_wine ok( vertex_buffer_description.Usage == 0, "Got result %x, expected %x\n",vertex_buffer_description.Usage,0);
< +                todo_wine ok( vertex_buffer_description.Pool == D3DPOOL_MANAGED, "Got result %x, expected %x (D3DPOOL_DEFAULT)\n",vertex_buffer_description.Pool,D3DPOOL_DEFAULT);
< +                expected = number_of_vertices * sizeof(D3DXVECTOR3) * 2;
< +                todo_wine ok( vertex_buffer_description.Size == expected, "Got result %x, expected %x\n",vertex_buffer_description.Size,expected);
< +                todo_wine ok( vertex_buffer_description.FVF == (D3DFVF_XYZ | D3DFVF_NORMAL), "Got result %x, expected %x (D3DFVF_XYZ | D3DFVF_NORMAL)\n",vertex_buffer_description.FVF,D3DFVF_XYZ | D3DFVF_NORMAL);
< +            }
---
> +            IDirect3DVertexBuffer9_Unlock(vertex_buffer);
45,47c45,52
<              /* Specify offset and size to avoid potential overruns */
<              hr = IDirect3DVertexBuffer9_Lock(vertex_buffer, 0, number_of_vertices * sizeof(D3DXVECTOR3) * 2, (LPVOID *)&vertex_data, D3DLOCK_DISCARD);
<              todo_wine ok( hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n",hr);
---
> +            IDirect3DVertexBuffer9_Release(vertex_buffer);
> +        }
> +
>          sphere->lpVtbl->Release(sphere);
> +    }
>  
>      IDirect3DDevice9_Release(device);
>      IDirect3D9_Release(d3d);

--=-ou1xPQ5wtqgvy0dE3mPu--




More information about the wine-devel mailing list