[3/3] gdiplus: make GdipInvertMatrix tests pass on native

Nikolay Sivov bunglehead at gmail.com
Sat Jul 12 11:56:13 CDT 2008


Changelog:
    - Make GdipInvertMatrix test pass on native

---
 dlls/gdiplus/tests/matrix.c |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/dlls/gdiplus/tests/matrix.c b/dlls/gdiplus/tests/matrix.c
index 16c1517..daf61ea 100644
--- a/dlls/gdiplus/tests/matrix.c
+++ b/dlls/gdiplus/tests/matrix.c
@@ -27,6 +27,19 @@
 
 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
 
+/* compare matrix data with some tolerance */
+BOOL m_equalf(REAL *m1, REAL *m2)
+{
+    BOOL ret = TRUE;
+    INT i;
+
+    for(i = 0; i < 6; i++){
+        ret = ret && (fabsf(m1[i] - m2[i]) < 1e-5);
+    }
+
+    return ret;
+}
+
 static void test_constructor_destructor(void)
 {
     GpStatus status;
@@ -119,12 +132,12 @@ static void test_isinvertible(void)
     GdipDeleteMatrix(matrix);
 }
 
+static REAL minverted[] = {1.0/9.0, 2.0/9.0, 4.0/9.0, -1.0/9.0, -2.0, -1.0};
 static void test_invert(void)
 {
     GpStatus status;
     GpMatrix *matrix = NULL;
-    GpMatrix *inverted = NULL;
-    BOOL equal;
+    REAL mdata[6];
 
     /* NULL */
     status = GdipInvertMatrix(NULL);
@@ -141,11 +154,9 @@ static void test_invert(void)
     status = GdipInvertMatrix(matrix);
     expect(Ok, status);
 
-    GdipCreateMatrix2(1.0/9.0, 2.0/9.0, 4.0/9.0, -1.0/9.0, -2.0, -1.0, &inverted);
-    GdipIsMatrixEqual(matrix, inverted, &equal);
-    expect(TRUE, equal);
+    GdipGetMatrixElements(matrix, mdata);
+    expect(TRUE, m_equalf(mdata, minverted));
 
-    GdipDeleteMatrix(inverted);
     GdipDeleteMatrix(matrix);
 }
 
-- 
1.4.4.4






More information about the wine-patches mailing list