Nikolay Sivov : gdiplus: Some tests for GdipCreateRegionHrgn added.
Alexandre Julliard
julliard at winehq.org
Mon Oct 20 08:01:06 CDT 2008
Module: wine
Branch: master
Commit: 2fd51e94bdb16b98852018522d5d3d50f8902c28
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2fd51e94bdb16b98852018522d5d3d50f8902c28
Author: Nikolay Sivov <bunglehead at gmail.com>
Date: Sun Oct 19 21:13:23 2008 +0400
gdiplus: Some tests for GdipCreateRegionHrgn added.
---
dlls/gdiplus/region.c | 3 +
dlls/gdiplus/tests/region.c | 93 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 96 insertions(+), 0 deletions(-)
diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c
index 90aaf9e..1cda0b7 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -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;
}
diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c
index 63d0086..d2477ce 100644
--- a/dlls/gdiplus/tests/region.c
+++ b/dlls/gdiplus/tests/region.c
@@ -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, ®ion);
+ expect(InvalidParameter, status);
+ status = GdipCreateRegionHrgn((HRGN)0xdeadbeef, ®ion);
+ todo_wine expect(InvalidParameter, status);
+
+ /* rectangle */
+ hrgn = CreateRectRgn(0, 0, 100, 10);
+ status = GdipCreateRegionHrgn(hrgn, ®ion);
+ 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, ®ion);
+ 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);
More information about the wine-cvs
mailing list