Akihiro Sagawa : gdi32/tests: Test substituted face family name.

Alexandre Julliard julliard at winehq.org
Mon Nov 8 15:45:05 CST 2021


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

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Thu Nov  4 23:18:22 2021 +0900

gdi32/tests: Test substituted face family name.

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 | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index f93e5e5e5d0..a8880c263ae 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -7786,6 +7786,51 @@ static void test_select_object(void)
     DeleteObject(hfont);
 }
 
+static void test_GetOutlineTextMetrics_subst(void)
+{
+    OUTLINETEXTMETRICA *otm;
+    LOGFONTA lf;
+    HFONT hfont, hfont_old;
+    HDC hdc;
+    DWORD ret;
+    char face_name[LF_FACESIZE];
+    const char* family_name;
+
+    if (!is_font_installed("MS SHELL DLG"))
+    {
+        skip("MS Shell Dlg is not installed\n");
+        return;
+    }
+
+    hdc = GetDC(0);
+    memset(&lf, 0, sizeof(lf));
+    strcpy(lf.lfFaceName, "MS SHELL DLG");
+    lf.lfCharSet = DEFAULT_CHARSET;
+    hfont = CreateFontIndirectA(&lf);
+    ok(hfont != NULL, "failed to create a font\n");
+    hfont_old = SelectObject(hdc, hfont);
+
+    /* face name */
+    ret = GetTextFaceA(hdc, sizeof(face_name), face_name);
+    ok(ret, "GetTextFace failed\n");
+    ok(!lstrcmpiA(lf.lfFaceName, face_name), "expected %s, got %s\n", lf.lfFaceName, face_name);
+
+    ret = GetOutlineTextMetricsA(hdc, 0, NULL);
+    otm = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ret);
+    ret = GetOutlineTextMetricsA(hdc, ret, otm);
+    ok(ret != 0, "GetOutlineTextMetrics failed\n");
+
+    /* family name */
+    family_name = (const char*)otm + (UINT_PTR)otm->otmpFamilyName;
+    todo_wine ok(lstrcmpiA(lf.lfFaceName, family_name), "expected a real family name (e.g. Tahoma), got %s\n", family_name);
+
+    HeapFree(GetProcessHeap(), 0, otm);
+    SelectObject(hdc, hfont_old);
+    DeleteObject(hfont);
+
+    ReleaseDC(0, hdc);
+}
+
 START_TEST(font)
 {
     static const char *test_names[] =
@@ -7818,6 +7863,7 @@ START_TEST(font)
     test_GetGlyphIndices();
     test_GetKerningPairs();
     test_GetOutlineTextMetrics();
+    test_GetOutlineTextMetrics_subst();
     test_SetTextJustification();
     test_font_charset();
     test_GdiGetCodePage();




More information about the wine-cvs mailing list