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

Alexandre Julliard julliard at winehq.org
Fri Sep 16 13:28:30 CDT 2011


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

Author: Francois Gouget <fgouget at free.fr>
Date:   Fri Sep 16 01:05:20 2011 +0200

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

---

 dlls/pdh/tests/pdh.c |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/dlls/pdh/tests/pdh.c b/dlls/pdh/tests/pdh.c
index f6fac16..9690020 100644
--- a/dlls/pdh/tests/pdh.c
+++ b/dlls/pdh/tests/pdh.c
@@ -37,6 +37,30 @@ static PDH_STATUS   (WINAPI *pPdhValidatePathExW)(PDH_HLOG, LPCWSTR);
 
 #define GETFUNCPTR(func) p##func = (void *)GetProcAddress( pdh, #func );
 
+
+/* 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 void init_function_ptrs( void )
 {
     pdh = GetModuleHandle( "pdh" );
@@ -962,9 +986,9 @@ static void test_PdhGetDllVersion(void)
 
 START_TEST(pdh)
 {
-    if (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) != LANG_ENGLISH)
+    if (!is_lang_english())
     {
-        skip("non-english locale\n");
+        skip("An English UI is needed for the pdh tests\n");
         return;
     }
     init_function_ptrs();




More information about the wine-cvs mailing list