[RFC PATCH] advapi32/tests: Check the timezone name size limits in all languages.

Francois Gouget fgouget at codeweavers.com
Thu Mar 10 12:47:00 CST 2022


The localized standard and daylight timezone names returned by
EnumDynamicTimeZoneInformation() must fit in a 32 character buffer.
But there is no such limitation in Wine's PO files and the regular
WineTest runs only cover some locales. So use SetThreadUILanguage() to
verify the translations in all the known languages.

Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=51619
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
Unfortunately SetThreadUILanguage() is a stub in Wine so this currently
has no effect where we need it.
Also while going through all of Wine's ~150 known languages only takes
about 35 seconds, this would benefit from some parallelization to
speed things up (see d3d11:d3d11 for instance). I can send a patch for
that if this approach is deemed worthwhile.
Note that on Windows we typically only install a few language packs,
resulting in only about 20 loops and a sub 4 second runtime. So the
optimization is not as necessary there.
---
 dlls/advapi32/tests/registry.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c
index 6152a313803..4eefd18cf5f 100644
--- a/dlls/advapi32/tests/registry.c
+++ b/dlls/advapi32/tests/registry.c
@@ -4308,7 +4308,7 @@ static void test_RegLoadMUIString(void)
     SetEnvironmentVariableA("WineMuiDat", NULL);
 }
 
-static void test_EnumDynamicTimeZoneInformation(void)
+static BOOL CALLBACK test_EnumDynamicTimeZoneInformation(LPSTR value, LONG_PTR lParam)
 {
     LSTATUS status;
     HKEY key, subkey;
@@ -4329,7 +4329,14 @@ static void test_EnumDynamicTimeZoneInformation(void)
     if (!pEnumDynamicTimeZoneInformation)
     {
         win_skip("EnumDynamicTimeZoneInformation is not supported.\n");
-        return;
+        return FALSE;
+    }
+
+    if (value)
+    {
+        LANGID lang = strtol(value, NULL, 16);
+        winetest_push_context("lang=%04x", lang);
+        ok(SetThreadUILanguage(lang) == lang, "SetThreadUILanguage(%04x) failed: gle=%lu\n", lang, GetLastError());
     }
 
     if (pRegLoadMUIStringW)
@@ -4473,6 +4480,8 @@ static void test_EnumDynamicTimeZoneInformation(void)
     ok(!memcmp(&dtzi, &bogus_dtzi, sizeof(dtzi)), "mismatch\n");
 
     RegCloseKey(key);
+    winetest_pop_context();
+    return TRUE;
 }
 
 START_TEST(registry)
@@ -4512,8 +4521,14 @@ START_TEST(registry)
     test_RegNotifyChangeKeyValue();
     test_performance_keys();
     test_RegLoadMUIString();
-    test_EnumDynamicTimeZoneInformation();
     test_perflib_key();
+    if (SetThreadUILanguage(0xffff) == 0xffff)
+    {
+        skip("SetThreadUILanguage() is a stub; test the current UI language\n");
+        test_EnumDynamicTimeZoneInformation(NULL, 0);
+    }
+    else
+        EnumUILanguagesA(test_EnumDynamicTimeZoneInformation, MUI_LANGUAGE_ID, 0);
 
     /* cleanup */
     delete_key( hkey_main );
-- 
2.30.2



More information about the wine-devel mailing list