[2/4] gdiplus: basic parameter check in GdipTransformPoints with tests
Nikolay Sivov
bunglehead at gmail.com
Mon Aug 25 16:58:42 CDT 2008
Changelog:
- Add a basic parameter check in GdipTransformPoints with tests
---
dlls/gdiplus/graphics.c | 6 ++++++
dlls/gdiplus/tests/graphics.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index ef2aff7..bf3a638 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -2887,6 +2887,12 @@ GpStatus WINGDIPAPI GdipGetClip(GpGraphics *graphics, GpRegion *region)
GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space,
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);
return NotImplemented;
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 9770211..10f0e79 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -714,6 +714,8 @@ static void test_Get_Release_DC(void)
status = GdipMultiplyWorldTransform(graphics, m, MatrixOrderPrepend);
status = GdipGetClip(graphics, region);
expect(ObjectBusy, status); status = Ok;
+ status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, 5);
+ expect(ObjectBusy, status); status = Ok;
/* try to delete before release */
status = GdipDeleteGraphics(graphics);
expect(ObjectBusy, status);
@@ -732,6 +734,36 @@ static void test_Get_Release_DC(void)
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)
{
struct GdiplusStartupInput gdiplusStartupInput;
@@ -752,6 +784,7 @@ START_TEST(graphics)
test_GdipDrawLineI();
test_GdipDrawLinesI();
test_Get_Release_DC();
+ test_transformpoints();
GdiplusShutdown(gdiplusToken);
}
--
1.4.4.4
More information about the wine-patches
mailing list