mirror of
https://github.com/reactos/reactos.git
synced 2025-07-30 08:41:41 +00:00
[KERNEL32_APITEST] Add tests for GetLocaleInfoEx
This commit is contained in:
parent
5225c75d3b
commit
c37310b4e0
3 changed files with 93 additions and 0 deletions
|
@ -17,6 +17,7 @@ list(APPEND SOURCE
|
|||
GetCPInfo.c
|
||||
GetCurrentDirectory.c
|
||||
GetDriveType.c
|
||||
GetLocaleInfo.c
|
||||
GetModuleFileName.c
|
||||
GetVolumeInformation.c
|
||||
InitOnce.c
|
||||
|
|
90
modules/rostests/apitests/kernel32/GetLocaleInfo.c
Normal file
90
modules/rostests/apitests/kernel32/GetLocaleInfo.c
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GetLocaleInfo(Ex)
|
||||
* PROGRAMMER: Timo Kreuzer <timo.kreuzer@reactos.org>
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
typedef
|
||||
int
|
||||
WINAPI
|
||||
FN_GetLocaleInfoEx(
|
||||
_In_opt_ LPCWSTR lpLocaleName,
|
||||
_In_ LCTYPE LCType,
|
||||
_Out_opt_ LPWSTR lpLCData,
|
||||
_In_ int cchData);
|
||||
|
||||
FN_GetLocaleInfoEx* pGetLocaleInfoEx = NULL;
|
||||
|
||||
static void Test_GetLocaleInfoEx(void)
|
||||
{
|
||||
HMODULE hmodKernel32;
|
||||
int Ret;
|
||||
ULONG CodePage;
|
||||
|
||||
hmodKernel32 = GetModuleHandleW(L"kernel32.dll");
|
||||
pGetLocaleInfoEx = (FN_GetLocaleInfoEx*)GetProcAddress(hmodKernel32, "GetLocaleInfoEx");
|
||||
if (pGetLocaleInfoEx == NULL)
|
||||
{
|
||||
hmodKernel32 = LoadLibraryW(L"kernel32_vista.dll");
|
||||
pGetLocaleInfoEx = (FN_GetLocaleInfoEx*)GetProcAddress(hmodKernel32, "GetLocaleInfoEx");
|
||||
if (pGetLocaleInfoEx == NULL)
|
||||
{
|
||||
skip("GetLocaleInfoEx not found in kernel32.dll\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Test normal usage
|
||||
Ret = pGetLocaleInfoEx(L"en-US",
|
||||
LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
|
||||
(WCHAR*)&CodePage,
|
||||
sizeof(DWORD) / sizeof(WCHAR));
|
||||
ok_eq_int(Ret, 2);
|
||||
ok_eq_long(CodePage, 1252ul);
|
||||
|
||||
// Test with neutral locale
|
||||
Ret = pGetLocaleInfoEx(L"en",
|
||||
LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
|
||||
NULL,
|
||||
0);
|
||||
ok_eq_int(Ret, 2);
|
||||
ok_eq_long(CodePage, 1252ul);
|
||||
|
||||
// Test with NULL locale name
|
||||
CodePage = 0xdeadbeef;
|
||||
Ret = pGetLocaleInfoEx(NULL,
|
||||
LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
|
||||
(WCHAR *)&CodePage,
|
||||
sizeof(DWORD) /sizeof(WCHAR));
|
||||
ok_eq_int(Ret, 2);
|
||||
ok_eq_long(CodePage, 1252ul);
|
||||
|
||||
// Test with empty locale name
|
||||
CodePage = 0xdeadbeef;
|
||||
Ret = pGetLocaleInfoEx(L"",
|
||||
LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
|
||||
(WCHAR *)&CodePage,
|
||||
sizeof(DWORD) /sizeof(WCHAR));
|
||||
ok_eq_int(Ret, 2);
|
||||
ok_eq_long(CodePage, 1252ul);
|
||||
|
||||
// Test with invalid locale name
|
||||
CodePage = 0xdeadbeef;
|
||||
Ret = pGetLocaleInfoEx(L"invalid",
|
||||
LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
|
||||
(WCHAR *)&CodePage,
|
||||
sizeof(DWORD) /sizeof(WCHAR));
|
||||
ok_eq_int(Ret, 0);
|
||||
ok_eq_long(GetLastError(), (ULONG)ERROR_INVALID_PARAMETER);
|
||||
ok(CodePage == 0xdeadbeef, "CodePage should not have been modified: %lx\n", CodePage);
|
||||
|
||||
}
|
||||
|
||||
#undef GetLocaleInfo
|
||||
START_TEST(GetLocaleInfo)
|
||||
{
|
||||
Test_GetLocaleInfoEx();
|
||||
}
|
|
@ -17,6 +17,7 @@ extern void func_GetComputerNameEx(void);
|
|||
extern void func_GetCPInfo(void);
|
||||
extern void func_GetCurrentDirectory(void);
|
||||
extern void func_GetDriveType(void);
|
||||
extern void func_GetLocaleInfo(void);
|
||||
extern void func_GetModuleFileName(void);
|
||||
extern void func_GetVolumeInformation(void);
|
||||
extern void func_InitOnce(void);
|
||||
|
@ -57,6 +58,7 @@ const struct test winetest_testlist[] =
|
|||
{ "GetCPInfo", func_GetCPInfo },
|
||||
{ "GetCurrentDirectory", func_GetCurrentDirectory },
|
||||
{ "GetDriveType", func_GetDriveType },
|
||||
{ "GetLocaleInfo", func_GetLocaleInfo },
|
||||
{ "GetModuleFileName", func_GetModuleFileName },
|
||||
{ "GetVolumeInformation", func_GetVolumeInformation },
|
||||
{ "InitOnce", func_InitOnce },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue