From ab7fe6086e33142eaa04b3c185e9c29b55ca3f52 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 8 May 2012 19:29:02 +0900 Subject: [PATCH] gdi32: Add a test for ntmCellHeight calculation. --- dlls/gdi32/tests/font.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index 1708c49bf35..f50d1bccf0e 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -2842,7 +2842,7 @@ out: return r; } -static void test_text_metrics(const LOGFONTA *lf) +static void test_text_metrics(const LOGFONT *lf, const NEWTEXTMETRIC *ntm) { HDC hdc; HFONT hfont, hfont_old; @@ -2851,6 +2851,7 @@ static void test_text_metrics(const LOGFONTA *lf) LONG size, ret; const char *font_name = lf->lfFaceName; DWORD cmap_first = 0, cmap_last = 0; + UINT ascent, descent, cell_height; cmap_type cmap_type; BOOL sys_lang_non_english; @@ -2879,6 +2880,12 @@ static void test_text_metrics(const LOGFONTA *lf) ret = GetFontData(hdc, MS_OS2_TAG, 0, &tt_os2, size); ok(ret == size, "GetFontData should return %u not %u\n", size, ret); + ascent = GET_BE_WORD(tt_os2.usWinAscent); + descent = GET_BE_WORD(tt_os2.usWinDescent); + cell_height = ascent + descent; + ok(ntm->ntmCellHeight == cell_height, "%s: ntmCellHeight %u != %u, os2.usWinAscent/os2.usWinDescent %u/%u\n", + font_name, ntm->ntmCellHeight, cell_height, ascent, descent); + SetLastError(0xdeadbeef); ret = GetTextMetricsA(hdc, &tmA); ok(ret, "GetTextMetricsA error %u\n", GetLastError()); @@ -3067,7 +3074,7 @@ static INT CALLBACK enum_truetype_font_proc(const LOGFONT *lf, const TEXTMETRIC if (type == TRUETYPE_FONTTYPE) { (*enumed)++; - test_text_metrics(lf); + test_text_metrics(lf, (const NEWTEXTMETRIC *)ntm); } return 1; }