Akihiro Sagawa : gdi32/tests: Add more ABC width tests in various widths.

Alexandre Julliard julliard at winehq.org
Thu Feb 8 15:33:08 CST 2018


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

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Sun Feb  4 21:02:09 2018 +0900

gdi32/tests: Add more ABC width tests in various widths.

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>

---

 dlls/gdi32/tests/font.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 4bac19a..7a74565 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -1340,6 +1340,56 @@ static void test_GetCharABCWidths(void)
        "got %d, expected %d (C)\n", abc[0].abcC, abcw[0].abcC);
 
     DeleteObject(SelectObject(hdc, hfont));
+
+    /* test abcA == gmptGlyphOrigin.x && abcB == gmBlackBoxX
+       in various widths. */
+    for (i = 1; i <= 2; i++)
+    {
+        UINT j;
+        UINT code;
+
+        memset(&lf, 0, sizeof(lf));
+        lf.lfHeight = 20;
+        switch(i)
+        {
+        case 1:
+            strcpy(lf.lfFaceName, "Tahoma");
+            code = 'a';
+            break;
+        case 2:
+            strcpy(lf.lfFaceName, "Times New Roman");
+            lf.lfItalic = TRUE;
+            code = 'f';
+            break;
+        }
+        if (!is_truetype_font_installed(lf.lfFaceName))
+        {
+            skip("%s is not installed\n", lf.lfFaceName);
+            continue;
+        }
+        for (j = 1; j <= 80; j++)
+        {
+            GLYPHMETRICS gm;
+
+            lf.lfWidth = j;
+            hfont = CreateFontIndirectA(&lf);
+            hfont = SelectObject(hdc, hfont);
+
+            nb = GetGlyphOutlineA(hdc, code, GGO_METRICS, &gm, 0, NULL, &mat);
+            ok(nb, "GetGlyphOutlineA should have succeeded at width %d\n", i);
+
+            ret = GetCharABCWidthsA(hdc, code, code, abc);
+            ok(ret, "GetCharABCWidthsA should have succeeded at width %d\n", i);
+
+            ok(abc[0].abcA == gm.gmptGlyphOrigin.x,
+               "abcA(%d) and gmptGlyphOrigin.x(%d) values are different at width %d\n",
+               abc[0].abcA, gm.gmptGlyphOrigin.x, i);
+            ok(abc[0].abcB == gm.gmBlackBoxX,
+               "abcB(%d) and gmBlackBoxX(%d) values are different at width %d\n",
+               abc[0].abcB, gm.gmBlackBoxX, i);
+            DeleteObject(SelectObject(hdc, hfont));
+        }
+    }
     ReleaseDC(NULL, hdc);
 
     trace("ABC sign test for a variety of transforms:\n");




More information about the wine-cvs mailing list