[2/2] d3dx9_36/tests: Add tests for D3DXCreatePolygon.

Matteo Bruni matteo.mystral at gmail.com
Mon Nov 3 11:57:30 CST 2014


2014-11-03 6:35 GMT+01:00 Sebastian Lackner <sebastian at fds-team.de>:
> Based on a patch by David Adam.
>
> ---
>  dlls/d3dx9_36/tests/mesh.c | 154 +++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 154 insertions(+)

More nitpicks...

+static BOOL compute_polygon(struct mesh *mesh, float length, UINT sides)

I'd prefer a plain unsigned int there.

The various comments I made for the implementation patch obviously
apply to the body of compute_polygon() too.

+    IDirect3D9* d3d;
+    IDirect3DDevice9* device;
+    D3DPRESENT_PARAMETERS d3dpp;
+    ID3DXMesh* polygon;
+    ID3DXBuffer* ppBuffer;

Watch out for the '*' placement. Also, no hungarian notation please.

+    hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, wnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp,
&device);

Not sure we care but the other tests in mesh.c use
D3DCREATE_SOFTWARE_VERTEXPROCESSING.

+    ok(buffer_size == 33 * sizeof(DWORD), "expected size %d, received %d\n",
+       33 * sizeof(DWORD), buffer_size);

I think it's usually better not to print sizeof() results.

+        ok(buffer[i][1] == -1, "wrong adjacency[%d][1] = %d\n", i,
buffer[i][1]);

I'd prefer ~0 here. Also, unsigned int should be printed with "%u".

+    if (ppBuffer) ID3DXBuffer_Release(ppBuffer);

Please put the "if" body on a separate line.

I'd like to see an additional test to check whether the ID3DXMesh
pointer is set to NULL on D3DXCreatePolygon() failure. Probably you
could simply modify (at least) one of the failure tests at the
beginning for that.



More information about the wine-devel mailing list