Adam Petaccia : gdiplus: Tests for GetGeneric*.

Alexandre Julliard julliard at winehq.org
Wed Jun 25 16:44:21 CDT 2008


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

Author: Adam Petaccia <adam at tpetaccia.com>
Date:   Sat Jun 21 13:02:52 2008 -0400

gdiplus: Tests for GetGeneric*.

---

 dlls/gdiplus/tests/font.c |   49 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index b653089..5cc9bc2 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -31,6 +31,13 @@ static const WCHAR MicrosoftSansSerif[] = {'M','i','c','r','o','s','o','f','t','
 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)
 {
     LOGFONTW lfw, lfw2;
@@ -147,6 +154,47 @@ static void test_fontfamily (void)
 }
 
 
+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;
@@ -161,6 +209,7 @@ START_TEST(font)
 
     test_logfont();
     test_fontfamily();
+    test_getgenerics();
 
     GdiplusShutdown(gdiplusToken);
 }




More information about the wine-cvs mailing list