Module: wine Branch: master Commit: 13174a2f5fafdb9ec6ac046d8c805295ab6005de URL: https://gitlab.winehq.org/wine/wine/-/commit/13174a2f5fafdb9ec6ac046d8c80529...
Author: Jeff Smith whydoubt@gmail.com Date: Fri Sep 15 17:37:55 2023 -0500
gdiplus/tests: Test GdipCreateFont character set initialization.
---
dlls/gdiplus/tests/font.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+)
diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c index 30cf159e140..7a9d50c8c2e 100644 --- a/dlls/gdiplus/tests/font.c +++ b/dlls/gdiplus/tests/font.c @@ -191,6 +191,78 @@ static void test_createfont(void) GdipDeleteFontFamily(fontfamily); }
+static void test_createfont_charset(void) +{ + GpFontFamily* fontfamily = NULL; + GpGraphics *graphics; + GpFont* font = NULL; + GpStatus stat; + LOGFONTW lf; + HDC hdc; + UINT i; + + static const struct { + LPCWSTR family_name; + BYTE char_set; + BOOL todo; + } td[] = + { + {L"Tahoma", ANSI_CHARSET}, + {L"Symbol", SYMBOL_CHARSET}, + {L"Marlett", SYMBOL_CHARSET, TRUE}, + {L"Wingdings", SYMBOL_CHARSET, TRUE}, + }; + + hdc = CreateCompatibleDC(0); + stat = GdipCreateFromHDC(hdc, &graphics); + expect (Ok, stat); + + for (i = 0; i < ARRAY_SIZE(td); i++) + { + winetest_push_context("%u", i); + + stat = GdipCreateFontFamilyFromName(td[i].family_name, NULL, &fontfamily); + expect (Ok, stat); + stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitPoint, &font); + expect (Ok, stat); + + stat = GdipGetLogFontW(font, graphics, &lf); + expect(Ok, stat); + + if (lstrcmpiW(lf.lfFaceName, td[i].family_name) != 0) + { + skip("%s not installed\n", wine_dbgstr_w(td[i].family_name)); + } + else + { + ok(lf.lfHeight < 0, "Expected negative height, got %ld\n", lf.lfHeight); + expect(0, lf.lfWidth); + expect(0, lf.lfEscapement); + expect(0, lf.lfOrientation); + ok((lf.lfWeight >= 100) && (lf.lfWeight <= 900), "Expected weight to be set\n"); + expect(0, lf.lfItalic); + expect(0, lf.lfUnderline); + expect(0, lf.lfStrikeOut); + todo_wine_if(td[i].todo) + ok(td[i].char_set == lf.lfCharSet || + (td[i].char_set == ANSI_CHARSET && lf.lfCharSet == GetTextCharset(hdc)), + "got %#x\n", lf.lfCharSet); + expect(0, lf.lfOutPrecision); + expect(0, lf.lfClipPrecision); + expect(0, lf.lfQuality); + expect(0, lf.lfPitchAndFamily); + } + + GdipDeleteFont(font); + GdipDeleteFontFamily(fontfamily); + + winetest_pop_context(); + } + + GdipDeleteGraphics(graphics); + DeleteDC(hdc); +} + static void test_logfont(void) { LOGFONTA lfa, lfa2; @@ -1479,6 +1551,7 @@ START_TEST(font) test_font_substitution(); test_font_metrics(); test_createfont(); + test_createfont_charset(); test_logfont(); test_fontfamily(); test_fontfamily_properties();