[try2][Gdiplus] Skip the each generic font tests if we don't have the required fonts

Adam Petaccia adam at tpetaccia.com
Fri Aug 1 19:02:21 CDT 2008


On my Ubuntu 8.04 machine, msttcorefonts didn't include Microsoft Sans Serif,
   so its best to try the tests one by one instead of skipping over all of them.
   This extra check doesn't invalidate the tests because Microsft Windows should
   NEVER return FontFamilyNotFound, and we're testing to see what the family
   actually is.
---
 dlls/gdiplus/tests/font.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index 8ce0ec6..3e40501 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -282,6 +282,11 @@ static void test_getgenerics (void)
     ZeroMemory(familyName, sizeof(familyName)/sizeof(WCHAR));
 
     stat = GdipGetGenericFontFamilySansSerif (&family);
+    if (stat == FontFamilyNotFound)
+    {
+        skip("Microsoft Sans Serif or liberation fonts not installed\n");
+        goto serif;
+    }
     expect (Ok, stat);
     stat = GdipGetFamilyName (family, familyName, LANG_NEUTRAL);
     expect (Ok, stat);
@@ -292,7 +297,13 @@ static void test_getgenerics (void)
     stat = GdipDeleteFontFamily (family);
     expect (Ok, stat);
 
+serif:
     stat = GdipGetGenericFontFamilySerif (&family);
+    if (stat == FontFamilyNotFound)
+    {
+        skip("Times New Roman or liberation fonts not installed\n");
+        goto monospace;
+    }
     expect (Ok, stat);
     stat = GdipGetFamilyName (family, familyName, LANG_NEUTRAL);
     expect (Ok, stat);
@@ -301,7 +312,13 @@ static void test_getgenerics (void)
     stat = GdipDeleteFontFamily (family);
     expect (Ok, stat);
 
+monospace:
     stat = GdipGetGenericFontFamilyMonospace (&family);
+    if (stat == FontFamilyNotFound)
+    {
+        skip("Courier New or liberation fonts not installed\n");
+        return;
+    }
     expect (Ok, stat);
     stat = GdipGetFamilyName (family, familyName, LANG_NEUTRAL);
     expect (Ok, stat);
-- 
1.5.4.3




More information about the wine-patches mailing list