Commit 4fff9a7a authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Add a test for GdipCreateMatrix3.

parent bb444e81
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "wine/test.h" #include "wine/test.h"
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) #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) static void test_constructor_destructor(void)
{ {
...@@ -220,6 +221,87 @@ static void test_shear(void) ...@@ -220,6 +221,87 @@ static void test_shear(void)
GdipDeleteMatrix(matrix); 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) START_TEST(matrix)
{ {
struct GdiplusStartupInput gdiplusStartupInput; struct GdiplusStartupInput gdiplusStartupInput;
...@@ -237,6 +319,7 @@ START_TEST(matrix) ...@@ -237,6 +319,7 @@ START_TEST(matrix)
test_isinvertible(); test_isinvertible();
test_invert(); test_invert();
test_shear(); test_shear();
test_constructor3();
GdiplusShutdown(gdiplusToken); GdiplusShutdown(gdiplusToken);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment