Dmitry Timoshkov : gdi32: Add a test for ntmCellHeight calculation.

Alexandre Julliard julliard at winehq.org
Tue May 8 14:16:55 CDT 2012


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Tue May  8 19:29:02 2012 +0900

gdi32: Add a test for ntmCellHeight calculation.

---

 dlls/gdi32/tests/font.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 1708c49..f50d1bc 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;
 }




More information about the wine-cvs mailing list