Alexandre Julliard : gdiplus/tests: Check the correct fallback font when Arial is missing.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 25 10:11:19 CST 2015


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Nov 25 20:30:00 2015 +0900

gdiplus/tests: Check the correct fallback font when Arial is missing.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdiplus/tests/font.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index 932b5ed..39b539b 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -726,6 +726,7 @@ static void test_font_metrics(void)
 static void test_font_substitution(void)
 {
     WCHAR ms_shell_dlg[LF_FACESIZE];
+    char fallback_font[LF_FACESIZE];
     HDC hdc;
     HFONT hfont;
     LOGFONTA lf;
@@ -772,13 +773,22 @@ static void test_font_substitution(void)
     status = GdipCreateFontFamilyFromName(nonexistent, NULL, &family);
     ok(status == FontFamilyNotFound, "expected FontFamilyNotFound, got %d\n", status);
 
+    /* nonexistent fonts fallback to Arial, or something else if it's missing */
+    strcpy(lf.lfFaceName,"Arial");
+    status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
+    expect(Ok, status);
+    status = GdipGetLogFontA(font, graphics, &lf);
+    expect(Ok, status);
+    strcpy(fallback_font,lf.lfFaceName);
+    trace("fallback font %s\n", fallback_font);
+
     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(!lstrcmpA(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
+    ok(!lstrcmpA(lf.lfFaceName, fallback_font), "wrong face name %s / %s\n", lf.lfFaceName, fallback_font);
     GdipDeleteFont(font);
 
     /* empty FaceName */
@@ -788,7 +798,7 @@ static void test_font_substitution(void)
     memset(&lf, 0xfe, sizeof(lf));
     status = GdipGetLogFontA(font, graphics, &lf);
     expect(Ok, status);
-    ok(!lstrcmpA(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
+    ok(!lstrcmpA(lf.lfFaceName, fallback_font), "wrong face name %s / %s\n", lf.lfFaceName, fallback_font);
     GdipDeleteFont(font);
 
     /* zeroing out lfWeight and lfCharSet leads to font creation failure */




More information about the wine-cvs mailing list