ieframe/tests: Some tests require that the user interface be in English. (resend)

Francois Gouget fgouget at free.fr
Fri Sep 16 08:33:22 CDT 2011


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

This is essentially the same patch as before. TestBot reports that it 
fails on two VMs:
 * WNT4WSSP6
   I sent an unrelated patch fixing the tests on this VM (unsupported 
   WebBrowser).

 * W2KPROSP4
   These failures are too complex for me to fix but they were already 
   present before this patch:
   https://testbot.winehq.org/JobDetails.pl?Key=14327

The plus side is that this patch fix WineTest on my Windows 7 VM. So it 
has 0 downsides and one win.

http://test.winehq.org/data/54b37b8c41206ab301fd04623d0a034ff543bc52/win7_fg-win7u64fr-t32/ieframe:webbrowser.html


 dlls/ieframe/tests/webbrowser.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/dlls/ieframe/tests/webbrowser.c b/dlls/ieframe/tests/webbrowser.c
index 229f79d..50015ac 100644
--- a/dlls/ieframe/tests/webbrowser.c
+++ b/dlls/ieframe/tests/webbrowser.c
@@ -159,6 +159,30 @@ static const char *current_url;
 
 static DWORD dwl_flags;
 
+
+/* 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 int strcmp_wa(LPCWSTR strw, const char *stra)
 {
     CHAR buf[512];
@@ -2083,7 +2107,7 @@ static void test_ie_funcs(IUnknown *unk)
     /* Name */
     hres = IWebBrowser2_get_Name(wb, &sName);
     ok(hres == S_OK, "getName failed: %08x, expected S_OK\n", hres);
-    if (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) == LANG_ENGLISH)
+    if (is_lang_english())
         ok(!strcmp_wa(sName, "Microsoft Web Browser Control"), "got '%s', expected 'Microsoft Web Browser Control'\n", wine_dbgstr_w(sName));
     else /* Non-English cannot be blank. */
         ok(sName!=NULL, "get_Name return a NULL string.\n");
-- 
1.7.5.4



More information about the wine-patches mailing list