gdiplus/tests: Fix tests compilation with __WINESRC__ defined.

Dmitry Timoshkov dmitry at baikal.ru
Tue Oct 15 22:49:40 CDT 2013


Unicode version of win32 APIs was preferred with exception when the tests
depend on a particular flavour of A/W APIs called or if introducing W variant
would require a lot of string literals conversions.
---
 dlls/gdiplus/tests/Makefile.in     |  1 -
 dlls/gdiplus/tests/brush.c         |  5 +++--
 dlls/gdiplus/tests/customlinecap.c |  2 +-
 dlls/gdiplus/tests/font.c          | 28 ++++++++++++++--------------
 dlls/gdiplus/tests/graphics.c      |  7 +++----
 dlls/gdiplus/tests/graphicspath.c  |  2 +-
 dlls/gdiplus/tests/image.c         |  4 ++--
 dlls/gdiplus/tests/matrix.c        |  3 +--
 dlls/gdiplus/tests/metafile.c      |  3 +--
 dlls/gdiplus/tests/pathiterator.c  |  2 +-
 dlls/gdiplus/tests/pen.c           |  2 +-
 dlls/gdiplus/tests/region.c        |  6 +++---
 dlls/gdiplus/tests/stringformat.c  |  2 +-
 13 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/dlls/gdiplus/tests/Makefile.in b/dlls/gdiplus/tests/Makefile.in
index c6526fc..1538eb0 100644
--- a/dlls/gdiplus/tests/Makefile.in
+++ b/dlls/gdiplus/tests/Makefile.in
@@ -1,6 +1,5 @@
 TESTDLL   = gdiplus.dll
 IMPORTS   = gdiplus ole32 user32 gdi32
-EXTRADEFS = -U__WINESRC__ -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS
 
 C_SRCS = \
 	brush.c \
diff --git a/dlls/gdiplus/tests/brush.c b/dlls/gdiplus/tests/brush.c
index cde7b56..0942e88 100644
--- a/dlls/gdiplus/tests/brush.c
+++ b/dlls/gdiplus/tests/brush.c
@@ -18,10 +18,11 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "windows.h"
+#include <math.h>
+
+#include "objbase.h"
 #include "gdiplus.h"
 #include "wine/test.h"
-#include <math.h>
 
 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
 #define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
diff --git a/dlls/gdiplus/tests/customlinecap.c b/dlls/gdiplus/tests/customlinecap.c
index 604589e..f70c134 100644
--- a/dlls/gdiplus/tests/customlinecap.c
+++ b/dlls/gdiplus/tests/customlinecap.c
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "windows.h"
+#include "objbase.h"
 #include "gdiplus.h"
 #include "wine/test.h"
 
diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index 29d4ad5..2b5cf09 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -21,7 +21,7 @@
 
 #include <math.h>
 
-#include "windows.h"
+#include "objbase.h"
 #include "gdiplus.h"
 #include "wine/test.h"
 
@@ -731,7 +731,7 @@ static void test_font_substitution(void)
     WCHAR ms_shell_dlg[LF_FACESIZE];
     HDC hdc;
     HFONT hfont;
-    LOGFONT lf;
+    LOGFONTA lf;
     GpStatus status;
     GpGraphics *graphics;
     GpFont *font;
@@ -746,9 +746,9 @@ static void test_font_substitution(void)
     ok(hfont != 0, "GetStockObject(DEFAULT_GUI_FONT) failed\n");
 
     memset(&lf, 0xfe, sizeof(lf));
-    ret = GetObject(hfont, sizeof(lf), &lf);
+    ret = GetObjectA(hfont, sizeof(lf), &lf);
     ok(ret == sizeof(lf), "GetObject failed\n");
-    ok(!lstrcmp(lf.lfFaceName, "MS Shell Dlg"), "wrong face name %s\n", lf.lfFaceName);
+    ok(!lstrcmpA(lf.lfFaceName, "MS Shell Dlg"), "wrong face name %s\n", lf.lfFaceName);
     MultiByteToWideChar(CP_ACP, 0, lf.lfFaceName, -1, ms_shell_dlg, LF_FACESIZE);
 
     status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
@@ -756,8 +756,8 @@ static void test_font_substitution(void)
     memset(&lf, 0xfe, sizeof(lf));
     status = GdipGetLogFontA(font, graphics, &lf);
     expect(Ok, status);
-    ok(!lstrcmp(lf.lfFaceName, "Microsoft Sans Serif") ||
-       !lstrcmp(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
+    ok(!lstrcmpA(lf.lfFaceName, "Microsoft Sans Serif") ||
+       !lstrcmpA(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
     GdipDeleteFont(font);
 
     status = GdipCreateFontFamilyFromName(ms_shell_dlg, NULL, &family);
@@ -767,21 +767,21 @@ static void test_font_substitution(void)
     memset(&lf, 0xfe, sizeof(lf));
     status = GdipGetLogFontA(font, graphics, &lf);
     expect(Ok, status);
-    ok(!lstrcmp(lf.lfFaceName, "Microsoft Sans Serif") ||
-       !lstrcmp(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
+    ok(!lstrcmpA(lf.lfFaceName, "Microsoft Sans Serif") ||
+       !lstrcmpA(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
     GdipDeleteFont(font);
     GdipDeleteFontFamily(family);
 
     status = GdipCreateFontFamilyFromName(nonexistent, NULL, &family);
     ok(status == FontFamilyNotFound, "expected FontFamilyNotFound, got %d\n", status);
 
-    lstrcpy(lf.lfFaceName, "ThisFontShouldNotExist");
+    lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist");
     status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
     expect(Ok, status);
     memset(&lf, 0xfe, sizeof(lf));
     status = GdipGetLogFontA(font, graphics, &lf);
     expect(Ok, status);
-    ok(!lstrcmp(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
+    ok(!lstrcmpA(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
     GdipDeleteFont(font);
 
     /* empty FaceName */
@@ -791,13 +791,13 @@ static void test_font_substitution(void)
     memset(&lf, 0xfe, sizeof(lf));
     status = GdipGetLogFontA(font, graphics, &lf);
     expect(Ok, status);
-    ok(!lstrcmp(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
+    ok(!lstrcmpA(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
     GdipDeleteFont(font);
 
     /* zeroing out lfWeight and lfCharSet leads to font creation failure */
     lf.lfWeight = 0;
     lf.lfCharSet = 0;
-    lstrcpy(lf.lfFaceName, "ThisFontShouldNotExist");
+    lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist");
     status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
 todo_wine
     ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
@@ -819,7 +819,7 @@ static void test_font_transform(void)
     static const WCHAR string[] = { 'A',0 };
     GpStatus status;
     HDC hdc;
-    LOGFONT lf;
+    LOGFONTA lf;
     GpFont *font;
     GpGraphics *graphics;
     GpMatrix *matrix;
@@ -841,7 +841,7 @@ static void test_font_transform(void)
     expect(Ok, status);
 
     memset(&lf, 0, sizeof(lf));
-    lstrcpy(lf.lfFaceName, "Tahoma");
+    lstrcpyA(lf.lfFaceName, "Tahoma");
     lf.lfHeight = -100;
     lf.lfWidth = 100;
     status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index b773d63..2de456c 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -22,9 +22,8 @@
 #include <math.h>
 #include <assert.h>
 
-#include "windows.h"
+#include "objbase.h"
 #include "gdiplus.h"
-#include "wingdi.h"
 #include "wine/test.h"
 
 #define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (INT)(expected), (INT)(got))
@@ -5506,8 +5505,8 @@ START_TEST(graphics)
     class.style = CS_HREDRAW | CS_VREDRAW;
     class.lpfnWndProc = DefWindowProcA;
     class.hInstance = GetModuleHandleA(0);
-    class.hIcon = LoadIcon(0, IDI_APPLICATION);
-    class.hCursor = LoadCursor(NULL, IDC_ARROW);
+    class.hIcon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
+    class.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
     class.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
     RegisterClassA( &class );
     hwnd = CreateWindowA( "gdiplus_test", "graphics test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c
index 9a42153..6d929b0 100644
--- a/dlls/gdiplus/tests/graphicspath.c
+++ b/dlls/gdiplus/tests/graphicspath.c
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "windows.h"
+#include "objbase.h"
 #include "gdiplus.h"
 #include "wine/test.h"
 #include <math.h>
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index 18e159b..9f5730e 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -26,7 +26,7 @@
 #include <stdio.h>
 
 #include "initguid.h"
-#include "windows.h"
+#include "objbase.h"
 #include "gdiplus.h"
 #include "wine/test.h"
 
@@ -3809,7 +3809,7 @@ static void test_image_format(void)
         else
         {
             expect(Ok, status);
-            ret = GetObject(hbitmap, sizeof(bm), &bm);
+            ret = GetObjectW(hbitmap, sizeof(bm), &bm);
             expect(sizeof(bm), ret);
             expect(0, bm.bmType);
             expect(1, bm.bmWidth);
diff --git a/dlls/gdiplus/tests/matrix.c b/dlls/gdiplus/tests/matrix.c
index 379a8fa..83b57ef 100644
--- a/dlls/gdiplus/tests/matrix.c
+++ b/dlls/gdiplus/tests/matrix.c
@@ -20,8 +20,7 @@
 
 #include <math.h>
 
-#include "windows.h"
-#include <stdio.h>
+#include "objbase.h"
 #include "gdiplus.h"
 #include "wine/test.h"
 
diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c
index 3366f0e..aa39351 100644
--- a/dlls/gdiplus/tests/metafile.c
+++ b/dlls/gdiplus/tests/metafile.c
@@ -18,8 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "windows.h"
-#include <stdio.h>
+#include "objbase.h"
 #include "gdiplus.h"
 #include "wine/test.h"
 
diff --git a/dlls/gdiplus/tests/pathiterator.c b/dlls/gdiplus/tests/pathiterator.c
index 17cd463..e606be3 100644
--- a/dlls/gdiplus/tests/pathiterator.c
+++ b/dlls/gdiplus/tests/pathiterator.c
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "windows.h"
+#include "objbase.h"
 #include "gdiplus.h"
 #include "wine/test.h"
 
diff --git a/dlls/gdiplus/tests/pen.c b/dlls/gdiplus/tests/pen.c
index b742118..90d57d6 100644
--- a/dlls/gdiplus/tests/pen.c
+++ b/dlls/gdiplus/tests/pen.c
@@ -20,7 +20,7 @@
 
 #include <math.h>
 
-#include "windows.h"
+#include "objbase.h"
 #include "gdiplus.h"
 #include "wine/test.h"
 
diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c
index dd2f76d..c9da573 100644
--- a/dlls/gdiplus/tests/region.c
+++ b/dlls/gdiplus/tests/region.c
@@ -18,11 +18,11 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "windows.h"
+#include <math.h>
+
+#include "objbase.h"
 #include "gdiplus.h"
-#include "wingdi.h"
 #include "wine/test.h"
-#include <math.h>
 
 #define RGNDATA_RECT            0x10000000
 #define RGNDATA_PATH            0x10000001
diff --git a/dlls/gdiplus/tests/stringformat.c b/dlls/gdiplus/tests/stringformat.c
index 117e57b..f0fcff9 100644
--- a/dlls/gdiplus/tests/stringformat.c
+++ b/dlls/gdiplus/tests/stringformat.c
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "windows.h"
+#include "objbase.h"
 #include "gdiplus.h"
 #include "wine/test.h"
 
-- 
1.8.3.4




More information about the wine-patches mailing list