[PATCH] 4/4 Tests for GdipGetGeneric* functions
Adam Petaccia
adam at tpetaccia.com
Tue Jun 17 09:56:39 CDT 2008
---
dlls/gdiplus/tests/font.c | 53 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index cad0993..1d235f7 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -27,6 +27,17 @@
static const WCHAR arial[] = {'A','r','i','a','l','\0'};
static const WCHAR nonexistant[] = {'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 char *debugstr_w(LPCWSTR str)
+{
+ static char buf[1024];
+ WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
+ return buf;
+}
static void test_logfont(void)
{
@@ -143,6 +154,47 @@ static void test_fontfamily (void)
if (family) GdipFree (family);
}
+static void test_getgenerics (void)
+{
+ GpStatus stat;
+ GpFontFamily** family;
+ WCHAR familyName[LF_FACESIZE];
+ ZeroMemory(familyName, sizeof(familyName)/sizeof(WCHAR));
+
+ family = GdipAlloc (sizeof (GpFontFamily*));
+
+ stat = GdipGetGenericFontFamilySansSerif (family);
+ expect (Ok, stat);
+ stat = GdipGetFamilyName (*family, familyName, LANG_NEUTRAL);
+ expect (Ok, stat);
+ ok ((lstrcmpiW(familyName, MicrosoftSansSerif) == 0) ||
+ (lstrcmpiW(familyName,MSSansSerif) == 0),
+ "Expected Microsoft Sans Serif or MS Sans Serif, got %s\n",
+ debugstr_w(familyName));
+ stat = GdipDeleteFontFamily (*family);
+ expect (Ok, stat);
+
+ stat = GdipGetGenericFontFamilySerif (family);
+ expect (Ok, stat);
+ stat = GdipGetFamilyName (*family, familyName, LANG_NEUTRAL);
+ expect (Ok, stat);
+ ok (lstrcmpiW(familyName, TimesNewRoman) == 0,
+ "Expected Times New Roman, got %s\n", debugstr_w(familyName));
+ stat = GdipDeleteFontFamily (*family);
+ expect (Ok, stat);
+
+ stat = GdipGetGenericFontFamilyMonospace (family);
+ expect (Ok, stat);
+ stat = GdipGetFamilyName (*family, familyName, LANG_NEUTRAL);
+ expect (Ok, stat);
+ ok (lstrcmpiW(familyName, CourierNew) == 0,
+ "Expected Courier New, got %s\n", debugstr_w(familyName));
+ stat = GdipDeleteFontFamily (*family);
+ expect (Ok, stat);
+
+ GdipFree (family);
+}
+
START_TEST(font)
{
struct GdiplusStartupInput gdiplusStartupInput;
@@ -157,6 +209,7 @@ START_TEST(font)
test_logfont();
test_fontfamily ();
+ test_getgenerics ();
GdiplusShutdown(gdiplusToken);
}
--
1.5.4.3
More information about the wine-patches
mailing list