gdiplus: Add GdipCreateLineBrushFromRectWithAngle tests.
Signed-off-by: Hugh Bellamy <hughbellars@gmail.com> Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c3252c3774
commit
b8f56c0b86
|
@ -481,9 +481,12 @@ GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect
|
||||||
TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
|
TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
|
||||||
wrap, line);
|
wrap, line);
|
||||||
|
|
||||||
if (!rect || !rect->Width || !rect->Height)
|
if (!rect || !line || wrap == WrapModeClamp)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
|
if (!rect->Width || !rect->Height)
|
||||||
|
return OutOfMemory;
|
||||||
|
|
||||||
angle = fmodf(angle, 360);
|
angle = fmodf(angle, 360);
|
||||||
if (angle < 0)
|
if (angle < 0)
|
||||||
angle += 360;
|
angle += 360;
|
||||||
|
|
|
@ -72,6 +72,68 @@ static void test_createHatchBrush(void)
|
||||||
expect(InvalidParameter, status);
|
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)
|
static void test_type(void)
|
||||||
{
|
{
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
|
@ -1612,6 +1674,7 @@ START_TEST(brush)
|
||||||
|
|
||||||
test_constructor_destructor();
|
test_constructor_destructor();
|
||||||
test_createHatchBrush();
|
test_createHatchBrush();
|
||||||
|
test_createLineBrushFromRectWithAngle();
|
||||||
test_type();
|
test_type();
|
||||||
test_gradientblendcount();
|
test_gradientblendcount();
|
||||||
test_getblend();
|
test_getblend();
|
||||||
|
|
Loading…
Reference in New Issue