gdiplus: Implemented GdipIsEmptyRegion with tests.

This commit is contained in:
Nikolay Sivov 2008-08-27 23:30:55 +04:00 committed by Alexandre Julliard
parent 26cb843130
commit fb57a66378
2 changed files with 52 additions and 2 deletions

View File

@ -735,9 +735,14 @@ GpStatus WINGDIPAPI GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HR
GpStatus WINGDIPAPI GdipIsEmptyRegion(GpRegion *region, GpGraphics *graphics, BOOL *res)
{
FIXME("(%p, %p, %p): stub\n", region, graphics, res);
TRACE("(%p, %p, %p)\n", region, graphics, res);
return NotImplemented;
if(!region || !graphics || !res)
return InvalidParameter;
*res = (region->node.type == RegionDataEmptyRect);
return Ok;
}
GpStatus WINGDIPAPI GdipIsEqualRegion(GpRegion *region, GpRegion *region2, GpGraphics *graphics,

View File

@ -506,6 +506,50 @@ static void test_isinfinite(void)
GdipDeleteMatrix(m);
GdipDeleteRegion(region);
GdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
static void test_isempty(void)
{
GpStatus status;
GpRegion *region;
GpGraphics *graphics = NULL;
HDC hdc = GetDC(0);
BOOL res;
status = GdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
GdipCreateRegion(&region);
/* NULL arguments */
status = GdipIsEmptyRegion(NULL, NULL, NULL);
expect(InvalidParameter, status);
status = GdipIsEmptyRegion(region, NULL, NULL);
expect(InvalidParameter, status);
status = GdipIsEmptyRegion(NULL, graphics, NULL);
expect(InvalidParameter, status);
status = GdipIsEmptyRegion(NULL, NULL, &res);
expect(InvalidParameter, status);
status = GdipIsEmptyRegion(region, NULL, &res);
expect(InvalidParameter, status);
/* default is infinite */
res = TRUE;
status = GdipIsEmptyRegion(region, graphics, &res);
expect(Ok, status);
expect(FALSE, res);
status = GdipSetEmpty(region);
expect(Ok, status);
res = FALSE;
status = GdipIsEmptyRegion(region, graphics, &res);
expect(Ok, status);
expect(TRUE, res);
GdipDeleteRegion(region);
GdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@ -523,6 +567,7 @@ START_TEST(region)
test_getregiondata();
test_isinfinite();
test_isempty();
GdiplusShutdown(gdiplusToken);