shlwapi/tests: Some tests require that the user interface be in English.

Francois Gouget fgouget at free.fr
Tue Sep 13 17:11:58 CDT 2011


With MUI versions of Windows checking for the default user language id is insufficient.
---

See also:
http://www.winehq.org/pipermail/wine-patches/2011-September/106732.html

 dlls/shlwapi/tests/string.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/dlls/shlwapi/tests/string.c b/dlls/shlwapi/tests/string.c
index 64e5b59..91450ee 100644
--- a/dlls/shlwapi/tests/string.c
+++ b/dlls/shlwapi/tests/string.c
@@ -197,6 +197,23 @@ static const StrFromTimeIntervalResult StrFromTimeInterval_results[] = {
   { 0, 0, NULL }
 };
 
+
+static BOOL is_english(void)
+{
+    static HMODULE hkernel32 = NULL;
+    static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
+
+    if (!hkernel32)
+    {
+        hkernel32 = GetModuleHandleA("kernel32.dll");
+        pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
+    }
+    if (pGetUserDefaultUILanguage)
+        return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
+
+    return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
+}
+
 static void test_StrChrA(void)
 {
   char string[129];
@@ -1405,7 +1422,7 @@ START_TEST(string)
   test_StrDupA();
 
   /* language-dependent test */
-  if (PRIMARYLANGID(GetUserDefaultLangID()) != LANG_ENGLISH)
+  if (!is_english())
     skip("English is required for StrFromTimeInterval and StrFormat*Size tests\n");
   else
   {
-- 
1.7.5.4




More information about the wine-patches mailing list