Commit 1e67fcce authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Add test for creating a metafile with NULL frameRect.

parent 18e65a95
......@@ -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();
......
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