mlang/tests: Fix the check for non-English locales in test_GetCodePageInfo().

The strings returned by GetCodePageInfo() depend on the thread's UI
language, not the system locale or the thread's standards and formats
settings.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Francois Gouget 2021-07-06 16:56:23 +02:00 committed by Alexandre Julliard
parent f24c8c75fe
commit 237befbe4d
1 changed files with 25 additions and 3 deletions

View File

@ -2511,6 +2511,29 @@ static void test_DetectOutboundCodePageInIStream(IMultiLanguage3 *ml)
todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
}
/* 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 test_GetCodePageInfo(IMultiLanguage2 *iML2)
{
static const DWORD VALID_MASK = (DWORD)(~(MIMECONTF_VALID_NLS | MIMECONTF_VALID));
@ -2560,10 +2583,9 @@ static void test_GetCodePageInfo(IMultiLanguage2 *iML2)
"%d: got wrong wszBodyCharset expected %s return %s.\n",
i, wine_dbgstr_w(cpinfo_cmp.wszBodyCharset), wine_dbgstr_w(cpinfo.wszBodyCharset));
if ((PRIMARYLANGID(LANGIDFROMLCID(GetSystemDefaultLCID())) != LANG_ENGLISH) ||
(PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) != LANG_ENGLISH))
if (!is_lang_english())
{
/* FIXME: Windows returns description and font name in system's language */
/* FIXME: Cannot test non-English descriptions and font names */
skip("Non-English locale\n");
}
else