Hugh Bellamy : gdiplus: Add GdipCreateLineBrushFromRectWithAngle tests.
Alexandre Julliard
julliard at winehq.org
Thu Sep 21 15:01:00 CDT 2017
Module: wine
Branch: master
Commit: b8f56c0b8641706c003fc84106243fb759283939
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b8f56c0b8641706c003fc84106243fb759283939
Author: Hugh Bellamy <hughbellars at gmail.com>
Date: Wed Sep 20 17:42:31 2017 +0100
gdiplus: Add GdipCreateLineBrushFromRectWithAngle tests.
Signed-off-by: Hugh Bellamy <hughbellars at gmail.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdiplus/brush.c | 5 +++-
dlls/gdiplus/tests/brush.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c
index d5cd94a..26e3419 100644
--- a/dlls/gdiplus/brush.c
+++ b/dlls/gdiplus/brush.c
@@ -481,9 +481,12 @@ GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect
TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
wrap, line);
- if (!rect || !rect->Width || !rect->Height)
+ if (!rect || !line || wrap == WrapModeClamp)
return InvalidParameter;
+ if (!rect->Width || !rect->Height)
+ return OutOfMemory;
+
angle = fmodf(angle, 360);
if (angle < 0)
angle += 360;
diff --git a/dlls/gdiplus/tests/brush.c b/dlls/gdiplus/tests/brush.c
index 45b2710..9be500d 100644
--- a/dlls/gdiplus/tests/brush.c
+++ b/dlls/gdiplus/tests/brush.c
@@ -72,6 +72,68 @@ static void test_createHatchBrush(void)
expect(InvalidParameter, status);
}
+static void test_createLineBrushFromRectWithAngle(void)
+{
+ GpStatus status;
+ GpLineGradient *brush;
+ GpRectF rect1 = { 1, 3, 1, 2 };
+ GpRectF rect2 = { 1, 3, -1, -2 };
+ GpRectF rect3 = { 1, 3, 0, 1 };
+ GpRectF rect4 = { 1, 3, 1, 0 };
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect1, 10, 11, 0, TRUE, WrapModeTile, &brush);
+ expect(Ok, status);
+ GdipDeleteBrush((GpBrush *) brush);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect2, 10, 11, 135, TRUE, (WrapMode)(WrapModeTile - 1), &brush);
+ expect(Ok, status);
+ GdipDeleteBrush((GpBrush *) brush);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect2, 10, 11, -225, FALSE, (WrapMode)(WrapModeTile - 1), &brush);
+ expect(Ok, status);
+ GdipDeleteBrush((GpBrush *) brush);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect1, 10, 11, 405, TRUE, (WrapMode)(WrapModeClamp + 1), &brush);
+ expect(Ok, status);
+ GdipDeleteBrush((GpBrush *) brush);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect1, 10, 11, 45, FALSE, (WrapMode)(WrapModeClamp + 1), &brush);
+ expect(Ok, status);
+ GdipDeleteBrush((GpBrush *) brush);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect1, 10, 11, 90, TRUE, WrapModeTileFlipX, &brush);
+ expect(Ok, status);
+
+ status = GdipCreateLineBrushFromRectWithAngle(NULL, 10, 11, 90, TRUE, WrapModeTile, &brush);
+ expect(InvalidParameter, status);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect3, 10, 11, 90, TRUE, WrapModeTileFlipXY, &brush);
+ expect(OutOfMemory, status);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect4, 10, 11, 90, TRUE, WrapModeTileFlipXY, &brush);
+ expect(OutOfMemory, status);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect3, 10, 11, 90, TRUE, WrapModeTileFlipXY, NULL);
+ expect(InvalidParameter, status);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect4, 10, 11, 90, TRUE, WrapModeTileFlipXY, NULL);
+ expect(InvalidParameter, status);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect3, 10, 11, 90, TRUE, WrapModeClamp, &brush);
+ expect(InvalidParameter, status);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect4, 10, 11, 90, TRUE, WrapModeClamp, &brush);
+ expect(InvalidParameter, status);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect1, 10, 11, 90, TRUE, WrapModeClamp, &brush);
+ expect(InvalidParameter, status);
+
+ status = GdipCreateLineBrushFromRectWithAngle(&rect1, 10, 11, 90, TRUE, WrapModeTile, NULL);
+ expect(InvalidParameter, status);
+
+ GdipDeleteBrush((GpBrush *) brush);
+}
+
static void test_type(void)
{
GpStatus status;
@@ -1612,6 +1674,7 @@ START_TEST(brush)
test_constructor_destructor();
test_createHatchBrush();
+ test_createLineBrushFromRectWithAngle();
test_type();
test_gradientblendcount();
test_getblend();
More information about the wine-cvs
mailing list