Evan Stade : gdiplus: Constructor tests for GpGraphics.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 16 08:23:43 CDT 2007


Module: wine
Branch: master
Commit: 05a7cef855331d8653ed528d88bfa26b50273ca9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=05a7cef855331d8653ed528d88bfa26b50273ca9

Author: Evan Stade <estade at gmail.com>
Date:   Fri Jul 13 17:51:41 2007 -0700

gdiplus: Constructor tests for GpGraphics.

---

 dlls/gdiplus/tests/Makefile.in |    3 +-
 dlls/gdiplus/tests/graphics.c  |   69 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/tests/Makefile.in b/dlls/gdiplus/tests/Makefile.in
index 9eb9e51..421bd4e 100644
--- a/dlls/gdiplus/tests/Makefile.in
+++ b/dlls/gdiplus/tests/Makefile.in
@@ -3,10 +3,11 @@ TOPOBJDIR = ../../..
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 TESTDLL   = gdiplus.dll
-IMPORTS   = gdiplus kernel32
+IMPORTS   = gdiplus user32 gdi32 kernel32
 
 CTESTS = \
 	brush.c \
+	graphics.c \
 	graphicspath.c \
 	matrix.c \
 	pen.c
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
new file mode 100644
index 0000000..93d419c
--- /dev/null
+++ b/dlls/gdiplus/tests/graphics.c
@@ -0,0 +1,69 @@
+/*
+ * Unit test suite for graphics objects
+ *
+ * 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 "windows.h"
+#include "gdiplus.h"
+#include "wingdi.h"
+#include "wine/test.h"
+
+#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
+
+static void test_constructor_destructor()
+{
+    GpStatus stat;
+    GpGraphics *graphics = NULL;
+    HDC hdc = GetDC(0);
+
+    stat = GdipCreateFromHDC(NULL, &graphics);
+    expect(OutOfMemory, stat);
+    stat = GdipDeleteGraphics(graphics);
+    expect(InvalidParameter, stat);
+
+    stat = GdipCreateFromHDC(hdc, &graphics);
+    expect(Ok, stat);
+    stat = GdipDeleteGraphics(graphics);
+    expect(Ok, stat);
+
+    stat = GdipCreateFromHWND(NULL, &graphics);
+    expect(Ok, stat);
+    stat = GdipDeleteGraphics(graphics);
+    expect(Ok, stat);
+
+    stat = GdipDeleteGraphics(NULL);
+    expect(InvalidParameter, stat);
+    ReleaseDC(0, hdc);
+}
+
+START_TEST(graphics)
+{
+    struct GdiplusStartupInput gdiplusStartupInput;
+    ULONG_PTR gdiplusToken;
+
+    gdiplusStartupInput.GdiplusVersion              = 1;
+    gdiplusStartupInput.DebugEventCallback          = NULL;
+    gdiplusStartupInput.SuppressBackgroundThread    = 0;
+    gdiplusStartupInput.SuppressExternalCodecs      = 0;
+
+    GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+
+    test_constructor_destructor();
+
+    GdiplusShutdown(gdiplusToken);
+}




More information about the wine-cvs mailing list