diff --git a/rostests/winetests/gdiplus/graphicspath.c b/rostests/winetests/gdiplus/graphicspath.c index 3508de93b72..c28c6278b5d 100644 --- a/rostests/winetests/gdiplus/graphicspath.c +++ b/rostests/winetests/gdiplus/graphicspath.c @@ -1018,6 +1018,9 @@ static void test_flatten(void) status = GdipFlattenPath(path, NULL, 1.0); expect(Ok, status); + status = GdipTransformPath(path, 0); + expect(Ok, status); + status = GdipAddPathEllipse(path, 0.0, 0.0, 100.0, 50.0); expect(Ok, status); diff --git a/rostests/winetests/gdiplus/image.c b/rostests/winetests/gdiplus/image.c index 4f393683a76..0d1d6a6f59a 100644 --- a/rostests/winetests/gdiplus/image.c +++ b/rostests/winetests/gdiplus/image.c @@ -1466,36 +1466,36 @@ static void test_loadwmf(void) stat = GdipGetImageBounds(img, &bounds, &unit); expect(Ok, stat); - todo_wine expect(UnitPixel, unit); + expect(UnitPixel, unit); expectf(0.0, bounds.X); expectf(0.0, bounds.Y); - todo_wine expectf(320.0, bounds.Width); - todo_wine expectf(320.0, bounds.Height); + expectf(320.0, bounds.Width); + expectf(320.0, bounds.Height); stat = GdipGetImageHorizontalResolution(img, &res); expect(Ok, stat); - todo_wine expectf(1440.0, res); + expectf(1440.0, res); stat = GdipGetImageVerticalResolution(img, &res); expect(Ok, stat); - todo_wine expectf(1440.0, res); + expectf(1440.0, res); memset(&header, 0, sizeof(header)); stat = GdipGetMetafileHeaderFromMetafile((GpMetafile*)img, &header); expect(Ok, stat); if (stat == Ok) { - todo_wine expect(MetafileTypeWmfPlaceable, header.Type); + expect(MetafileTypeWmfPlaceable, header.Type); todo_wine expect(sizeof(wmfimage)-sizeof(WmfPlaceableFileHeader), header.Size); todo_wine expect(0x300, header.Version); expect(0, header.EmfPlusFlags); - todo_wine expectf(1440.0, header.DpiX); - todo_wine expectf(1440.0, header.DpiY); + expectf(1440.0, header.DpiX); + expectf(1440.0, header.DpiY); expect(0, header.X); expect(0, header.Y); - todo_wine expect(320, header.Width); - todo_wine expect(320, header.Height); - todo_wine expect(1, U(header).WmfHeader.mtType); + expect(320, header.Width); + expect(320, header.Height); + expect(1, U(header).WmfHeader.mtType); expect(0, header.EmfPlusHeaderSize); expect(0, header.LogicalDpiX); expect(0, header.LogicalDpiY); @@ -1543,17 +1543,17 @@ static void test_createfromwmf(void) expect(Ok, stat); if (stat == Ok) { - todo_wine expect(MetafileTypeWmfPlaceable, header.Type); + expect(MetafileTypeWmfPlaceable, header.Type); todo_wine expect(sizeof(wmfimage)-sizeof(WmfPlaceableFileHeader), header.Size); todo_wine expect(0x300, header.Version); expect(0, header.EmfPlusFlags); - todo_wine expectf(1440.0, header.DpiX); - todo_wine expectf(1440.0, header.DpiY); + expectf(1440.0, header.DpiX); + expectf(1440.0, header.DpiY); expect(0, header.X); expect(0, header.Y); - todo_wine expect(320, header.Width); - todo_wine expect(320, header.Height); - todo_wine expect(1, U(header).WmfHeader.mtType); + expect(320, header.Width); + expect(320, header.Height); + expect(1, U(header).WmfHeader.mtType); expect(0, header.EmfPlusHeaderSize); expect(0, header.LogicalDpiX); expect(0, header.LogicalDpiY); diff --git a/rostests/winetests/gdiplus/metafile.c b/rostests/winetests/gdiplus/metafile.c index e7a109de3c2..13b9db88ea7 100644 --- a/rostests/winetests/gdiplus/metafile.c +++ b/rostests/winetests/gdiplus/metafile.c @@ -867,6 +867,117 @@ static void test_fillrect(void) expect(Ok, stat); } +static void test_nullframerect(void) { + GpStatus stat; + GpMetafile *metafile; + GpGraphics *graphics; + HDC hdc, metafile_dc; + static const WCHAR description[] = {'w','i','n','e','t','e','s','t',0}; + GpBrush *brush; + HBRUSH hbrush, holdbrush; + GpRectF bounds; + GpUnit unit; + + hdc = CreateCompatibleDC(0); + + stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, NULL, MetafileFrameUnitPixel, description, &metafile); + expect(Ok, stat); + + DeleteDC(hdc); + + if (stat != Ok) + return; + + stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit); + expect(Ok, stat); + expect(UnitPixel, unit); + expectf(0.0, bounds.X); + expectf(0.0, bounds.Y); + expectf(1.0, bounds.Width); + expectf(1.0, bounds.Height); + + stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics); + expect(Ok, stat); + + stat = GdipCreateSolidFill((ARGB)0xff0000ff, (GpSolidFill**)&brush); + expect(Ok, stat); + + stat = GdipFillRectangleI(graphics, brush, 25, 25, 75, 75); + expect(Ok, stat); + + stat = GdipDeleteBrush(brush); + expect(Ok, stat); + + stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit); + expect(Ok, stat); + expect(UnitPixel, unit); + expectf(0.0, bounds.X); + expectf(0.0, bounds.Y); + expectf(1.0, bounds.Width); + expectf(1.0, bounds.Height); + + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + + stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit); + expect(Ok, stat); + expect(UnitPixel, unit); + todo_wine expectf_(25.0, bounds.X, 0.05); + todo_wine expectf_(25.0, bounds.Y, 0.05); + todo_wine expectf_(75.0, bounds.Width, 0.05); + todo_wine expectf_(75.0, bounds.Height, 0.05); + + stat = GdipDisposeImage((GpImage*)metafile); + expect(Ok, stat); + + hdc = CreateCompatibleDC(0); + + stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, NULL, MetafileFrameUnitMillimeter, description, &metafile); + expect(Ok, stat); + + DeleteDC(hdc); + + stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics); + expect(Ok, stat); + + stat = GdipGetDC(graphics, &metafile_dc); + expect(Ok, stat); + + if (stat != Ok) + { + GdipDeleteGraphics(graphics); + GdipDisposeImage((GpImage*)metafile); + return; + } + + hbrush = CreateSolidBrush(0xff0000); + + holdbrush = SelectObject(metafile_dc, hbrush); + + Rectangle(metafile_dc, 25, 25, 75, 75); + + SelectObject(metafile_dc, holdbrush); + + DeleteObject(hbrush); + + stat = GdipReleaseDC(graphics, metafile_dc); + expect(Ok, stat); + + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + + stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit); + expect(Ok, stat); + expect(UnitPixel, unit); + expectf_(25.0, bounds.X, 0.05); + expectf_(25.0, bounds.Y, 0.05); + todo_wine expectf_(50.0, bounds.Width, 0.05); + todo_wine expectf_(50.0, bounds.Height, 0.05); + + stat = GdipDisposeImage((GpImage*)metafile); + expect(Ok, stat); +} + static const emfplus_record pagetransform_records[] = { {0, EMR_HEADER}, {0, EmfPlusRecordTypeHeader}, @@ -1146,6 +1257,68 @@ static void test_converttoemfplus(void) expect(Ok, stat); } +static void test_frameunit(void) +{ + GpStatus stat; + GpMetafile *metafile; + GpGraphics *graphics; + HDC hdc; + static const GpRectF frame = {0.0, 0.0, 5.0, 5.0}; + static const WCHAR description[] = {'w','i','n','e','t','e','s','t',0}; + GpUnit unit; + REAL dpix, dpiy; + GpRectF bounds; + + hdc = CreateCompatibleDC(0); + + stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitInch, description, &metafile); + expect(Ok, stat); + + DeleteDC(hdc); + + if (stat != Ok) + return; + + stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit); + expect(Ok, stat); + expect(UnitPixel, unit); + expectf(0.0, bounds.X); + expectf(0.0, bounds.Y); + expectf(1.0, bounds.Width); + expectf(1.0, bounds.Height); + + stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics); + expect(Ok, stat); + + stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit); + expect(Ok, stat); + expect(UnitPixel, unit); + expectf(0.0, bounds.X); + expectf(0.0, bounds.Y); + expectf(1.0, bounds.Width); + expectf(1.0, bounds.Height); + + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + + stat = GdipGetImageHorizontalResolution((GpImage*)metafile, &dpix); + expect(Ok, stat); + + stat = GdipGetImageVerticalResolution((GpImage*)metafile, &dpiy); + expect(Ok, stat); + + stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit); + expect(Ok, stat); + expect(UnitPixel, unit); + expectf(0.0, bounds.X); + expectf(0.0, bounds.Y); + expectf_(5.0 * dpix, bounds.Width, 1.0); + expectf_(5.0 * dpiy, bounds.Height, 1.0); + + stat = GdipDisposeImage((GpImage*)metafile); + expect(Ok, stat); +} + START_TEST(metafile) { struct GdiplusStartupInput gdiplusStartupInput; @@ -1169,8 +1342,10 @@ START_TEST(metafile) test_getdc(); test_emfonly(); test_fillrect(); + test_nullframerect(); test_pagetransform(); test_converttoemfplus(); + test_frameunit(); GdiplusShutdown(gdiplusToken); }