gdiplus/tests: Don't fail if Microsoft Sans Serif and Times New Roman are not installed.

Francois Gouget fgouget at free.fr
Thu Sep 8 08:33:35 CDT 2011


It is quite normal for them not to be installed in Wine and the generic SanSerif and Serif functions obviously cannot return them if that's the case.
---

This fixes the following errors:

   font.c:264: Tests skipped: Times New Roman not installed
   font.c:304: Test marked todo: Expected Microsoft Sans Serif, got Tahoma
   font.c:322: Test failed: Expected Times New Roman, got L"Liberation Serif"

Isn't it a bit galling that the test would first skip tests because 
Times New Roman is not installed and then complain that it got (quite 
sensigly) substituted with Liberation Serif?

The exact same issue happens with Microsoft Sans Serif.

 dlls/gdiplus/tests/font.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index 323461a..f5daa67 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -291,31 +291,35 @@ static void test_getgenerics (void)
     WCHAR familyName[LF_FACESIZE];
     ZeroMemory(familyName, sizeof(familyName)/sizeof(WCHAR));
 
-    stat = GdipGetGenericFontFamilySansSerif (&family);
+    /* First check that Microsoft Sans Serif is installed because if not
+     * Wine substitutes another sans serif font.
+     */
+    stat = GdipCreateFontFamilyFromName(MicrosoftSansSerif, NULL, &family);
     if (stat == FontFamilyNotFound)
     {
         skip("Microsoft Sans Serif not installed\n");
         goto serif;
     }
+    stat = GdipGetGenericFontFamilySansSerif (&family);
     expect (Ok, stat);
     stat = GdipGetFamilyName (family, familyName, LANG_NEUTRAL);
     expect (Ok, stat);
-    if (!lstrcmpiW(familyName, Tahoma))
-        todo_wine ok ((lstrcmpiW(familyName, MicrosoftSansSerif) == 0),
-                      "Expected Microsoft Sans Serif, got Tahoma\n");
-    else
-        ok ((lstrcmpiW(familyName, MicrosoftSansSerif) == 0),
-            "Expected Microsoft Sans Serif, got %s\n", wine_dbgstr_w(familyName));
+    ok ((lstrcmpiW(familyName, MicrosoftSansSerif) == 0),
+        "Expected Microsoft Sans Serif, got %s\n", wine_dbgstr_w(familyName));
     stat = GdipDeleteFontFamily (family);
     expect (Ok, stat);
 
 serif:
-    stat = GdipGetGenericFontFamilySerif (&family);
+    /* First check that Times New Roman is installed because if not
+     * Wine substitutes another serif font.
+     */
+    stat = GdipCreateFontFamilyFromName(TimesNewRoman, NULL, &family);
     if (stat == FontFamilyNotFound)
     {
         skip("Times New Roman not installed\n");
         goto monospace;
     }
+    stat = GdipGetGenericFontFamilySerif (&family);
     expect (Ok, stat);
     stat = GdipGetFamilyName (family, familyName, LANG_NEUTRAL);
     expect (Ok, stat);
-- 
1.7.5.4



More information about the wine-patches mailing list