From fcd7a62e930f9ed55cbb31a18efd011845c646bc Mon Sep 17 00:00:00 2001 From: Evan Stade Date: Mon, 11 Jun 2007 11:52:26 -0700 Subject: [PATCH] gdiplus: First pen test. --- .gitignore | 4 ++ Makefile.in | 2 + configure | 3 ++ configure.ac | 1 + dlls/Makefile.in | 1 + dlls/gdiplus/tests/Makefile.in | 13 ++++++ dlls/gdiplus/tests/pen.c | 92 ++++++++++++++++++++++++++++++++++++++++++ programs/winetest/Makefile.in | 3 ++ programs/winetest/winetest.rc | 1 + 9 files changed, 120 insertions(+) create mode 100644 dlls/gdiplus/tests/Makefile.in create mode 100644 dlls/gdiplus/tests/pen.c diff --git a/.gitignore b/.gitignore index d7005708487..15c7492fa7a 100644 --- a/.gitignore +++ b/.gitignore @@ -240,6 +240,9 @@ dlls/gdi32/tests/testlist.c dlls/gdi32/version.res dlls/gdi32/version16.res dlls/gdiplus/libgdiplus.def +dlls/gdiplus/tests/*.ok +dlls/gdiplus/tests/gdiplus_crosstest.exe +dlls/gdiplus/tests/testlist.c dlls/glu32/libglu32.def dlls/gphoto2.ds/rsrc.res dlls/hhctrl.ocx/hhctrl.res @@ -845,6 +848,7 @@ programs/winetest/dnsapi_test.exe programs/winetest/dplayx_test.exe programs/winetest/dsound_test.exe programs/winetest/gdi32_test.exe +programs/winetest/gdiplus_test.exe programs/winetest/hlink_test.exe programs/winetest/infosoft_test.exe programs/winetest/iphlpapi_test.exe diff --git a/Makefile.in b/Makefile.in index 36d950dddd7..fbf92683dfc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -234,6 +234,7 @@ ALL_MAKEFILES = \ dlls/gdi32/Makefile \ dlls/gdi32/tests/Makefile \ dlls/gdiplus/Makefile \ + dlls/gdiplus/tests/Makefile \ dlls/glu32/Makefile \ dlls/gphoto2.ds/Makefile \ dlls/hal/Makefile \ @@ -586,6 +587,7 @@ dlls/dxguid/Makefile: dlls/dxguid/Makefile.in dlls/Makeimplib.rules dlls/gdi32/Makefile: dlls/gdi32/Makefile.in dlls/Makedll.rules dlls/gdi32/tests/Makefile: dlls/gdi32/tests/Makefile.in dlls/Maketest.rules dlls/gdiplus/Makefile: dlls/gdiplus/Makefile.in dlls/Makedll.rules +dlls/gdiplus/tests/Makefile: dlls/gdiplus/tests/Makefile.in dlls/Maketest.rules dlls/glu32/Makefile: dlls/glu32/Makefile.in dlls/Makedll.rules dlls/gphoto2.ds/Makefile: dlls/gphoto2.ds/Makefile.in dlls/Makedll.rules dlls/hal/Makefile: dlls/hal/Makefile.in dlls/Makedll.rules diff --git a/configure b/configure index dd092b267fd..2353f9ff9e8 100755 --- a/configure +++ b/configure @@ -20532,6 +20532,8 @@ ac_config_files="$ac_config_files dlls/gdi32/tests/Makefile" ac_config_files="$ac_config_files dlls/gdiplus/Makefile" +ac_config_files="$ac_config_files dlls/gdiplus/tests/Makefile" + ac_config_files="$ac_config_files dlls/glu32/Makefile" ac_config_files="$ac_config_files dlls/gphoto2.ds/Makefile" @@ -21696,6 +21698,7 @@ do "dlls/gdi32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/gdi32/Makefile" ;; "dlls/gdi32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/gdi32/tests/Makefile" ;; "dlls/gdiplus/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/gdiplus/Makefile" ;; + "dlls/gdiplus/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/gdiplus/tests/Makefile" ;; "dlls/glu32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/glu32/Makefile" ;; "dlls/gphoto2.ds/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/gphoto2.ds/Makefile" ;; "dlls/hal/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/hal/Makefile" ;; diff --git a/configure.ac b/configure.ac index 81fd87a5d9e..72359fe9eba 100644 --- a/configure.ac +++ b/configure.ac @@ -1517,6 +1517,7 @@ AC_CONFIG_FILES([dlls/dxguid/Makefile]) AC_CONFIG_FILES([dlls/gdi32/Makefile]) AC_CONFIG_FILES([dlls/gdi32/tests/Makefile]) AC_CONFIG_FILES([dlls/gdiplus/Makefile]) +AC_CONFIG_FILES([dlls/gdiplus/tests/Makefile]) AC_CONFIG_FILES([dlls/glu32/Makefile]) AC_CONFIG_FILES([dlls/gphoto2.ds/Makefile]) AC_CONFIG_FILES([dlls/hal/Makefile]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index c1b7058af99..9a56e3bab22 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -246,6 +246,7 @@ TESTSUBDIRS = \ dplayx/tests \ dsound/tests \ gdi32/tests \ + gdiplus/tests \ hlink/tests \ infosoft/tests \ iphlpapi/tests \ diff --git a/dlls/gdiplus/tests/Makefile.in b/dlls/gdiplus/tests/Makefile.in new file mode 100644 index 00000000000..8cb68102546 --- /dev/null +++ b/dlls/gdiplus/tests/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = gdiplus.dll +IMPORTS = gdiplus kernel32 + +CTESTS = \ + pen.c + +@MAKE_TEST_RULES@ + +@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 00000000000..3615d9a3753 --- /dev/null +++ b/dlls/gdiplus/tests/pen.c @@ -0,0 +1,92 @@ +/* + * Unit test suite for pens (and init) + * + * 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 + +#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; + struct 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) +{ + struct 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); +} diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index c5afe482064..bf2fd4ab295 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -40,6 +40,7 @@ TESTBINS = \ dplayx_test.exe \ dsound_test.exe \ gdi32_test.exe \ + gdiplus_test.exe \ hlink_test.exe \ infosoft_test.exe \ iphlpapi_test.exe \ @@ -121,6 +122,8 @@ dsound_test.exe: $(DLLDIR)/dsound/tests/dsound_test.exe$(DLLEXT) cp $(DLLDIR)/dsound/tests/dsound_test.exe$(DLLEXT) $@ && $(STRIP) $@ gdi32_test.exe: $(DLLDIR)/gdi32/tests/gdi32_test.exe$(DLLEXT) cp $(DLLDIR)/gdi32/tests/gdi32_test.exe$(DLLEXT) $@ && $(STRIP) $@ +gdiplus_test.exe: $(DLLDIR)/gdiplus/tests/gdiplus_test.exe$(DLLEXT) + cp $(DLLDIR)/gdiplus/tests/gdiplus_test.exe$(DLLEXT) $@ && $(STRIP) $@ hlink_test.exe: $(DLLDIR)/hlink/tests/hlink_test.exe$(DLLEXT) cp $(DLLDIR)/hlink/tests/hlink_test.exe$(DLLEXT) $@ && $(STRIP) $@ infosoft_test.exe: $(DLLDIR)/infosoft/tests/infosoft_test.exe$(DLLEXT) diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc index 103a03740e0..e8a077297d8 100644 --- a/programs/winetest/winetest.rc +++ b/programs/winetest/winetest.rc @@ -163,6 +163,7 @@ dnsapi_test.exe TESTRES "dnsapi_test.exe" dplayx_test.exe TESTRES "dplayx_test.exe" dsound_test.exe TESTRES "dsound_test.exe" gdi32_test.exe TESTRES "gdi32_test.exe" +gdiplus_test.exe TESTRES "gdiplus_test.exe" hlink_test.exe TESTRES "hlink_test.exe" infosoft_test.exe TESTRES "infosoft_test.exe" iphlpapi_test.exe TESTRES "iphlpapi_test.exe" -- 2.11.4.GIT