From 92bff1eaf065d84279ca7368bbaafa25c2cf2be9 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Sat, 30 Oct 2010 15:50:25 -0500 Subject: [PATCH 2/6] 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); } -- 1.7.1