Module: wine
Branch: master
Commit: a06b4bc59b9da73505b18d55e5dcc2f272f3702a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a06b4bc59b9da73505b18d55e…
Author: Vincent Povirk <vincent(a)codeweavers.com>
Date: Wed Jan 26 17:23:44 2011 -0600
gdiplus: Test for EMF+ recording.
---
dlls/gdiplus/tests/Makefile.in | 1 +
dlls/gdiplus/tests/metafile.c | 89 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 90 insertions(+), 0 deletions(-)
diff --git a/dlls/gdiplus/tests/Makefile.in b/dlls/gdiplus/tests/Makefile.in
index 6a04778..1538eb0 100644
--- a/dlls/gdiplus/tests/Makefile.in
+++ b/dlls/gdiplus/tests/Makefile.in
@@ -9,6 +9,7 @@ C_SRCS = \
graphicspath.c \
image.c \
matrix.c \
+ metafile.c \
pathiterator.c \
pen.c \
region.c \
diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c
new file mode 100644
index 0000000..8d0adc9
--- /dev/null
+++ b/dlls/gdiplus/tests/metafile.c
@@ -0,0 +1,89 @@
+/*
+ * Unit test suite for metafiles
+ *
+ * Copyright (C) 2011 Vincent Povirk for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "windows.h"
+#include <stdio.h>
+#include "gdiplus.h"
+#include "wine/test.h"
+
+#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
+
+static void test_empty(void)
+{
+ GpStatus stat;
+ GpMetafile *metafile;
+ GpGraphics *graphics;
+ HDC hdc;
+ HENHMETAFILE hemf, dummy;
+ BOOL ret;
+ static const GpRectF frame = {0.0, 0.0, 100.0, 100.0};
+ static const WCHAR description[] = {'w','i','n','e','t','e','s','t',0};
+
+ hdc = CreateCompatibleDC(0);
+
+ stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitPixel, description, &metafile);
+ todo_wine expect(Ok, stat);
+
+ DeleteDC(hdc);
+
+ if (stat != Ok)
+ return;
+
+ stat = GdipGetHemfFromMetafile(metafile, &hemf);
+ expect(InvalidParameter, stat);
+
+ stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics);
+ expect(Ok, stat);
+
+ stat = GdipGetHemfFromMetafile(metafile, &hemf);
+ expect(InvalidParameter, stat);
+
+ stat = GdipDeleteGraphics(graphics);
+ expect(Ok, stat);
+
+ stat = GdipGetHemfFromMetafile(metafile, &hemf);
+ expect(Ok, stat);
+
+ stat = GdipGetHemfFromMetafile(metafile, &dummy);
+ expect(InvalidParameter, stat);
+
+ stat = GdipDisposeImage((GpImage*)metafile);
+ expect(Ok, stat);
+
+ ret = DeleteEnhMetaFile(hemf);
+ ok(ret != 0, "Failed to delete enhmetafile %p\n", hemf);
+}
+
+START_TEST(metafile)
+{
+ struct GdiplusStartupInput gdiplusStartupInput;
+ ULONG_PTR gdiplusToken;
+
+ gdiplusStartupInput.GdiplusVersion = 1;
+ gdiplusStartupInput.DebugEventCallback = NULL;
+ gdiplusStartupInput.SuppressBackgroundThread = 0;
+ gdiplusStartupInput.SuppressExternalCodecs = 0;
+
+ GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+
+ test_empty();
+
+ GdiplusShutdown(gdiplusToken);
+}