[PATCH 1/2] gdiplus/tests: Add additional logfont size tests.
Signed-off-by: Shawn M. Chapla <schapla(a)codeweavers.com> --- dlls/gdiplus/tests/font.c | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c index 10d1f3bd5a..74cf451e36 100644 --- a/dlls/gdiplus/tests/font.c +++ b/dlls/gdiplus/tests/font.c @@ -300,6 +300,56 @@ static void test_logfont(void) GdipDeleteFontFamily(family); GdipDeleteFont(font); + font = NULL; + + /* The next test must be done with a font where tmHeight - + tmInternalLeading != tmAscent. Times New Roman is such a font, + so make sure we really have it before continuing. */ + memset(&lfa, 0, sizeof(lfa)); + lstrcpyA(lfa.lfFaceName, "Times New Roman"); + + stat = GdipCreateFontFromLogfontA(hdc, &lfa, &font); + expect(Ok, stat); + + memset(&lfa2, 0, sizeof(lfa2)); + stat = GdipGetLogFontA(font, graphics, &lfa2); + expect(Ok, stat); + + GdipDeleteFont(font); + font = NULL; + + if (!lstrlenA(lfa.lfFaceName) || lstrcmpA(lfa.lfFaceName, lfa2.lfFaceName)) + { + skip("Times New Roman not installed\n"); + } + else + { + static const struct + { + INT input; + REAL expected; + } test_sizes[] = {{12, 9.0}, {36, 32.0}, {48, 42.0}, {72, 63.0}, {144, 127.0}}; + + UINT i; + + memset(&lfa, 0, sizeof(lfa)); + lstrcpyA(lfa.lfFaceName, "Times New Roman"); + + for (i = 0; i < sizeof(test_sizes)/sizeof(test_sizes[0]); ++i) + { + lfa.lfHeight = test_sizes[i].input; + + stat = GdipCreateFontFromLogfontA(hdc, &lfa, &font); + expect(Ok, stat); + + stat = GdipGetFontSize(font, &rval); + expect(Ok, stat); + todo_wine expectf(test_sizes[i].expected, rval); + + GdipDeleteFont(font); + font = NULL; + } + } GdipDeleteGraphics(graphics); ReleaseDC(0, hdc); -- 2.27.0
Signed-off-by: Shawn M. Chapla <schapla(a)codeweavers.com> --- dlls/gdiplus/font.c | 2 +- dlls/gdiplus/tests/font.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c index a7719a9458..eb0b6c0836 100644 --- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -219,7 +219,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc, if (!*font) return OutOfMemory; (*font)->unit = UnitWorld; - (*font)->emSize = otm.otmTextMetrics.tmAscent; + (*font)->emSize = otm.otmTextMetrics.tmHeight - otm.otmTextMetrics.tmInternalLeading; (*font)->otm = otm; stat = GdipCreateFontFamilyFromName(facename, NULL, &(*font)->family); diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c index 74cf451e36..b762f7c45f 100644 --- a/dlls/gdiplus/tests/font.c +++ b/dlls/gdiplus/tests/font.c @@ -344,7 +344,7 @@ static void test_logfont(void) stat = GdipGetFontSize(font, &rval); expect(Ok, stat); - todo_wine expectf(test_sizes[i].expected, rval); + expectf(test_sizes[i].expected, rval); GdipDeleteFont(font); font = NULL; -- 2.27.0
Signed-off-by: Esme Povirk <esme(a)codewevers.com>
participants (2)
-
Esme Povirk (they/them) -
Shawn M. Chapla