#include <math.h>
-#include "windows.h"
-#include "gdiplus.h"
-#include "wine/test.h"
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
+//#include "windows.h"
+#include <wine/test.h>
+#include <wingdi.h>
+#include <winnls.h>
+#include <objbase.h>
+#include <gdiplus.h>
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
#define expect_(expected, got, precision) ok(abs((expected) - (got)) <= (precision), "Expected %d, got %d\n", (expected), (got))
static const WCHAR nonexistent[] = {'T','h','i','s','F','o','n','t','s','h','o','u','l','d','N','o','t','E','x','i','s','t','\0'};
static const WCHAR MSSansSerif[] = {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
-static const WCHAR MicrosoftSansSerif[] = {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
static const WCHAR TimesNewRoman[] = {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n','\0'};
-static const WCHAR CourierNew[] = {'C','o','u','r','i','e','r',' ','N','e','w','\0'};
static const WCHAR Tahoma[] = {'T','a','h','o','m','a',0};
-static const WCHAR LiberationSerif[] = {'L','i','b','e','r','a','t','i','o','n',' ','S','e','r','i','f',0};
static void set_rect_empty(RectF *rc)
{
WCHAR ms_shell_dlg[LF_FACESIZE];
HDC hdc;
HFONT hfont;
- LOGFONT lf;
+ LOGFONTA lf;
GpStatus status;
GpGraphics *graphics;
GpFont *font;
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);
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);
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 */
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");
+ font = NULL;
status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
todo_wine
ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
"expected NotTrueTypeFont, got %d\n", status);
+ /* FIXME: remove when wine is fixed */
+ if (font) GdipDeleteFont(font);
/* empty FaceName */
lf.lfFaceName[0] = 0;
+ font = NULL;
status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
todo_wine
ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
"expected NotTrueTypeFont, got %d\n", status);
+ /* FIXME: remove when wine is fixed */
+ if (font) GdipDeleteFont(font);
GdipDeleteGraphics(graphics);
DeleteDC(hdc);
static const WCHAR string[] = { 'A',0 };
GpStatus status;
HDC hdc;
- LOGFONT lf;
+ LOGFONTA lf;
GpFont *font;
GpGraphics *graphics;
GpMatrix *matrix;
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);
expect(Ok, status);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
-todo_wine
- expectf(height, bounds.Height);
+ expectf_(height, bounds.Height, 1.0);
set_rect_empty(&bounds);
status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
DriverStringOptionsCmapLookup, NULL, &bounds);
expect(Ok, status);
expectf(0.0, bounds.X);
-todo_wine
expectf_(-100.0, bounds.Y, 0.05);
-todo_wine
- expectf(height, bounds.Height);
+ expectf_(height, bounds.Height, 0.5);
set_rect_empty(&bounds);
status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
DriverStringOptionsCmapLookup, matrix, &bounds);
expect(Ok, status);
expectf(0.0, bounds.X);
-todo_wine
expectf_(-100.0, bounds.Y, 0.05);
-todo_wine
- expectf(height, bounds.Height);
+ expectf_(height, bounds.Height, 0.5);
/* scale matrix */
status = GdipScaleMatrix(matrix, 2.0, 3.0, MatrixOrderAppend);
expect(Ok, status);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
-todo_wine
- expectf(height, bounds.Height);
+ expectf_(height, bounds.Height, 0.05);
set_rect_empty(&bounds);
status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
DriverStringOptionsCmapLookup, NULL, &bounds);
expect(Ok, status);
expectf(0.0, bounds.X);
-todo_wine
expectf_(-100.0, bounds.Y, 0.05);
-todo_wine
- expectf(height, bounds.Height);
+ expectf_(height, bounds.Height, 0.2);
set_rect_empty(&bounds);
status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
DriverStringOptionsCmapLookup, matrix, &bounds);
expect(Ok, status);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
-todo_wine
- expectf(height, bounds.Height);
+ expectf_(height, bounds.Height, 0.05);
set_rect_empty(&bounds);
status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
DriverStringOptionsCmapLookup, NULL, &bounds);
expect(Ok, status);
expectf(0.0, bounds.X);
-todo_wine
expectf_(-100.0, bounds.Y, 0.05);
-todo_wine
- expectf(height, bounds.Height);
+ expectf_(height, bounds.Height, 0.2);
set_rect_empty(&bounds);
status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
DriverStringOptionsCmapLookup, matrix, &bounds);
expect(Ok, status);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
-todo_wine
- expectf(height, bounds.Height);
+ expectf_(height, bounds.Height, 0.2);
set_rect_empty(&bounds);
status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
DriverStringOptionsCmapLookup, NULL, &bounds);
expect(Ok, status);
expectf(0.0, bounds.X);
-todo_wine
- expectf_(-100.0, bounds.Y, 0.05);
-todo_wine
- expectf(height, bounds.Height);
+ expectf_(-100.0, bounds.Y, 0.2);
+ expectf_(height, bounds.Height, 0.2);
set_rect_empty(&bounds);
status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
DriverStringOptionsCmapLookup, matrix, &bounds);
expect(Ok, status);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
-todo_wine
- expectf(height, bounds.Height);
+ expectf_(height, bounds.Height, 0.1);
set_rect_empty(&bounds);
status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
DriverStringOptionsCmapLookup, NULL, &bounds);
expect(Ok, status);
expectf(0.0, bounds.X);
-todo_wine
- expectf_(-100.0, bounds.Y, 0.05);
-todo_wine
- expectf(height, bounds.Height);
+ expectf_(-100.0, bounds.Y, 0.2);
+ expectf_(height, bounds.Height, 0.2);
set_rect_empty(&bounds);
status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
DriverStringOptionsCmapLookup, matrix, &bounds);