[3/3] add GDI+ pen test

Evan Stade estade at gmail.com
Fri Jun 1 19:49:23 CDT 2007


Hi,

Changelog:
*Added GDI+ pen test

 dlls/gdiplus/tests/Makefile.in |   13 ++++++
 dlls/gdiplus/tests/pen.c       |   92 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 105 insertions(+), 0 deletions(-)

-Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/tests/Makefile.in b/dlls/gdiplus/tests/Makefile.in
new file mode 100644
index 0000000..14bc936
--- /dev/null
+++ b/dlls/gdiplus/tests/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = gdiplus.dll
+IMPORTS   = user32 gdi32 kernel32 gdiplus
+
+CTESTS = \
+	pen.c
+
+ at MAKE_TEST_RULES@
+
+ at DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/gdiplus/tests/pen.c b/dlls/gdiplus/tests/pen.c
new file mode 100644
index 0000000..c5f7482
--- /dev/null
+++ b/dlls/gdiplus/tests/pen.c
@@ -0,0 +1,92 @@
+/*
+ * Unit test suite for pens
+ *
+ * Copyright (C) 2007 Google (Evan Stade)
+ *
+ * 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 <stdarg.h>
+
+#include "windef.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_startup(void)
+{
+    GpPen *pen;
+    Status status;
+    GdiplusStartupInput gdiplusStartupInput;
+    ULONG_PTR gdiplusToken;
+
+    gdiplusStartupInput.GdiplusVersion              = 1;
+    gdiplusStartupInput.DebugEventCallback          = NULL;
+    gdiplusStartupInput.SuppressBackgroundThread    = 0;
+    gdiplusStartupInput.SuppressExternalCodecs      = 0;
+
+    status = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+    expect(Ok, status);
+    GdiplusShutdown(gdiplusToken);
+
+    gdiplusStartupInput.GdiplusVersion = 2;
+
+    status = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+    expect(UnsupportedGdiplusVersion, status);
+    GdiplusShutdown(gdiplusToken);
+
+    status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+
+    todo_wine
+        expect(GdiplusNotInitialized, status);
+
+    GdipDeletePen(pen);
+}
+
+static void test_constructor_destructor(void)
+{
+    GpStatus status;
+    GpPen *pen = NULL;
+
+    status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+    expect(Ok, status);
+    ok(pen != NULL, "Expected pen to be initialized");
+
+    status = GdipDeletePen(NULL);
+    expect(InvalidParameter, status);
+
+    status = GdipDeletePen(pen);
+    expect(Ok, status);
+}
+
+START_TEST(pen)
+{
+    GdiplusStartupInput gdiplusStartupInput;
+    ULONG_PTR gdiplusToken;
+
+    test_startup();
+
+    gdiplusStartupInput.GdiplusVersion              = 1;
+    gdiplusStartupInput.DebugEventCallback          = NULL;
+    gdiplusStartupInput.SuppressBackgroundThread    = 0;
+    gdiplusStartupInput.SuppressExternalCodecs      = 0;
+
+    GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+
+    test_constructor_destructor();
+
+    GdiplusShutdown(gdiplusToken);
+}
-- 
1.4.1


More information about the wine-patches mailing list