[2/4] gdiplus: Add test for creating a metafile with NULL frameRect.
Vincent Povirk
madewokherd at gmail.com
Wed Apr 6 14:36:56 CDT 2016
From: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
---
dlls/gdiplus/tests/metafile.c | 112 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 112 insertions(+)
diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c
index 086a261..932fe1c 100644
--- a/dlls/gdiplus/tests/metafile.c
+++ b/dlls/gdiplus/tests/metafile.c
@@ -862,6 +862,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);
+ todo_wine 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);
+ expectf_(25.0, bounds.X, 0.05);
+ expectf_(25.0, bounds.Y, 0.05);
+ expectf_(75.0, bounds.Width, 0.05);
+ 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);
+ expectf_(50.0, bounds.Width, 0.05);
+ 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},
@@ -1226,6 +1337,7 @@ START_TEST(metafile)
test_getdc();
test_emfonly();
test_fillrect();
+ test_nullframerect();
test_pagetransform();
test_converttoemfplus();
test_frameunit();
--
2.5.0
More information about the wine-patches
mailing list