Commit 9fb9cb2b authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 023af7c3
...@@ -726,6 +726,7 @@ static void test_font_metrics(void) ...@@ -726,6 +726,7 @@ static void test_font_metrics(void)
static void test_font_substitution(void) static void test_font_substitution(void)
{ {
WCHAR ms_shell_dlg[LF_FACESIZE]; WCHAR ms_shell_dlg[LF_FACESIZE];
char fallback_font[LF_FACESIZE];
HDC hdc; HDC hdc;
HFONT hfont; HFONT hfont;
LOGFONTA lf; LOGFONTA lf;
...@@ -772,13 +773,22 @@ static void test_font_substitution(void) ...@@ -772,13 +773,22 @@ static void test_font_substitution(void)
status = GdipCreateFontFamilyFromName(nonexistent, NULL, &family); status = GdipCreateFontFamilyFromName(nonexistent, NULL, &family);
ok(status == FontFamilyNotFound, "expected FontFamilyNotFound, got %d\n", status); 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"); lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist");
status = GdipCreateFontFromLogfontA(hdc, &lf, &font); status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
expect(Ok, status); expect(Ok, status);
memset(&lf, 0xfe, sizeof(lf)); memset(&lf, 0xfe, sizeof(lf));
status = GdipGetLogFontA(font, graphics, &lf); status = GdipGetLogFontA(font, graphics, &lf);
expect(Ok, status); 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); GdipDeleteFont(font);
/* empty FaceName */ /* empty FaceName */
...@@ -788,7 +798,7 @@ static void test_font_substitution(void) ...@@ -788,7 +798,7 @@ static void test_font_substitution(void)
memset(&lf, 0xfe, sizeof(lf)); memset(&lf, 0xfe, sizeof(lf));
status = GdipGetLogFontA(font, graphics, &lf); status = GdipGetLogFontA(font, graphics, &lf);
expect(Ok, status); 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); GdipDeleteFont(font);
/* zeroing out lfWeight and lfCharSet leads to font creation failure */ /* zeroing out lfWeight and lfCharSet leads to font creation failure */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment