Francois Gouget : mshtml/tests: Improve the current UI language detection a bit.

Alexandre Julliard julliard at winehq.org
Thu Sep 15 12:34:53 CDT 2011


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

Author: Francois Gouget <fgouget at free.fr>
Date:   Thu Sep 15 11:01:01 2011 +0200

mshtml/tests: Improve the current UI language detection a bit.

---

 dlls/mshtml/tests/htmldoc.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c
index 03f2539..f7aef38 100644
--- a/dlls/mshtml/tests/htmldoc.c
+++ b/dlls/mshtml/tests/htmldoc.c
@@ -283,16 +283,23 @@ static BSTR a2bstr(const char *str)
     return ret;
 }
 
-static BOOL is_english(void)
+/* 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;
 
@@ -1629,7 +1636,7 @@ static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
 
     if(expect_InPlaceUIWindow_SetActiveObject_active) {
         ok(pActiveObject != NULL, "pActiveObject = NULL\n");
-        if(pActiveObject && is_english())
+        if(pActiveObject && is_lang_english())
             ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
     }
     else {
@@ -1649,7 +1656,7 @@ static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
     if(pActiveObject) {
         CHECK_EXPECT2(SetActiveObject);
 
-        if(pActiveObject && is_english())
+        if(pActiveObject && is_lang_english())
             ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
     }else {
         CHECK_EXPECT(SetActiveObject_null);




More information about the wine-cvs mailing list