Commit f49d56fe authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Add tests for GdipGetLineTransform.

parent 3e86d430
......@@ -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)
......
......@@ -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,
......
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