gdiplus: Basic parameter check in GdipTransformPoints with tests.

This commit is contained in:
Nikolay Sivov 2008-08-26 01:58:42 +04:00 committed by Alexandre Julliard
parent 960de09ed1
commit c61ece6752
2 changed files with 39 additions and 0 deletions

View File

@ -2887,6 +2887,12 @@ GpStatus WINGDIPAPI GdipGetClip(GpGraphics *graphics, GpRegion *region)
GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space, GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space,
GpCoordinateSpace src_space, GpPointF *points, INT count) GpCoordinateSpace src_space, GpPointF *points, INT count)
{ {
if(!graphics || !points || count <= 0)
return InvalidParameter;
if(graphics->busy)
return ObjectBusy;
FIXME("(%p, %d, %d, %p, %d): stub\n", graphics, dst_space, src_space, points, count); FIXME("(%p, %d, %d, %p, %d): stub\n", graphics, dst_space, src_space, points, count);
return NotImplemented; return NotImplemented;

View File

@ -714,6 +714,8 @@ static void test_Get_Release_DC(void)
status = GdipMultiplyWorldTransform(graphics, m, MatrixOrderPrepend); status = GdipMultiplyWorldTransform(graphics, m, MatrixOrderPrepend);
status = GdipGetClip(graphics, region); status = GdipGetClip(graphics, region);
expect(ObjectBusy, status); status = Ok; expect(ObjectBusy, status); status = Ok;
status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, 5);
expect(ObjectBusy, status); status = Ok;
/* try to delete before release */ /* try to delete before release */
status = GdipDeleteGraphics(graphics); status = GdipDeleteGraphics(graphics);
expect(ObjectBusy, status); expect(ObjectBusy, status);
@ -732,6 +734,36 @@ static void test_Get_Release_DC(void)
ReleaseDC(0, hdc); ReleaseDC(0, hdc);
} }
static void test_transformpoints(void)
{
GpStatus status;
GpGraphics *graphics = NULL;
HDC hdc = GetDC(0);
GpPointF ptf[5];
INT i;
status = GdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
for(i = 0; i < 5; i++){
ptf[i].X = 200.0 + i * 50.0 * (i % 2);
ptf[i].Y = 200.0 + i * 50.0 * !(i % 2);
}
/* NULL arguments */
status = GdipTransformPoints(NULL, CoordinateSpacePage, CoordinateSpaceWorld, NULL, 0);
expect(InvalidParameter, status);
status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, NULL, 0);
expect(InvalidParameter, status);
status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, 0);
expect(InvalidParameter, status);
status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, -1);
expect(InvalidParameter, status);
GdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
START_TEST(graphics) START_TEST(graphics)
{ {
struct GdiplusStartupInput gdiplusStartupInput; struct GdiplusStartupInput gdiplusStartupInput;
@ -752,6 +784,7 @@ START_TEST(graphics)
test_GdipDrawLineI(); test_GdipDrawLineI();
test_GdipDrawLinesI(); test_GdipDrawLinesI();
test_Get_Release_DC(); test_Get_Release_DC();
test_transformpoints();
GdiplusShutdown(gdiplusToken); GdiplusShutdown(gdiplusToken);
} }