[PATCH 6/9] dwrite/tests: Test harder font fallback with mixed scripts.

Giovanni Mascellani gmascellani at codeweavers.com
Thu Mar 4 04:23:09 CST 2021


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

diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index 134a7ec7e02..51290d167d9 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -4628,7 +4628,7 @@ static IDWriteFontCollection fallbackcollection = { &fallbackcollectionvtbl };
 
 static void test_MapCharacters(void)
 {
-    static const WCHAR str2W[] = {'a',0x3058,'b',0};
+    static const WCHAR str2W[] = {'a',0x3058,0x3059,'b',0};
     IDWriteLocalizedStrings *strings;
     IDWriteFontFallback *fallback;
     IDWriteFactory2 *factory2;
@@ -4709,12 +4709,12 @@ todo_wine
 if (font) {
     IDWriteFont_Release(font);
 }
-    /* string 'a\x3058b' */
+    /* string 'a\x3058\x3059b' */
     g_source = str2W;
     mappedlength = 0;
     scale = 0.0f;
     font = NULL;
-    hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 0, 3, NULL, NULL, DWRITE_FONT_WEIGHT_NORMAL,
+    hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 0, 4, NULL, NULL, 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);
@@ -4734,7 +4734,7 @@ if (font) {
         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(mappedlength == 2, "got %u\n", mappedlength);
 }
     ok(scale == 1.0f, "got %f\n", scale);
 todo_wine
@@ -4748,7 +4748,7 @@ if (font) {
     mappedlength = 0;
     scale = 0.0f;
     font = NULL;
-    hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 0, 3, &fallbackcollection, g_blahfontW, DWRITE_FONT_WEIGHT_NORMAL,
+    hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 0, 4, &fallbackcollection, g_blahfontW, DWRITE_FONT_WEIGHT_NORMAL,
         DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, &mappedlength, &font, &scale);
     ok(hr == S_OK, "got 0x%08x\n", hr);
     ok(mappedlength == 1, "got %u\n", mappedlength);
@@ -4778,6 +4778,31 @@ if (font) {
     ok(scale == 1.0f, "got %f\n", scale);
     ok(font != NULL, "got %p\n", font);
 
+if (font) {
+    exists = FALSE;
+    hr = IDWriteFont_GetInformationalStrings(font, DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, &strings, &exists);
+    ok(hr == S_OK && exists, "got 0x%08x, exists %d\n", hr, exists);
+    hr = IDWriteLocalizedStrings_GetString(strings, 0, buffW, ARRAY_SIZE(buffW));
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+todo_wine
+    ok(lstrcmpW(buffW, L"Tahoma"), "Unexpected string %s.\n", wine_dbgstr_w(buffW));
+    IDWriteLocalizedStrings_Release(strings);
+    IDWriteFont_Release(font);
+}
+
+    /* 3. Hiragana character and Latin character, force Tahoma font does not support Japanese */
+    g_source = str2W;
+    mappedlength = 0;
+    scale = 0.0f;
+    font = NULL;
+    hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 1, 3, &fallbackcollection, g_blahfontW, DWRITE_FONT_WEIGHT_NORMAL,
+        DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, &mappedlength, &font, &scale);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+todo_wine
+    ok(mappedlength == 2, "got %u\n", mappedlength);
+    ok(scale == 1.0f, "got %f\n", scale);
+    ok(font != NULL, "got %p\n", font);
+
 if (font) {
     exists = FALSE;
     hr = IDWriteFont_GetInformationalStrings(font, DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, &strings, &exists);
@@ -4796,7 +4821,7 @@ todo_wine
     mappedlength = 0;
     scale = 0.0f;
     font = NULL;
-    hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 0, 3, &fallbackcollection, g_fontNotInCollectionW, DWRITE_FONT_WEIGHT_NORMAL,
+    hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 0, 4, &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);
@@ -4827,6 +4852,22 @@ if (font) {
     IDWriteFont_Release(font);
 }
 
+    /* 3. Hiragana character and Latin character */
+    g_source = str2W;
+    mappedlength = 0;
+    scale = 0.0f;
+    font = NULL;
+    hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 1, 3, &fallbackcollection, g_blahfontW, DWRITE_FONT_WEIGHT_NORMAL,
+        DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, &mappedlength, &font, &scale);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+todo_wine
+    ok(mappedlength == 2, "got %u\n", mappedlength);
+    ok(scale == 1.0f, "got %f\n", scale);
+    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