Vincent Povirk : gdiplus: Add a test for GdipCreateMatrix3.

Alexandre Julliard julliard at winehq.org
Mon Nov 1 11:54:31 CDT 2010


Module: wine
Branch: master
Commit: 4fff9a7a526ad730144dbda8b8d84bc298d31602
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4fff9a7a526ad730144dbda8b8d84bc298d31602

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Sat Oct 30 15:50:25 2010 -0500

gdiplus: Add a test for GdipCreateMatrix3.

---

 dlls/gdiplus/tests/matrix.c |   83 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 83 insertions(+), 0 deletions(-)

diff --git a/dlls/gdiplus/tests/matrix.c b/dlls/gdiplus/tests/matrix.c
index 16ce85a..b9992c3 100644
--- a/dlls/gdiplus/tests/matrix.c
+++ b/dlls/gdiplus/tests/matrix.c
@@ -26,6 +26,7 @@
 #include "wine/test.h"
 
 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
+#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
 
 static void test_constructor_destructor(void)
 {
@@ -220,6 +221,87 @@ static void test_shear(void)
     GdipDeleteMatrix(matrix);
 }
 
+static void test_constructor3(void)
+{
+    /* MSDN is on crack. GdipCreateMatrix3 makes a matrix that transforms the
+     * corners of the given rectangle to the three points given. */
+    GpMatrix *matrix;
+    REAL values[6];
+    GpRectF rc;
+    GpPointF pt[3];
+    GpStatus stat;
+
+    rc.X = 10;
+    rc.Y = 10;
+    rc.Width = 10;
+    rc.Height = 10;
+
+    pt[0].X = 10;
+    pt[0].Y = 10;
+    pt[1].X = 20;
+    pt[1].Y = 10;
+    pt[2].X = 10;
+    pt[2].Y = 20;
+
+    stat = GdipCreateMatrix3(&rc, pt, &matrix);
+    expect(Ok, stat);
+
+    stat = GdipGetMatrixElements(matrix, values);
+    expect(Ok, stat);
+
+    todo_wine expectf(1.0, values[0]);
+    todo_wine expectf(0.0, values[1]);
+    todo_wine expectf(0.0, values[2]);
+    todo_wine expectf(1.0, values[3]);
+    todo_wine expectf(0.0, values[4]);
+    todo_wine expectf(0.0, values[5]);
+
+    GdipDeleteMatrix(matrix);
+
+    pt[0].X = 20;
+    pt[0].Y = 10;
+    pt[1].X = 40;
+    pt[1].Y = 10;
+    pt[2].X = 20;
+    pt[2].Y = 20;
+
+    stat = GdipCreateMatrix3(&rc, pt, &matrix);
+    expect(Ok, stat);
+
+    stat = GdipGetMatrixElements(matrix, values);
+    expect(Ok, stat);
+
+    todo_wine expectf(2.0, values[0]);
+    todo_wine expectf(0.0, values[1]);
+    todo_wine expectf(0.0, values[2]);
+    todo_wine expectf(1.0, values[3]);
+    todo_wine expectf(0.0, values[4]);
+    todo_wine expectf(0.0, values[5]);
+
+    GdipDeleteMatrix(matrix);
+
+    pt[0].X = 10;
+    pt[0].Y = 20;
+    pt[1].X = 20;
+    pt[1].Y = 30;
+    pt[2].X = 10;
+    pt[2].Y = 30;
+
+    stat = GdipCreateMatrix3(&rc, pt, &matrix);
+    expect(Ok, stat);
+
+    stat = GdipGetMatrixElements(matrix, values);
+    expect(Ok, stat);
+
+    todo_wine expectf(1.0, values[0]);
+    todo_wine expectf(1.0, values[1]);
+    todo_wine expectf(0.0, values[2]);
+    todo_wine expectf(1.0, values[3]);
+    todo_wine expectf(0.0, values[4]);
+    todo_wine expectf(0.0, values[5]);
+
+    GdipDeleteMatrix(matrix);}
+
 START_TEST(matrix)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -237,6 +319,7 @@ START_TEST(matrix)
     test_isinvertible();
     test_invert();
     test_shear();
+    test_constructor3();
 
     GdiplusShutdown(gdiplusToken);
 }




More information about the wine-cvs mailing list