[PATCH v3 2/4] dwrite/tests: Add some tests for Segoe UI Symbol font family.

Dmitry Timoshkov dmitry at baikal.ru
Mon Apr 4 10:10:12 CDT 2022


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/dwrite/tests/layout.c | 68 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index 76f69892226..c36f370d7da 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -6575,6 +6575,73 @@ static void test_SegoeUI(void)
     IDWriteFactory2_Release(factory);
 }
 
+static void test_SegoeUI_Symbol(void)
+{
+    static const WCHAR * const families[] = { L"", L"Tahoma", L"Marlett", L"Symbol", L"Webdings", L"Wingdings", NULL };
+    static const WCHAR text[] = { 0x25d4, 0 };
+    HRESULT hr;
+    IDWriteFactory2 *factory;
+    IDWriteFontCollection *collection;
+    IDWriteFont *font;
+    IDWriteFontFallback *fallback;
+    UINT32 index, i, mappedlength;
+    WCHAR name[256];
+    BOOL exists;
+    FLOAT scale;
+
+    hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, &IID_IDWriteFactory2, (IUnknown **)&factory);
+    if (hr != S_OK)
+    {
+        win_skip("IDWriteFactory2 is not supported\n");
+        return;
+    }
+
+    hr = IDWriteFactory2_GetSystemFontCollection(factory, &collection, FALSE);
+    ok(hr == S_OK, "got %#x\n", hr);
+
+    hr = IDWriteFontCollection_FindFamilyName(collection, L"Segoe UI Symbol", &index, &exists);
+    ok(hr == S_OK, "got %#x\n", hr);
+    if (!exists)
+    {
+        skip("Segoe UI Symbol is not installed\n");
+        IDWriteFontCollection_Release(collection);
+        IDWriteFactory2_Release(factory);
+        return;
+    }
+    ok(index != UINT_MAX && exists, "Segoe UI Symbol was not found\n");
+
+    hr = IDWriteFactory2_GetSystemFontFallback(factory, &fallback);
+    ok(hr == S_OK, "got %#x\n", hr);
+
+    g_source = text;
+
+    for (i = 0; i < ARRAY_SIZE(families); i++)
+    {
+        hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 0, 1, collection, families[i], DWRITE_FONT_WEIGHT_NORMAL,
+            DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, &mappedlength, &font, &scale);
+todo_wine_if(families[i] == NULL)
+        ok(hr == S_OK, "%u: %s - got %#x\n", i, wine_dbgstr_w(families[i]), hr);
+        if (hr != S_OK) continue;
+        ok(mappedlength == 1, "got %u\n", mappedlength);
+        ok(scale == 1.0f, "got %f\n", scale);
+
+        get_font_name(font, name, ARRAY_SIZE(name));
+todo_wine
+        ok(!wcscmp(name, L"Segoe UI Symbol"), "got %s\n", wine_dbgstr_w(name));
+
+        hr = IDWriteFont_HasCharacter(font, 0x25d4, &exists);
+        ok(hr == S_OK, "got %#x\n", hr);
+todo_wine
+        ok(exists, "%s should have character 0x25d4\n", wine_dbgstr_w(name));
+
+        IDWriteFont_Release(font);
+    }
+
+    IDWriteFontFallback_Release(fallback);
+    IDWriteFontCollection_Release(collection);
+    IDWriteFactory2_Release(factory);
+}
+
 START_TEST(layout)
 {
     IDWriteFactory *factory;
@@ -6631,6 +6698,7 @@ START_TEST(layout)
     test_layout_range_length();
     test_HitTestTextRange();
     test_SegoeUI();
+    test_SegoeUI_Symbol();
 
     IDWriteFactory_Release(factory);
 }
-- 
2.35.1




More information about the wine-devel mailing list