Francois Gouget : jscript/tests: Some tests require that the user interface be in English.

Alexandre Julliard julliard at winehq.org
Mon Sep 19 13:48:41 CDT 2011


Module: wine
Branch: master
Commit: 405c3ef483f9661a2983c0c1bad76012c342f7ca
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=405c3ef483f9661a2983c0c1bad76012c342f7ca

Author: Francois Gouget <fgouget at free.fr>
Date:   Sun Sep 18 19:38:18 2011 +0200

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

---

 dlls/jscript/tests/run.c |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c
index fbbff96..3ad9600 100644
--- a/dlls/jscript/tests/run.c
+++ b/dlls/jscript/tests/run.c
@@ -108,6 +108,29 @@ static IDispatch *script_disp;
 static int invoke_version;
 static IActiveScriptError *script_error;
 
+/* Returns true if the user interface is in English. Note that this does not
+ * presume of the formatting of dates, numbers, etc.
+ */
+static BOOL is_lang_english(void)
+{
+    static HMODULE hkernel32 = NULL;
+    static LANGID (WINAPI *pGetThreadUILanguage)(void) = NULL;
+    static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
+
+    if (!hkernel32)
+    {
+        hkernel32 = GetModuleHandleA("kernel32.dll");
+        pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage");
+        pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
+    }
+    if (pGetThreadUILanguage)
+        return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH;
+    if (pGetUserDefaultUILanguage)
+        return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
+
+    return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
+}
+
 static BSTR a2bstr(const char *str)
 {
     BSTR ret;
@@ -1145,8 +1168,8 @@ static void test_IActiveScriptError(IActiveScriptError *error, SCODE errorcode,
 
     ok(excep.wCode == 0, "IActiveScriptError_GetExceptionInfo -- excep.wCode: expected 0, got 0x%08x\n", excep.wCode);
     ok(excep.wReserved == 0, "IActiveScriptError_GetExceptionInfo -- excep.wReserved: expected 0, got %d\n", excep.wReserved);
-    if (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) != LANG_ENGLISH)
-        skip("Non-english locale (test with hardcoded strings)\n");
+    if (!is_lang_english())
+        skip("Non-english UI (test with hardcoded strings)\n");
     else {
         ok(excep.bstrSource != NULL && !lstrcmpW(excep.bstrSource, script_source),
            "IActiveScriptError_GetExceptionInfo -- excep.bstrSource is not valid: expected %s, got %s\n",




More information about the wine-cvs mailing list