Akihiro Sagawa : gdi32/tests: Add more text metrics tests in synthetic bold bitmap fonts.

Alexandre Julliard julliard at winehq.org
Mon May 14 06:54:22 CDT 2018


Module: wine
Branch: stable
Commit: a1e691aeaf0aebd4964ed30eefd974bba596f131
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a1e691aeaf0aebd4964ed30eefd974bba596f131

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Sun Feb 18 21:34:40 2018 +0900

gdi32/tests: Add more text metrics tests in synthetic bold bitmap fonts.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit b4a10d17c62d340a9578e8bf7715d78ec34551bc)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/gdi32/tests/font.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 9f02095..de0693b 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -6439,7 +6439,7 @@ static void test_fake_bold_font(void)
         ABC abc;
         INT w;
         GLYPHMETRICS gm;
-    } data[2];
+    } data[4];
     int i;
     DWORD r;
 
@@ -6496,6 +6496,63 @@ static void test_fake_bold_font(void)
        "expected %d, got %d\n", data[0].gm.gmCellIncX + 1, data[1].gm.gmCellIncX);
     ok(data[0].gm.gmCellIncY == data[1].gm.gmCellIncY,
        "expected %d, got %d\n", data[0].gm.gmCellIncY, data[1].gm.gmCellIncY);
+
+    /* Test bitmap font */
+    memset(&data, 0xaa, sizeof(data));
+    memset(&lf, 0, sizeof(lf));
+    strcpy(lf.lfFaceName, "Courier");
+    lf.lfCharSet = ANSI_CHARSET;
+
+    hdc = GetDC(NULL);
+
+    for (i = 0; i < 4; i++)
+    {
+        HFONT hfont, hfont_old;
+
+        lf.lfWeight = (i % 2) ? FW_BOLD : FW_NORMAL;
+        lf.lfHeight = (i > 1) ? data[0].tm.tmHeight * x2_mat.eM11.value : 0;
+        hfont = CreateFontIndirectA(&lf);
+        hfont_old = SelectObject(hdc, hfont);
+
+        ret = GetTextMetricsA(hdc, &data[i].tm);
+        ok(ret, "got %d\n", ret);
+        ret = pGetCharWidth32A(hdc, 0x76, 0x76, &data[i].w);
+        ok(ret, "got %d\n", ret);
+
+        SelectObject(hdc, hfont_old);
+        DeleteObject(hfont);
+    }
+    ReleaseDC(NULL, hdc);
+
+    /* compare results (bitmap) */
+    for (i = 0; i < 4; i+=2)
+    {
+        int diff = (i > 1) ? x2_mat.eM11.value : 1;
+        if (data[i].tm.tmPitchAndFamily & TMPF_TRUETYPE)
+        {
+            skip("TrueType font is selected (expected a bitmap one)\n");
+            continue;
+        }
+        ok(data[i].tm.tmHeight == data[i+1].tm.tmHeight,
+           "expected %d, got %d\n", data[i].tm.tmHeight, data[i+1].tm.tmHeight);
+        ok(data[i].tm.tmAscent == data[i+1].tm.tmAscent,
+           "expected %d, got %d\n", data[i].tm.tmAscent, data[i+1].tm.tmAscent);
+        ok(data[i].tm.tmDescent == data[i+1].tm.tmDescent,
+           "expected %d, got %d\n", data[i].tm.tmDescent, data[i+1].tm.tmDescent);
+        todo_wine
+        ok(data[i+1].tm.tmAveCharWidth - data[i].tm.tmAveCharWidth == diff,
+           "expected %d, got %d\n", diff, data[i+1].tm.tmAveCharWidth - data[i].tm.tmAveCharWidth);
+        todo_wine
+        ok(data[i+1].tm.tmMaxCharWidth - data[i].tm.tmMaxCharWidth == diff,
+           "expected %d, got %d\n", diff, data[i+1].tm.tmMaxCharWidth - data[i].tm.tmMaxCharWidth);
+        ok(data[i].tm.tmOverhang == 0,
+           "expected 0, got %d\n", data[i].tm.tmOverhang);
+        todo_wine
+        ok(data[i+1].tm.tmOverhang == 1,
+           "expected 1, got %d\n", data[i+1].tm.tmOverhang);
+        ok(data[i].w + 1 == data[i+1].w,
+           "expected %d, got %d\n", data[i].w + 1, data[i+1].w);
+    }
 }
 
 static void test_bitmap_font_glyph_index(void)




More information about the wine-cvs mailing list