Commit 2fd51e94 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdiplus: Some tests for GdipCreateRegionHrgn added.

parent edd24b61
......@@ -573,6 +573,9 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
{
FIXME("(%p, %p): stub\n", hrgn, region);
if(!hrgn || !region)
return InvalidParameter;
*region = NULL;
return NotImplemented;
}
......
......@@ -651,6 +651,98 @@ static void test_combinereplace(void)
GdipDeleteRegion(region);
}
static void test_fromhrgn(void)
{
GpStatus status;
GpRegion *region;
HRGN hrgn;
UINT needed;
DWORD buf[220];
RegionDataPoint *point;
/* NULL */
status = GdipCreateRegionHrgn(NULL, NULL);
expect(InvalidParameter, status);
status = GdipCreateRegionHrgn(NULL, &region);
expect(InvalidParameter, status);
status = GdipCreateRegionHrgn((HRGN)0xdeadbeef, &region);
todo_wine expect(InvalidParameter, status);
/* rectangle */
hrgn = CreateRectRgn(0, 0, 100, 10);
status = GdipCreateRegionHrgn(hrgn, &region);
todo_wine expect(Ok, status);
status = GdipGetRegionDataSize(region, &needed);
todo_wine{
expect(Ok, status);
expect(56, needed);
}
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
todo_wine expect(Ok, status);
if(status == Ok){
todo_wine{
expect(56, needed);
expect_dword(buf, 48);
expect_magic((DWORD*)(buf + 2));
expect_dword(buf + 3, 0);
expect_dword(buf + 4, RGNDATA_PATH);
expect_dword(buf + 5, 0x00000020);
expect_magic((DWORD*)(buf + 6));
expect_dword(buf + 7, 0x00000004);
expect_dword(buf + 8, 0x00006000); /* ?? */
}
point = (RegionDataPoint*)buf + 9;
expect(0, point[0].X);
expect(0, point[0].Y);
todo_wine{
expect(100,point[1].X); /* buf + 10 */
expect(0, point[1].Y);
expect(100,point[2].X); /* buf + 11 */
expect(10, point[2].Y);
}
expect(0, point[3].X); /* buf + 12 */
todo_wine{
expect(10, point[3].Y);
expect_dword(buf + 13, 0x81010100); /* closed */
}
}
GdipDeleteRegion(region);
DeleteObject((HGDIOBJ)hrgn);
/* ellipse */
hrgn = CreateEllipticRgn(0, 0, 100, 10);
status = GdipCreateRegionHrgn(hrgn, &region);
todo_wine expect(Ok, status);
status = GdipGetRegionDataSize(region, &needed);
todo_wine{
expect(Ok, status);
expect(216, needed);
}
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
todo_wine{
expect(Ok, status);
expect(216, needed);
expect_dword(buf, 208);
expect_magic((DWORD*)(buf + 2));
expect_dword(buf + 3, 0);
expect_dword(buf + 4, RGNDATA_PATH);
expect_dword(buf + 5, 0x000000C0);
expect_magic((DWORD*)(buf + 6));
expect_dword(buf + 7, 0x00000024);
expect_dword(buf + 8, 0x00006000); /* ?? */
}
GdipDeleteRegion(region);
DeleteObject((HGDIOBJ)hrgn);
}
START_TEST(region)
{
struct GdiplusStartupInput gdiplusStartupInput;
......@@ -667,6 +759,7 @@ START_TEST(region)
test_isinfinite();
test_isempty();
test_combinereplace();
test_fromhrgn();
GdiplusShutdown(gdiplusToken);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment