d3dx9/tests: Fix a normal comparison for triangles with zero area.

Dylan Smith dylan.ah.smith at gmail.com
Thu May 19 17:35:02 CDT 2011

The mesh returned by D3DXCreateText can contain triangles without area,
so the normal can't be properly computed for comparison, and the tests
falsely compare with a zero vector. Wine's implementation of the function
uses a hard coded value for front and back faces, so doesn't suffer from
this problem.

Differences in the Arial font used probably was the reason the tests passed
on some machines and failed on others.
 dlls/d3dx9_36/tests/mesh.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index 5367745..c8853cd 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -2785,7 +2785,7 @@ static void compare_text_outline_mesh(const char *name, ID3DXMesh *d3dxmesh, str
             D3DXVec3Subtract(&v2, vtx3, vtx2);
             D3DXVec3Cross(&normal, &v1, &v2);
             D3DXVec3Normalize(&normal, &normal);
-            ok(compare_vec3(normal, forward),
+            ok(!D3DXVec3Length(&normal) || compare_vec3(normal, forward),
                "Test %s, glyph %d, face %d normal, result (%g, %g, %g), expected (%g, %g, %g)\n", name, i, face_idx1,
                normal.x, normal.y, normal.z, forward.x, forward.y, forward.z);

More information about the wine-patches mailing list