gdiplus: Implemented GdipIsInfiniteRegion with tests.

This commit is contained in:
Nikolay Sivov 2008-08-26 01:58:49 +04:00 committed by Alexandre Julliard
parent 32ac2d1909
commit 078c6a3925
3 changed files with 61 additions and 4 deletions

View File

@ -770,11 +770,17 @@ GpStatus WINGDIPAPI GdipIsEqualRegion(GpRegion *region, GpRegion *region2, GpGra
return NotImplemented; return NotImplemented;
} }
/* I think graphics is ignored here */
GpStatus WINGDIPAPI GdipIsInfiniteRegion(GpRegion *region, GpGraphics *graphics, BOOL *res) GpStatus WINGDIPAPI GdipIsInfiniteRegion(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 == RegionDataInfiniteRect);
return Ok;
} }
GpStatus WINGDIPAPI GdipSetEmpty(GpRegion *region) GpStatus WINGDIPAPI GdipSetEmpty(GpRegion *region)

View File

@ -770,12 +770,16 @@ static void test_getclip(void)
GpGraphics *graphics = NULL; GpGraphics *graphics = NULL;
HDC hdc = GetDC(0); HDC hdc = GetDC(0);
GpRegion *clip; GpRegion *clip;
GpRectF rect;
BOOL res; BOOL res;
status = GdipCreateFromHDC(hdc, &graphics); status = GdipCreateFromHDC(hdc, &graphics);
expect(Ok, status); expect(Ok, status);
status = GdipCreateRegion(&clip); rect.X = rect.Y = 0.0;
rect.Height = rect.Width = 100.0;
status = GdipCreateRegionRect(&rect, &clip);
/* NULL arguments */ /* NULL arguments */
status = GdipGetClip(NULL, NULL); status = GdipGetClip(NULL, NULL);
@ -789,7 +793,7 @@ static void test_getclip(void)
status = GdipGetClip(graphics, clip); status = GdipGetClip(graphics, clip);
todo_wine expect(Ok, status); todo_wine expect(Ok, status);
status = GdipIsInfiniteRegion(clip, graphics, &res); status = GdipIsInfiniteRegion(clip, graphics, &res);
todo_wine expect(Ok, status); expect(Ok, status);
todo_wine expect(TRUE, res); todo_wine expect(TRUE, res);
GdipDeleteRegion(clip); GdipDeleteRegion(clip);

View File

@ -463,6 +463,52 @@ static void test_getregiondata(void)
expect(Ok, status); expect(Ok, status);
} }
static void test_isinfinite(void)
{
GpStatus status;
GpRegion *region;
GpGraphics *graphics = NULL;
GpMatrix *m;
HDC hdc = GetDC(0);
BOOL res;
status = GdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
GdipCreateRegion(&region);
GdipCreateMatrix2(3.0, 0.0, 0.0, 1.0, 20.0, 30.0, &m);
/* NULL arguments */
status = GdipIsInfiniteRegion(NULL, NULL, NULL);
expect(InvalidParameter, status);
status = GdipIsInfiniteRegion(region, NULL, NULL);
expect(InvalidParameter, status);
status = GdipIsInfiniteRegion(NULL, graphics, NULL);
expect(InvalidParameter, status);
status = GdipIsInfiniteRegion(NULL, NULL, &res);
expect(InvalidParameter, status);
status = GdipIsInfiniteRegion(region, NULL, &res);
expect(InvalidParameter, status);
res = FALSE;
status = GdipIsInfiniteRegion(region, graphics, &res);
expect(Ok, status);
expect(TRUE, res);
/* after world transform */
status = GdipSetWorldTransform(graphics, m);
expect(Ok, status);
res = FALSE;
status = GdipIsInfiniteRegion(region, graphics, &res);
expect(Ok, status);
expect(TRUE, res);
GdipDeleteMatrix(m);
GdipDeleteRegion(region);
ReleaseDC(0, hdc);
}
START_TEST(region) START_TEST(region)
{ {
struct GdiplusStartupInput gdiplusStartupInput; struct GdiplusStartupInput gdiplusStartupInput;
@ -476,6 +522,7 @@ START_TEST(region)
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_getregiondata(); test_getregiondata();
test_isinfinite();
GdiplusShutdown(gdiplusToken); GdiplusShutdown(gdiplusToken);