[PATCH 1/2] gdi32/tests: Add locale-dependent face matching test.

Rémi Bernon rbernon at codeweavers.com
Mon Nov 23 06:20:49 CST 2020


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

This brings another ~200ms prefix startup time improvement, from ~1.2s
to ~1s for "wine cmd /c exit" execution time on average, as well as a
~50ms process startup time improvement, from ~0.25s to ~0.2s execution
time when prefix is already started.

The test shows that using wcsicmp is incorrect for face name comparison,
or at least that we should not rely on the current locale, and perf
also reports a high number of CPU cache miss coming from the locale
refcounting, which is the main source of improvement here.

IIUC RtlDowncaseUnicodeChar also does locale dependent case folding,
but I'm not sure to see how it's controlled (it's the system default
locale that defines the loaded tables right?), and we should probably
check if case matching depends on it. If not, is there any canonical
normalized unicode case folding that should be used instead?

 dlls/gdi32/tests/font.c              |  19 ++++++++++++++-----
 dlls/gdi32/tests/wine_langnames3.sfd |   4 ++--
 dlls/gdi32/tests/wine_langnames3.ttf | Bin 2048 -> 2076 bytes
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index d3ec971dce0..3bcbebaf91a 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -7269,12 +7269,21 @@ static void test_lang_names(void)
         /* either because it's the primary language, or because it's a secondary */
         ok( efnd.total == min( 2, i + 1 ), "%d: EnumFontFamiliesExA unexpected count %u.\n", i, efnd.total );
 
-        strcpy( font.lfFaceName, "Wine Lang Cond (fr)" );
-        memset( &efnd, 0, sizeof(efnd) );
-        EnumFontFamiliesExA( dc, &font, enum_fullname_data_proc, (LPARAM)&efnd, 0 );
+        wcscpy( font_w.lfFaceName, L"Wine Police d'écriture (fr)" );
+        memset( &efnd_w, 0, sizeof(efnd_w) );
+        EnumFontFamiliesExW( dc, &font_w, enum_fullname_data_proc_w, (LPARAM)&efnd_w, 0 );
         /* as wine_langnames3.sfd does not specify (en) name, (fr) is preferred */
-        if (i == 2) ok( efnd.total == 1, "%d: EnumFontFamiliesExA unexpected count %u.\n", i, efnd.total );
-        else ok( efnd.total == 0, "%d: EnumFontFamiliesExA unexpected count %u.\n", i, efnd.total );
+        if (i == 2) ok( efnd_w.total == 1, "%d: EnumFontFamiliesExW unexpected count %u.\n", i, efnd_w.total );
+        else ok( efnd_w.total == 0, "%d: EnumFontFamiliesExW unexpected count %u.\n", i, efnd_w.total );
+
+        /* case matching should not depend on the current locale */
+        if (i == 2)
+        {
+            wcscpy( font_w.lfFaceName, L"Wine POLICE D'ÉCRITURE (fr)" );
+            memset( &efnd_w, 0, sizeof(efnd_w) );
+            EnumFontFamiliesExW( dc, &font_w, enum_fullname_data_proc_w, (LPARAM)&efnd_w, 0 );
+            todo_wine ok( efnd_w.total == 1, "%d: EnumFontFamiliesExW unexpected count %u.\n", i, efnd_w.total );
+        }
 
         strcpy( font.lfFaceName, "Wine Lang Cond (ko)" );
         memset( &efnd, 0, sizeof(efnd) );
diff --git a/dlls/gdi32/tests/wine_langnames3.sfd b/dlls/gdi32/tests/wine_langnames3.sfd
index ea0dbff57d9..55536fa58c1 100644
--- a/dlls/gdi32/tests/wine_langnames3.sfd
+++ b/dlls/gdi32/tests/wine_langnames3.sfd
@@ -39,8 +39,8 @@ MarkAttachClasses: 1
 DEI: 91125
 LangName: 1036 \
     "" \
-    "Wine Lang Cond (fr)" \
-    "Reg (fr)" \
+    "Wine Police d'+AOkA-criture (fr)" \
+    "R+AOkA-guli+AOgA-re (fr)" \
     "" \
     "Wine Lang Cond Reg (fr)"
 LangName: 1042 \
diff --git a/dlls/gdi32/tests/wine_langnames3.ttf b/dlls/gdi32/tests/wine_langnames3.ttf
index dd76bd478bbb2546cfbbb7e9184cc7f602c59303..408d127fb1ef2a1d74977aecfb6d70a4ae03d838 100644
GIT binary patch
delta 236
zcmZn=m?JPjOo)R42xQz{T-_K%8AKQu*q=<)uxGq8F(X4`#|$<b1_tIi3=AwH1^LA#
z|L-xF0TpZjYS3a}1d>4PxX7<-<Bw=&dow0I24)6E79IvB1{tO_D4T^rkEsRB76PhP
zW7+~`GcgD--GQ<}YTj+0#G=c{ZpNU?V8~!N`53Dii<z#W;Uu=x_5lp}3^@#$49N_s
w3<?Y>4C)Lof$SonNC`tJkOqlrFr)!lnm{K70cF#H;vgL_K(d?Pu?aB(09p|&jsO4v

delta 192
zcmbOu&>%2DOo;sn0|SGMyNjzEgD8Ut0|Wbsi5m8d2PS4 at Xsl=c_lALic at 7Z&D9A4^
z`G1eW45(lVP=gi&Baj5*kW;bSHvWiawpU})V_;@rWZ_|8Vh~^ogR)r|^q4ZhY$2d(
zHKrL*Hb~6 at C>x~a(&kAlx{U0G3<eCk43?9Rv6`_M8t7V1Vmm##n_YxogCUKfh(Qx*
PWe`IuL;7Yeb|FRpHXtN(

-- 
2.29.2




More information about the wine-devel mailing list