Vincent Povirk : gdiplus: Add tests for GdipGetLineTransform.

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


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

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

gdiplus: Add tests for GdipGetLineTransform.

---

 dlls/gdiplus/tests/brush.c |   91 ++++++++++++++++++++++++++++++++++++++++++++
 include/gdiplusflat.h      |    1 +
 2 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/dlls/gdiplus/tests/brush.c b/dlls/gdiplus/tests/brush.c
index 648a1d3..655d80c 100644
--- a/dlls/gdiplus/tests/brush.c
+++ b/dlls/gdiplus/tests/brush.c
@@ -286,10 +286,15 @@ static void test_texturewrap(void)
 static void test_gradientgetrect(void)
 {
     GpLineGradient *brush;
+    GpMatrix *transform;
+    REAL elements[6];
     GpRectF rectf;
     GpStatus status;
     GpPointF pt1, pt2;
 
+    status = GdipCreateMatrix(&transform);
+    expect(Ok, status);
+
     pt1.X = pt1.Y = 1.0;
     pt2.X = pt2.Y = 100.0;
     status = GdipCreateLineBrush(&pt1, &pt2, 0, 0, WrapModeTile, &brush);
@@ -301,6 +306,18 @@ static void test_gradientgetrect(void)
     expectf(1.0, rectf.Y);
     expectf(99.0, rectf.Width);
     expectf(99.0, rectf.Height);
+    status = GdipGetLineTransform(brush, transform);
+    todo_wine expect(Ok, status);
+    if (status == Ok)
+    {
+        status = GdipGetMatrixElements(transform, elements);
+        expectf(1.0, elements[0]);
+        expectf(1.0, elements[1]);
+        expectf(-1.0, elements[2]);
+        expectf(1.0, elements[3]);
+        expectf(50.50, elements[4]);
+        expectf(-50.50, elements[5]);
+    }
     status = GdipDeleteBrush((GpBrush*)brush);
     /* vertical gradient */
     pt1.X = pt1.Y = pt2.X = 0.0;
@@ -314,6 +331,18 @@ static void test_gradientgetrect(void)
     expectf(0.0, rectf.Y);
     expectf(10.0, rectf.Width);
     expectf(10.0, rectf.Height);
+    status = GdipGetLineTransform(brush, transform);
+    todo_wine expect(Ok, status);
+    if (status == Ok)
+    {
+        status = GdipGetMatrixElements(transform, elements);
+        expectf(0.0, elements[0]);
+        expectf(1.0, elements[1]);
+        expectf(-1.0, elements[2]);
+        expectf(0.0, elements[3]);
+        expectf(5.0, elements[4]);
+        expectf(5.0, elements[5]);
+    }
     status = GdipDeleteBrush((GpBrush*)brush);
     /* horizontal gradient */
     pt1.X = pt1.Y = pt2.Y = 0.0;
@@ -327,6 +356,18 @@ static void test_gradientgetrect(void)
     expectf(-5.0, rectf.Y);
     expectf(10.0, rectf.Width);
     expectf(10.0, rectf.Height);
+    status = GdipGetLineTransform(brush, transform);
+    todo_wine expect(Ok, status);
+    if (status == Ok)
+    {
+        status = GdipGetMatrixElements(transform, elements);
+        expectf(1.0, elements[0]);
+        expectf(0.0, elements[1]);
+        expectf(0.0, elements[2]);
+        expectf(1.0, elements[3]);
+        expectf(0.0, elements[4]);
+        expectf(0.0, elements[5]);
+    }
     status = GdipDeleteBrush((GpBrush*)brush);
     /* slope = -1 */
     pt1.X = pt1.Y = 0.0;
@@ -341,6 +382,18 @@ static void test_gradientgetrect(void)
     expectf(-20.0, rectf.Y);
     expectf(20.0, rectf.Width);
     expectf(20.0, rectf.Height);
+    status = GdipGetLineTransform(brush, transform);
+    todo_wine expect(Ok, status);
+    if (status == Ok)
+    {
+        status = GdipGetMatrixElements(transform, elements);
+        expectf(1.0, elements[0]);
+        expectf(-1.0, elements[1]);
+        expectf(1.0, elements[2]);
+        expectf(1.0, elements[3]);
+        expectf(10.0, elements[4]);
+        expectf(10.0, elements[5]);
+    }
     status = GdipDeleteBrush((GpBrush*)brush);
     /* slope = 1/100 */
     pt1.X = pt1.Y = 0.0;
@@ -355,6 +408,18 @@ static void test_gradientgetrect(void)
     expectf(0.0, rectf.Y);
     expectf(100.0, rectf.Width);
     expectf(1.0, rectf.Height);
+    status = GdipGetLineTransform(brush, transform);
+    todo_wine expect(Ok, status);
+    if (status == Ok)
+    {
+        status = GdipGetMatrixElements(transform, elements);
+        expectf(1.0, elements[0]);
+        expectf(0.01, elements[1]);
+        expectf(-0.02, elements[2]);
+        /* expectf(2.0, elements[3]); */
+        expectf(0.01, elements[4]);
+        /* expectf(-1.0, elements[5]); */
+    }
     status = GdipDeleteBrush((GpBrush*)brush);
     /* zero height rect */
     rectf.X = rectf.Y = 10.0;
@@ -383,6 +448,18 @@ static void test_gradientgetrect(void)
     expectf(10.0, rectf.Y);
     expectf(100.0, rectf.Width);
     expectf(100.0, rectf.Height);
+    status = GdipGetLineTransform(brush, transform);
+    todo_wine expect(Ok, status);
+    if (status == Ok)
+    {
+        status = GdipGetMatrixElements(transform, elements);
+        expectf(1.0, elements[0]);
+        expectf(0.0, elements[1]);
+        expectf(0.0, elements[2]);
+        expectf(1.0, elements[3]);
+        expectf(0.0, elements[4]);
+        expectf(0.0, elements[5]);
+    }
     status = GdipDeleteBrush((GpBrush*)brush);
     /* passing negative Width/Height to LinearGradientModeHorizontal */
     rectf.X = rectf.Y = 10.0;
@@ -397,7 +474,21 @@ static void test_gradientgetrect(void)
     expectf(10.0, rectf.Y);
     expectf(-100.0, rectf.Width);
     expectf(-100.0, rectf.Height);
+    status = GdipGetLineTransform(brush, transform);
+    todo_wine expect(Ok, status);
+    if (status == Ok)
+    {
+        status = GdipGetMatrixElements(transform, elements);
+        expectf(1.0, elements[0]);
+        expectf(0.0, elements[1]);
+        expectf(0.0, elements[2]);
+        expectf(1.0, elements[3]);
+        expectf(0.0, elements[4]);
+        expectf(0.0, elements[5]);
+    }
     status = GdipDeleteBrush((GpBrush*)brush);
+
+    GdipDeleteMatrix(transform);
 }
 
 static void test_lineblend(void)
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 1a443f9..b12909c 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -474,6 +474,7 @@ GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient*,GDIPCONST ARGB*,
     GDIPCONST REAL*,INT);
 GpStatus WINGDIPAPI GdipGetLinePresetBlend(GpLineGradient*,ARGB*,REAL*,INT);
 GpStatus WINGDIPAPI GdipGetLinePresetBlendCount(GpLineGradient*,INT*);
+GpStatus WINGDIPAPI GdipGetLineTransform(GpLineGradient*,GpMatrix*);
 GpStatus WINGDIPAPI GdipResetLineTransform(GpLineGradient*);
 GpStatus WINGDIPAPI GdipRotateLineTransform(GpLineGradient*,REAL,GpMatrixOrder);
 GpStatus WINGDIPAPI GdipScaleLineTransform(GpLineGradient*,REAL,REAL,




More information about the wine-cvs mailing list