[PATCH 3/6] dwrite/tests: Test harder font fallback with mixed scripts.
Giovanni Mascellani
gmascellani at codeweavers.com
Mon Mar 8 03:31:16 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 b0930e9344a..1c7cdad006b 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -4591,7 +4591,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;
@@ -4672,12 +4672,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);
@@ -4697,7 +4697,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
@@ -4711,7 +4711,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);
@@ -4741,6 +4741,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);
@@ -4759,7 +4784,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);
@@ -4790,6 +4815,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