[PATCH 2/6] dwrite/tests: Test MapCharacters with a font name not in the collection.

Giovanni Mascellani gmascellani at codeweavers.com
Mon Mar 8 03:31:15 CST 2021


Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
---
 dlls/dwrite/tests/layout.c | 41 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index d186f47cc94..b0930e9344a 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -4501,6 +4501,7 @@ static void test_SetWordWrapping(void)
 /* Collection dedicated to fallback testing */
 
 static const WCHAR g_blahfontW[] = {'B','l','a','h',0};
+static const WCHAR g_fontNotInCollectionW[] = {'n','o','t','B','l','a','h',0};
 static HRESULT WINAPI fontcollection_QI(IDWriteFontCollection *iface, REFIID riid, void **obj)
 {
     if (IsEqualIID(riid, &IID_IDWriteFontCollection) || IsEqualIID(riid, &IID_IUnknown)) {
@@ -4562,6 +4563,9 @@ static HRESULT WINAPI fontcollection_FindFamilyName(IDWriteFontCollection *iface
         *index = 123456;
         *exists = TRUE;
         return S_OK;
+    } else if (!lstrcmpW(name, g_fontNotInCollectionW)) {
+        *exists = FALSE;
+        return S_OK;
     }
     ok(0, "unexpected call, name %s\n", wine_dbgstr_w(name));
     return E_NOTIMPL;
@@ -4749,6 +4753,43 @@ todo_wine
     IDWriteFont_Release(font);
 }
 
+    /* Explicit collection, but forcing a font that does not exist in it. */
+    /* 1. Latin part */
+    g_source = str2W;
+    mappedlength = 0;
+    scale = 0.0f;
+    font = NULL;
+    hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 0, 3, &fallbackcollection, g_fontNotInCollectionW, DWRITE_FONT_WEIGHT_NORMAL,
+        DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, &mappedlength, &font, &scale);
+todo_wine {
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(mappedlength == 1, "got %u\n", mappedlength);
+}
+    ok(scale == 1.0f, "got %f\n", scale);
+todo_wine
+    ok(font != NULL, "got %p\n", font);
+if (font) {
+    IDWriteFont_Release(font);
+}
+
+    /* 2. Hiragana character */
+    g_source = str2W;
+    mappedlength = 0;
+    scale = 0.0f;
+    font = NULL;
+    hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 1, 1, &fallbackcollection, g_fontNotInCollectionW, DWRITE_FONT_WEIGHT_NORMAL,
+        DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, &mappedlength, &font, &scale);
+todo_wine {
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(mappedlength == 1, "got %u\n", mappedlength);
+}
+    ok(scale == 1.0f, "got %f\n", scale);
+todo_wine
+    ok(font != NULL, "got %p\n", font);
+if (font) {
+    IDWriteFont_Release(font);
+}
+
     IDWriteFontFallback_Release(fallback);
     IDWriteFactory2_Release(factory2);
 }
-- 
2.30.1




More information about the wine-devel mailing list