gdi32/tests: test CreateFontIndirect for suffix stripping

André Hentschel nerv at dawncrow.de
Fri Nov 13 15:27:30 CST 2009


Apparently the suffixes shouldnt be stripped. Me and some others get a mass of errors with some windows fonts we use in linux.
The Problem was introduced with: 3156df85399a3da49220fbd6e02ac2f9c8553add , but without a test.
So here is a test to have a closer look at this.
---
 dlls/gdi32/tests/font.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index b67670f..a745f47 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -2977,6 +2977,43 @@ static void test_GetTextMetrics2(const char *fontname, int font_height)
     ok(ratio >= 90 && ratio <= 110, "expected width/height ratio 90-110, got %d\n", ratio);
 }
 
+void test_CreateFontIndirect(void)
+{
+    LOGFONTA lf, getobj_lf;
+    int ret;
+    HFONT hfont;
+
+    memset(&lf, 0, sizeof(lf));
+
+    lf.lfCharSet = ANSI_CHARSET;
+    lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
+    lf.lfWeight = FW_DONTCARE;
+    lf.lfHeight = 16;
+    lf.lfWidth = 16;
+    lf.lfQuality = DEFAULT_QUALITY;
+
+    lstrcpyA(lf.lfFaceName, "Arial");
+    hfont = CreateFontIndirectA(&lf);
+    ok(hfont != 0, "CreateFontIndirectA failed\n");
+    ret = GetObject(hfont, sizeof(getobj_lf), &getobj_lf);
+    ok(!lstrcmpA(lf.lfFaceName, getobj_lf.lfFaceName), "font names don't match: %s != %s\n", lf.lfFaceName, getobj_lf.lfFaceName);
+    DeleteObject(hfont);
+
+    lstrcpyA(lf.lfFaceName, "Arial Bold");
+    hfont = CreateFontIndirectA(&lf);
+    ok(hfont != 0, "CreateFontIndirectA failed\n");
+    ret = GetObject(hfont, sizeof(getobj_lf), &getobj_lf);
+    todo_wine ok(!lstrcmpA(lf.lfFaceName, getobj_lf.lfFaceName), "font names don't match: %s != %s\n", lf.lfFaceName, getobj_lf.lfFaceName);
+    DeleteObject(hfont);
+
+    lstrcpyA(lf.lfFaceName, "Arial Italic");
+    hfont = CreateFontIndirectA(&lf);
+    ok(hfont != 0, "CreateFontIndirectA failed\n");
+    ret = GetObject(hfont, sizeof(getobj_lf), &getobj_lf);
+    todo_wine ok(!lstrcmpA(lf.lfFaceName, getobj_lf.lfFaceName), "font names don't match: %s != %s\n", lf.lfFaceName, getobj_lf.lfFaceName);
+    DeleteObject(hfont);
+}
+
 START_TEST(font)
 {
     init();
@@ -3020,4 +3057,5 @@ START_TEST(font)
     test_GetTextMetrics2("Arial", -11);
     test_GetTextMetrics2("Arial", -55);
     test_GetTextMetrics2("Arial", -110);
+    test_CreateFontIndirect();
 }
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list