ReactOS 0.4.15-dev-7958-gcd0bb1a
locale.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winnls.h"
Include dependency graph for locale.c:

Go to the source code of this file.

Classes

struct  neutralsublang_name2_t
 
struct  comparestringa_entry
 
struct  comparestringex_test
 
struct  neutralsublang_name_t
 
struct  invariant_entry
 

Macros

#define X(f)   p##f = (void*)GetProcAddress(mod, #f)
 
#define eq(received, expected, label, type)
 
#define BUFFER_SIZE   128
 
#define COUNTOF(x)   (sizeof(x)/sizeof(x)[0])
 
#define STRINGSA(x, y)   strcpy(input, x); strcpy(Expected, y); SetLastError(0xdeadbeef); buffer[0] = '\0'
 
#define EXPECT_LENA   ok(ret == lstrlenA(Expected)+1, "Expected len %d, got %d\n", lstrlenA(Expected)+1, ret)
 
#define EXPECT_EQA
 
#define STRINGSW(x, y)
 
#define EXPECT_LENW   ok(ret == lstrlenW(Expected)+1, "Expected Len %d, got %d\n", lstrlenW(Expected)+1, ret)
 
#define EXPECT_EQW   ok(strncmpW(buffer, Expected, strlenW(Expected)) == 0, "Bad conversion\n")
 
#define NUO   LOCALE_NOUSEROVERRIDE
 
#define CY_POS_LEFT   0
 
#define CY_POS_RIGHT   1
 
#define CY_POS_LEFT_SPACE   2
 
#define CY_POS_RIGHT_SPACE   3
 
#define NEG_PARENS   0 /* "(1.1)" */
 
#define NEG_LEFT   1 /* "-1.1" */
 
#define NEG_LEFT_SPACE   2 /* "- 1.1" */
 
#define NEG_RIGHT   3 /* "1.1-" */
 
#define NEG_RIGHT_SPACE   4 /* "1.1 -" */
 
#define LCID_OK(l)    ok(lcid == l, "Expected lcid = %08x, got %08x\n", l, lcid)
 
#define MKLCID(x, y, z)   MAKELCID(MAKELANGID(x, y), z)
 
#define LCID_RES(src, res)   lcid = ConvertDefaultLocale(src); LCID_OK(res)
 
#define TEST_LCIDLANG(a, b)   LCID_RES(MAKELCID(a,b), MAKELCID(a,b))
 
#define TEST_LCID(a, b, c)   LCID_RES(MKLCID(a,b,c), MKLCID(a,b,c))
 
#define X(x)   #x, x
 

Typedefs

typedef INT(* lcmapstring_wrapper) (DWORD, LPCWSTR, INT, LPWSTR, INT)
 

Functions

static unsigned int strlenW (const WCHAR *str)
 
static int strncmpW (const WCHAR *str1, const WCHAR *str2, int n)
 
static WCHARstrchrW (const WCHAR *str, WCHAR ch)
 
static BOOL isdigitW (WCHAR wc)
 
static INT (WINAPI *pGetTimeFormatEx)(LPCWSTR
 
static BOOL (WINAPI *pEnumSystemLanguageGroupsA)(LANGUAGEGROUP_ENUMPROCA
 
static LCID (WINAPI *pLocaleNameToLCID)(LPCWSTR
 
static ULONG WCHAR ULONG *static ULONG WCHAR ULONG *static ULONG WCHAR ULONG *static WCHAR (WINAPI *pRtlUpcaseUnicodeChar)(WCHAR)
 
static void InitFunctionPointers (void)
 
static void test_GetLocaleInfoA (void)
 
static void test_GetLocaleInfoW (void)
 
static void test_GetTimeFormatA (void)
 
static void test_GetTimeFormatEx (void)
 
static void test_GetDateFormatA (void)
 
static void test_GetDateFormatEx (void)
 
static void test_GetDateFormatW (void)
 
static void test_GetCurrencyFormatA (void)
 
static void test_GetNumberFormatA (void)
 
static void test_GetNumberFormatEx (void)
 
static void test_CompareStringA (void)
 
static void test_CompareStringW (void)
 
static void test_CompareStringEx (void)
 
static void test_LCMapStringA (void)
 
static void test_lcmapstring_unicode (lcmapstring_wrapper func_ptr, const char *func_name)
 
static INT LCMapStringW_wrapper (DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
 
static void test_LCMapStringW (void)
 
static INT LCMapStringEx_wrapper (DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
 
static void test_LCMapStringEx (void)
 
static void test_LocaleNameToLCID (void)
 
static int compare_string1 (const void *e1, const void *e2)
 
static int compare_string2 (const void *e1, const void *e2)
 
static int compare_string3 (const void *e1, const void *e2)
 
static void test_sorting (void)
 
static void test_FoldStringA (void)
 
static void test_FoldStringW (void)
 
static void test_ConvertDefaultLocale (void)
 
static BOOL CALLBACK langgrp_procA (LGRPID lgrpid, LPSTR lpszNum, LPSTR lpszName, DWORD dwFlags, LONG_PTR lParam)
 
static void test_EnumSystemLanguageGroupsA (void)
 
static BOOL CALLBACK enum_func (LPWSTR name, DWORD flags, LPARAM lparam)
 
static void test_EnumSystemLocalesEx (void)
 
static BOOL CALLBACK lgrplocale_procA (LGRPID lgrpid, LCID lcid, LPSTR lpszNum, LONG_PTR lParam)
 
static void test_EnumLanguageGroupLocalesA (void)
 
static void test_SetLocaleInfoA (void)
 
static BOOL CALLBACK luilocale_proc1A (LPSTR value, LONG_PTR lParam)
 
static BOOL CALLBACK luilocale_proc2A (LPSTR value, LONG_PTR lParam)
 
static BOOL CALLBACK luilocale_proc3A (LPSTR value, LONG_PTR lParam)
 
static void test_EnumUILanguageA (void)
 
static BOOL CALLBACK enum_datetime_procA (LPSTR fmt)
 
static BOOL CALLBACK enum_datetime_procW (WCHAR *fmt)
 
static void test_EnumDateFormatsA (void)
 
static void test_EnumTimeFormatsA (void)
 
static void test_EnumTimeFormatsW (void)
 
static void test_GetCPInfo (void)
 
static void test_GetStringTypeW (void)
 
static void test_IdnToNameprepUnicode (void)
 
static void test_IdnToAscii (void)
 
static void test_IdnToUnicode (void)
 
static void test_GetLocaleInfoEx (void)
 
static void test_IsValidLocaleName (void)
 
static void test_CompareStringOrdinal (void)
 
static void test_GetGeoInfo (void)
 
static BOOL CALLBACK test_geoid_enumproc (GEOID geoid)
 
static BOOL CALLBACK test_geoid_enumproc2 (GEOID geoid)
 
static void test_EnumSystemGeoID (void)
 
static void test_invariant (void)
 
static void test_GetSystemPreferredUILanguages (void)
 
static void test_GetThreadPreferredUILanguages (void)
 
static void test_GetUserPreferredUILanguages (void)
 
 START_TEST (locale)
 

Variables

static const WCHAR upper_case [] = {'\t','J','U','S','T','!',' ','A',',',' ','T','E','S','T',';',' ','S','T','R','I','N','G',' ','1','/','*','+','-','.','\r','\n',0}
 
static const WCHAR lower_case [] = {'\t','j','u','s','t','!',' ','a',',',' ','t','e','s','t',';',' ','s','t','r','i','n','g',' ','1','/','*','+','-','.','\r','\n',0}
 
static const WCHAR title_case [] = {'\t','J','u','s','t','!',' ','A',',',' ','T','e','s','t',';',' ','S','t','r','i','n','g',' ','1','/','*','+','-','.','\r','\n',0}
 
static const WCHAR symbols_stripped [] = {'j','u','s','t','a','t','e','s','t','s','t','r','i','n','g','1',0}
 
static const WCHAR localeW [] = {'e','n','-','U','S',0}
 
static const WCHAR fooW [] = {'f','o','o',0}
 
static const WCHAR emptyW [] = {0}
 
static const WCHAR invalidW [] = {'i','n','v','a','l','i','d',0}
 
static WORD enumCount
 
static DWORD
 
static const SYSTEMTIME LPCWSTR
 
static const SYSTEMTIME LPWSTR
 
static const SYSTEMTIME INT
 
static LONG_PTR
 
static LGRPID
 
static LPARAM
 
static LPVOID
 
static LPNLSVERSIONINFO
 
static LPCSTR
 
static LPSTR
 
static LCTYPE
 
static const WCHAR BOOL
 
static GEOTYPE
 
static LANGID
 
static GEOID
 
static GEO_ENUMPROC
 
static const NUMBERFMTW int
 
static const struct neutralsublang_name2_t neutralsublang_names2 []
 
static const struct comparestringa_entry comparestringa_data []
 
static const struct comparestringex_test comparestringex_tests []
 
static const DWORD lcmap_invalid_flags []
 
static const struct neutralsublang_name_t neutralsublang_names []
 
static const char *const strings_sorted []
 
static const char *const strings []
 
static char date_fmt_buf [1024]
 
static WCHAR date_fmt_bufW [1024]
 
static int geoidenum_count
 
static const struct invariant_entry invariant_list []
 

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE   128

Definition at line 148 of file locale.c.

◆ COUNTOF

#define COUNTOF (   x)    (sizeof(x)/sizeof(x)[0])

Definition at line 149 of file locale.c.

◆ CY_POS_LEFT

#define CY_POS_LEFT   0

Definition at line 1157 of file locale.c.

◆ CY_POS_LEFT_SPACE

#define CY_POS_LEFT_SPACE   2

Definition at line 1159 of file locale.c.

◆ CY_POS_RIGHT

#define CY_POS_RIGHT   1

Definition at line 1158 of file locale.c.

◆ CY_POS_RIGHT_SPACE

#define CY_POS_RIGHT_SPACE   3

Definition at line 1160 of file locale.c.

◆ eq

#define eq (   received,
  expected,
  label,
  type 
)
Value:
ok((received) == (expected), "%s: got " type " instead of " type "\n", \
#define ok(value,...)
Definition: atltest.h:57
r received
Definition: btrfs.c:3005
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static const WCHAR label[]
Definition: itemdlg.c:1546
BOOL expected
Definition: store.c:2063

Definition at line 144 of file locale.c.

◆ EXPECT_EQA

#define EXPECT_EQA
Value:
"Expected '%s', got '%s'\n", Expected, buffer)
BOOLEAN Expected
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
GLuint buffer
Definition: glext.h:5915

Definition at line 153 of file locale.c.

◆ EXPECT_EQW

#define EXPECT_EQW   ok(strncmpW(buffer, Expected, strlenW(Expected)) == 0, "Bad conversion\n")

Definition at line 160 of file locale.c.

◆ EXPECT_LENA

#define EXPECT_LENA   ok(ret == lstrlenA(Expected)+1, "Expected len %d, got %d\n", lstrlenA(Expected)+1, ret)

Definition at line 152 of file locale.c.

◆ EXPECT_LENW

#define EXPECT_LENW   ok(ret == lstrlenW(Expected)+1, "Expected Len %d, got %d\n", lstrlenW(Expected)+1, ret)

Definition at line 159 of file locale.c.

◆ LCID_OK

#define LCID_OK (   l)     ok(lcid == l, "Expected lcid = %08x, got %08x\n", l, lcid)

Definition at line 3470 of file locale.c.

◆ LCID_RES

#define LCID_RES (   src,
  res 
)    lcid = ConvertDefaultLocale(src); LCID_OK(res)

Definition at line 3473 of file locale.c.

◆ MKLCID

#define MKLCID (   x,
  y,
  z 
)    MAKELCID(MAKELANGID(x, y), z)

Definition at line 3472 of file locale.c.

◆ NEG_LEFT

#define NEG_LEFT   1 /* "-1.1" */

Definition at line 1414 of file locale.c.

◆ NEG_LEFT_SPACE

#define NEG_LEFT_SPACE   2 /* "- 1.1" */

Definition at line 1415 of file locale.c.

◆ NEG_PARENS

#define NEG_PARENS   0 /* "(1.1)" */

Definition at line 1413 of file locale.c.

◆ NEG_RIGHT

#define NEG_RIGHT   3 /* "1.1-" */

Definition at line 1416 of file locale.c.

◆ NEG_RIGHT_SPACE

#define NEG_RIGHT_SPACE   4 /* "1.1 -" */

Definition at line 1417 of file locale.c.

◆ NUO

Definition at line 162 of file locale.c.

◆ STRINGSA

#define STRINGSA (   x,
  y 
)    strcpy(input, x); strcpy(Expected, y); SetLastError(0xdeadbeef); buffer[0] = '\0'

Definition at line 151 of file locale.c.

◆ STRINGSW

#define STRINGSW (   x,
  y 
)
Value:
MultiByteToWideChar(CP_ACP,0,y,-1,Expected,COUNTOF(Expected)); \
SetLastError(0xdeadbeef); buffer[0] = '\0'
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLenum GLenum GLenum input
Definition: glext.h:9031
#define COUNTOF(x)
Definition: locale.c:149

Definition at line 156 of file locale.c.

◆ TEST_LCID

#define TEST_LCID (   a,
  b,
  c 
)    LCID_RES(MKLCID(a,b,c), MKLCID(a,b,c))

Definition at line 3475 of file locale.c.

◆ TEST_LCIDLANG

#define TEST_LCIDLANG (   a,
  b 
)    LCID_RES(MAKELCID(a,b), MAKELCID(a,b))

Definition at line 3474 of file locale.c.

◆ X [1/2]

#define X (   f)    p##f = (void*)GetProcAddress(mod, #f)

Definition at line 4799 of file locale.c.

◆ X [2/2]

#define X (   x)    #x, x

Definition at line 4799 of file locale.c.

Typedef Documentation

◆ lcmapstring_wrapper

typedef INT(* lcmapstring_wrapper) (DWORD, LPCWSTR, INT, LPWSTR, INT)

Definition at line 2390 of file locale.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pEnumSystemLanguageGroupsA)
static

◆ compare_string1()

static int compare_string1 ( const void e1,
const void e2 
)
static

Definition at line 2896 of file locale.c.

2897{
2898 const char *s1 = *(const char *const *)e1;
2899 const char *s2 = *(const char *const *)e2;
2900
2901 return lstrcmpA(s1, s2);
2902}
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
struct S1 s1
struct S2 s2

Referenced by test_sorting().

◆ compare_string2()

static int compare_string2 ( const void e1,
const void e2 
)
static

Definition at line 2904 of file locale.c.

2905{
2906 const char *s1 = *(const char *const *)e1;
2907 const char *s2 = *(const char *const *)e2;
2908
2909 return CompareStringA(0, 0, s1, -1, s2, -1) - 2;
2910}
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
Definition: lang.c:2695

Referenced by test_sorting().

◆ compare_string3()

static int compare_string3 ( const void e1,
const void e2 
)
static

Definition at line 2912 of file locale.c.

2913{
2914 const char *s1 = *(const char *const *)e1;
2915 const char *s2 = *(const char *const *)e2;
2916 char key1[256], key2[256];
2917
2918 LCMapStringA(0, LCMAP_SORTKEY, s1, -1, key1, sizeof(key1));
2919 LCMapStringA(0, LCMAP_SORTKEY, s2, -1, key2, sizeof(key2));
2920 return strcmp(key1, key2);
2921}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLuint64EXT GLuint GLuint GLenum GLenum GLuint GLuint GLenum GLuint GLuint key1
Definition: glext.h:10608
INT WINAPI LCMapStringA(LCID lcid, DWORD flags, LPCSTR src, INT srclen, LPSTR dst, INT dstlen)
Definition: lang.c:2443
#define LCMAP_SORTKEY
Definition: winnls.h:186

Referenced by test_sorting().

◆ enum_datetime_procA()

static BOOL CALLBACK enum_datetime_procA ( LPSTR  fmt)
static

Definition at line 3732 of file locale.c.

3733{
3735 lstrcatA(date_fmt_buf, "\n");
3736 return TRUE;
3737}
#define TRUE
Definition: types.h:120
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
static char date_fmt_buf[1024]
Definition: locale.c:3729
Definition: dsound.c:943

Referenced by test_EnumDateFormatsA(), test_EnumTimeFormatsA(), and test_EnumTimeFormatsW().

◆ enum_datetime_procW()

static BOOL CALLBACK enum_datetime_procW ( WCHAR fmt)
static

Definition at line 3739 of file locale.c.

3740{
3742 return FALSE;
3743}
#define FALSE
Definition: types.h:117
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static WCHAR date_fmt_bufW[1024]
Definition: locale.c:3730

Referenced by test_EnumTimeFormatsW().

◆ enum_func()

static BOOL CALLBACK enum_func ( LPWSTR  name,
DWORD  flags,
LPARAM  lparam 
)
static

Definition at line 3561 of file locale.c.

3562{
3563 if (winetest_debug > 1)
3564 trace( "%s %x\n", wine_dbgstr_w(name), flags );
3565 return TRUE;
3566}
#define trace
Definition: atltest.h:70
GLbitfield flags
Definition: glext.h:7161
#define wine_dbgstr_w
Definition: kernel32.h:34
int winetest_debug
Definition: name.c:39

Referenced by test_EnumSystemLocalesEx().

◆ InitFunctionPointers()

static void InitFunctionPointers ( void  )
static

Definition at line 107 of file locale.c.

108{
109 HMODULE mod = GetModuleHandleA("kernel32");
110
111#define X(f) p##f = (void*)GetProcAddress(mod, #f)
116 X(LocaleNameToLCID);
117 X(LCIDToLocaleName);
119 X(FoldStringA);
120 X(FoldStringW);
125 X(IdnToAscii);
127 X(GetLocaleInfoEx);
128 X(IsValidLocaleName);
129 X(CompareStringOrdinal);
131 X(GetGeoInfoA);
132 X(GetGeoInfoW);
137 X(GetNumberFormatEx);
138
139 mod = GetModuleHandleA("ntdll");
141#undef X
142}
INT WINAPI IdnToAscii(DWORD dwFlags, LPCWSTR lpUnicodeCharStr, INT cchUnicodeChar, LPWSTR lpASCIICharStr, INT cchASCIIChar)
Definition: IdnToAscii.c:249
INT WINAPI IdnToNameprepUnicode(DWORD dwFlags, LPCWSTR lpUnicodeCharStr, INT cchUnicodeChar, LPWSTR lpNameprepCharStr, INT cchNameprepChar)
Definition: IdnToAscii.c:37
INT WINAPI IdnToUnicode(DWORD dwFlags, LPCWSTR lpASCIICharStr, INT cchASCIIChar, LPWSTR lpUnicodeCharStr, INT cchUnicodeChar)
Definition: IdnToUnicode.c:37
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static int mod
Definition: i386-dis.c:1288
BOOL WINAPI GetUserPreferredUILanguages(DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer)
Definition: vista.c:721
BOOL WINAPI GetThreadPreferredUILanguages(DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer)
Definition: vista.c:675
BOOL WINAPI GetSystemPreferredUILanguages(DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer)
Definition: vista.c:659
BOOL WINAPI IsValidLanguageGroup(LGRPID lgrpid, DWORD dwFlags)
Definition: lang.c:3066
INT WINAPI FoldStringA(DWORD dwFlags, LPCSTR src, INT srclen, LPSTR dst, INT dstlen)
Definition: lang.c:2533
INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len, LANGID lang)
Definition: lang.c:3980
INT WINAPI LCMapStringEx(LPCWSTR locale, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM handle)
Definition: lang.c:2355
INT WINAPI FoldStringW(DWORD dwFlags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
Definition: lang.c:2591
INT WINAPI CompareStringEx(LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lParam)
Definition: lang.c:2624
BOOL WINAPI EnumUILanguagesA(UILANGUAGE_ENUMPROCA pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam)
Definition: lang.c:3870
BOOL WINAPI EnumSystemGeoID(GEOCLASS geoclass, GEOID parent, GEO_ENUMPROC enumproc)
Definition: lang.c:3702
BOOL WINAPI EnumLanguageGroupLocalesA(LANGGROUPLOCALE_ENUMPROCA pLangGrpLcEnumProc, LGRPID lgrpid, DWORD dwFlags, LONG_PTR lParam)
Definition: lang.c:3534
BOOL WINAPI EnumSystemLanguageGroupsA(LANGUAGEGROUP_ENUMPROCA pLangGrpEnumProc, DWORD dwFlags, LONG_PTR lParam)
Definition: lang.c:3018
INT WINAPI GetGeoInfoA(GEOID geoid, GEOTYPE geotype, LPSTR data, int data_len, LANGID lang)
Definition: lang.c:4054
BOOL WINAPI EnumSystemLocalesEx(LOCALE_ENUMPROCEX proc, DWORD flags, LPARAM lparam, LPVOID reserved)
Definition: lang.c:1654
#define X(f)
Definition: locale.c:4799
WCHAR NTAPI RtlUpcaseUnicodeChar(_In_ WCHAR Source)
Definition: nlsboot.c:176
int WINAPI GetDateFormatEx(LPCWSTR, DWORD, const SYSTEMTIME *, LPCWSTR, LPWSTR, int, LPCWSTR)
int WINAPI GetTimeFormatEx(LPCWSTR, DWORD, const SYSTEMTIME *, LPCWSTR, LPWSTR, int)

Referenced by START_TEST().

◆ INT()

static INT ( WINAPI pGetTimeFormatEx)
static

◆ isdigitW()

static BOOL isdigitW ( WCHAR  wc)
inlinestatic

Definition at line 68 of file locale.c.

69{
70 WORD type;
71 GetStringTypeW( CT_CTYPE1, &wc, 1, &type );
72 return type & C1_DIGIT;
73}
unsigned short WORD
Definition: ntddk_ex.h:93
#define C1_DIGIT
Definition: unicode.h:33
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: lang.c:1709
#define CT_CTYPE1
Definition: winnls.h:237

◆ langgrp_procA()

static BOOL CALLBACK langgrp_procA ( LGRPID  lgrpid,
LPSTR  lpszNum,
LPSTR  lpszName,
DWORD  dwFlags,
LONG_PTR  lParam 
)
static

Definition at line 3509 of file locale.c.

3511{
3512 if (winetest_debug > 1)
3513 trace("%08x, %s, %s, %08x, %08lx\n",
3514 lgrpid, lpszNum, lpszName, dwFlags, lParam);
3515
3516 ok(pIsValidLanguageGroup(lgrpid, dwFlags) == TRUE,
3517 "Enumerated grp %d not valid (flags %d)\n", lgrpid, dwFlags);
3518
3519 /* If lParam is one, we are calling with flags defaulted from 0 */
3521 "Expected dwFlags == LGRPID_INSTALLED || dwFlags == LGRPID_SUPPORTED, got %d\n", dwFlags);
3522
3523 return TRUE;
3524}
LPARAM lParam
Definition: combotst.c:139
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define LGRPID_INSTALLED
Definition: winnls.h:458
#define LGRPID_SUPPORTED
Definition: winnls.h:459

Referenced by test_EnumSystemLanguageGroupsA().

◆ LCID()

static LCID ( WINAPI pLocaleNameToLCID)
static

◆ LCMapStringEx_wrapper()

static INT LCMapStringEx_wrapper ( DWORD  flags,
LPCWSTR  src,
INT  srclen,
LPWSTR  dst,
INT  dstlen 
)
static

Definition at line 2629 of file locale.c.

2630{
2631 return pLCMapStringEx(LOCALE_NAME_USER_DEFAULT, flags, src, srclen, dst, dstlen, NULL, NULL, 0);
2632}
#define NULL
Definition: types.h:112
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define LOCALE_NAME_USER_DEFAULT
Definition: lang.c:39
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:52
static DWORD dstlen
Definition: directory.c:51

Referenced by test_LCMapStringEx().

◆ LCMapStringW_wrapper()

static INT LCMapStringW_wrapper ( DWORD  flags,
LPCWSTR  src,
INT  srclen,
LPWSTR  dst,
INT  dstlen 
)
static

Definition at line 2607 of file locale.c.

2608{
2610}
INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
Definition: lang.c:2417
#define LOCALE_USER_DEFAULT

Referenced by test_LCMapStringW().

◆ lgrplocale_procA()

static BOOL CALLBACK lgrplocale_procA ( LGRPID  lgrpid,
LCID  lcid,
LPSTR  lpszNum,
LONG_PTR  lParam 
)
static

Definition at line 3586 of file locale.c.

3588{
3589 if (winetest_debug > 1)
3590 trace("%08x, %08x, %s, %08lx\n", lgrpid, lcid, lpszNum, lParam);
3591
3592 /* invalid locale enumerated on some platforms */
3593 if (lcid == 0)
3594 return TRUE;
3595
3596 ok(pIsValidLanguageGroup(lgrpid, LGRPID_SUPPORTED) == TRUE,
3597 "Enumerated grp %d not valid\n", lgrpid);
3599 "Enumerated grp locale %04x not valid\n", lcid);
3600 return TRUE;
3601}
BOOL WINAPI IsValidLocale(LCID lcid, DWORD flags)
Definition: lang.c:1558
#define LCID_SUPPORTED
Definition: winnls.h:202

Referenced by test_EnumLanguageGroupLocalesA().

◆ luilocale_proc1A()

static BOOL CALLBACK luilocale_proc1A ( LPSTR  value,
LONG_PTR  lParam 
)
static

Definition at line 3669 of file locale.c.

3670{
3671 if (winetest_debug > 1)
3672 trace("%s %08lx\n", value, lParam);
3673 return(TRUE);
3674}
Definition: pdh_main.c:94

Referenced by test_EnumUILanguageA().

◆ luilocale_proc2A()

static BOOL CALLBACK luilocale_proc2A ( LPSTR  value,
LONG_PTR  lParam 
)
static

Definition at line 3676 of file locale.c.

3677{
3678 ok(!enumCount, "callback called again unexpected\n");
3679 enumCount++;
3680 return(FALSE);
3681}
static WORD enumCount
Definition: locale.c:76

Referenced by test_EnumUILanguageA().

◆ luilocale_proc3A()

static BOOL CALLBACK luilocale_proc3A ( LPSTR  value,
LONG_PTR  lParam 
)
static

Definition at line 3683 of file locale.c.

3684{
3685 ok(0,"callback called unexpected\n");
3686 return(FALSE);
3687}

Referenced by test_EnumUILanguageA().

◆ START_TEST()

START_TEST ( locale  )

Definition at line 5332 of file locale.c.

5333{
5335
5347 test_GetCurrencyFormatA(); /* Also tests the W version */
5348 test_GetNumberFormatA(); /* Also tests the W version */
5378 test_sorting();
5379}
static void test_EnumSystemLanguageGroupsA(void)
Definition: locale.c:3526
static void test_LCMapStringW(void)
Definition: locale.c:2612
static void test_ConvertDefaultLocale(void)
Definition: locale.c:3477
static void test_IsValidLocaleName(void)
Definition: locale.c:4530
static void test_SetLocaleInfoA(void)
Definition: locale.c:3645
static void test_CompareStringOrdinal(void)
Definition: locale.c:4558
static void test_sorting(void)
Definition: locale.c:2923
static void test_GetTimeFormatA(void)
Definition: locale.c:428
static void test_GetThreadPreferredUILanguages(void)
Definition: locale.c:5169
static void test_EnumSystemGeoID(void)
Definition: locale.c:4743
static void test_IdnToUnicode(void)
Definition: locale.c:4363
static void test_EnumUILanguageA(void)
Definition: locale.c:3689
static void test_LCMapStringA(void)
Definition: locale.c:2230
static void test_CompareStringEx(void)
Definition: locale.c:2176
static void test_GetCPInfo(void)
Definition: locale.c:3903
static void test_GetTimeFormatEx(void)
Definition: locale.c:623
static void test_GetDateFormatW(void)
Definition: locale.c:1082
static void test_GetLocaleInfoW(void)
Definition: locale.c:280
static void test_GetCurrencyFormatA(void)
Definition: locale.c:1162
static void test_EnumDateFormatsA(void)
Definition: locale.c:3745
static void test_GetDateFormatA(void)
Definition: locale.c:819
static void test_GetUserPreferredUILanguages(void)
Definition: locale.c:5195
static void test_invariant(void)
Definition: locale.c:4913
static void test_GetGeoInfo(void)
Definition: locale.c:4646
static void test_GetLocaleInfoEx(void)
Definition: locale.c:4439
static void test_GetNumberFormatEx(void)
Definition: locale.c:1599
static void test_IdnToAscii(void)
Definition: locale.c:4293
static void test_GetStringTypeW(void)
Definition: locale.c:3955
static void test_GetDateFormatEx(void)
Definition: locale.c:986
static void test_EnumLanguageGroupLocalesA(void)
Definition: locale.c:3603
static void test_IdnToNameprepUnicode(void)
Definition: locale.c:4126
static void test_LCMapStringEx(void)
Definition: locale.c:2634
static void test_EnumTimeFormatsA(void)
Definition: locale.c:3825
static void test_FoldStringA(void)
Definition: locale.c:2957
static void test_CompareStringW(void)
Definition: locale.c:1983
static void test_EnumSystemLocalesEx(void)
Definition: locale.c:3568
static void test_EnumTimeFormatsW(void)
Definition: locale.c:3852
static void test_GetNumberFormatA(void)
Definition: locale.c:1419
static void test_GetSystemPreferredUILanguages(void)
Definition: locale.c:4979
static void test_CompareStringA(void)
Definition: locale.c:1838
static void test_GetLocaleInfoA(void)
Definition: locale.c:164
static void InitFunctionPointers(void)
Definition: locale.c:107
static void test_LocaleNameToLCID(void)
Definition: locale.c:2701
static void test_FoldStringW(void)
Definition: locale.c:3180

◆ strchrW()

static WCHAR * strchrW ( const WCHAR str,
WCHAR  ch 
)
inlinestatic

Definition at line 62 of file locale.c.

63{
64 do { if (*str == ch) return (WCHAR *)str; } while (*str++);
65 return NULL;
66}
const WCHAR * str
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ strlenW()

static unsigned int strlenW ( const WCHAR str)
inlinestatic

Definition at line 48 of file locale.c.

49{
50 const WCHAR *s = str;
51 while (*s) s++;
52 return s - str;
53}
GLdouble s
Definition: gl.h:2039

◆ strncmpW()

static int strncmpW ( const WCHAR str1,
const WCHAR str2,
int  n 
)
inlinestatic

Definition at line 55 of file locale.c.

56{
57 if (n <= 0) return 0;
58 while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
59 return *str1 - *str2;
60}
GLdouble n
Definition: glext.h:7729

◆ test_CompareStringA()

static void test_CompareStringA ( void  )
static

Definition at line 1838 of file locale.c.

1839{
1840 int ret, i;
1841 char a[256];
1843
1844 for (i = 0; i < sizeof(comparestringa_data)/sizeof(struct comparestringa_entry); i++)
1845 {
1847
1848 ret = CompareStringA(entry->lcid, entry->flags, entry->first, entry->first_len,
1849 entry->second, entry->second_len);
1850 ok(ret == entry->ret, "%d: got %d, expected %d\n", i, ret, entry->ret);
1851 }
1852
1853 ret = CompareStringA(lcid, NORM_IGNORECASE, "Salut", -1, "Salute", -1);
1854 ok (ret == CSTR_LESS_THAN, "(Salut/Salute) Expected CSTR_LESS_THAN, got %d\n", ret);
1855
1856 ret = CompareStringA(lcid, NORM_IGNORECASE, "Salut", -1, "SaLuT", -1);
1857 ok (ret == CSTR_EQUAL, "(Salut/SaLuT) Expected CSTR_EQUAL, got %d\n", ret);
1858
1859 ret = CompareStringA(lcid, NORM_IGNORECASE, "Salut", -1, "hola", -1);
1860 ok (ret == CSTR_GREATER_THAN, "(Salut/hola) Expected CSTR_GREATER_THAN, got %d\n", ret);
1861
1862 ret = CompareStringA(lcid, NORM_IGNORECASE, "haha", -1, "hoho", -1);
1863 ok (ret == CSTR_LESS_THAN, "(haha/hoho) Expected CSTR_LESS_THAN, got %d\n", ret);
1864
1866
1867 ret = CompareStringA(lcid, NORM_IGNORECASE, "haha", -1, "hoho", -1);
1868 ok (ret == CSTR_LESS_THAN, "(haha/hoho) Expected CSTR_LESS_THAN, got %d\n", ret);
1869
1870 ret = CompareStringA(lcid, NORM_IGNORECASE, "haha", -1, "hoho", 0);
1871 ok (ret == CSTR_GREATER_THAN, "(haha/hoho) Expected CSTR_GREATER_THAN, got %d\n", ret);
1872
1873 ret = CompareStringA(lcid, NORM_IGNORECASE, "Salut", 5, "saLuT", -1);
1874 ok (ret == CSTR_EQUAL, "(Salut/saLuT) Expected CSTR_EQUAL, got %d\n", ret);
1875
1876 /* test for CompareStringA flags */
1877 SetLastError(0xdeadbeef);
1878 ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0x8, "NULL", -1, "NULL", -1);
1880 "unexpected error code %d\n", GetLastError());
1881 ok(!ret, "CompareStringA must fail with invalid flag\n");
1882
1883 SetLastError(0xdeadbeef);
1884 ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, LOCALE_USE_CP_ACP, "NULL", -1, "NULL", -1);
1885 ok(GetLastError() == 0xdeadbeef, "unexpected error code %d\n", GetLastError());
1886 ok(ret == CSTR_EQUAL, "CompareStringA error: %d != CSTR_EQUAL\n", ret);
1887 /* end of test for CompareStringA flags */
1888
1889 ret = lstrcmpA("", "");
1890 ok (ret == 0, "lstrcmpA(\"\", \"\") should return 0, got %d\n", ret);
1891
1892 ret = lstrcmpA(NULL, NULL);
1893 ok (ret == 0 || broken(ret == -2) /* win9x */, "lstrcmpA(NULL, NULL) should return 0, got %d\n", ret);
1894
1895 ret = lstrcmpA("", NULL);
1896 ok (ret == 1 || broken(ret == -2) /* win9x */, "lstrcmpA(\"\", NULL) should return 1, got %d\n", ret);
1897
1898 ret = lstrcmpA(NULL, "");
1899 ok (ret == -1 || broken(ret == -2) /* win9x */, "lstrcmpA(NULL, \"\") should return -1, got %d\n", ret);
1900
1901
1902 if (0) { /* this requires collation table patch to make it MS compatible */
1903 ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "'o", -1, "-o", -1 );
1904 ok(ret == CSTR_LESS_THAN, "'o vs -o expected CSTR_LESS_THAN, got %d\n", ret);
1905
1907 ok(ret == CSTR_LESS_THAN, "'o vs -o expected CSTR_LESS_THAN, got %d\n", ret);
1908
1909 ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "'", -1, "-", -1 );
1910 ok(ret == CSTR_LESS_THAN, "' vs - expected CSTR_LESS_THAN, got %d\n", ret);
1911
1913 ok(ret == CSTR_LESS_THAN, "' vs - expected CSTR_LESS_THAN, got %d\n", ret);
1914
1915 ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "`o", -1, "/m", -1 );
1916 ok(ret == CSTR_GREATER_THAN, "`o vs /m CSTR_GREATER_THAN got %d\n", ret);
1917
1918 ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "/m", -1, "`o", -1 );
1919 ok(ret == CSTR_LESS_THAN, "/m vs `o expected CSTR_LESS_THAN, got %d\n", ret);
1920
1922 ok(ret == CSTR_GREATER_THAN, "`o vs /m CSTR_GREATER_THAN got %d\n", ret);
1923
1925 ok(ret == CSTR_LESS_THAN, "/m vs `o expected CSTR_LESS_THAN, got %d\n", ret);
1926
1927 ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "`o", -1, "-m", -1 );
1928 ok(ret == CSTR_LESS_THAN, "`o vs -m expected CSTR_LESS_THAN, got %d\n", ret);
1929
1930 ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "-m", -1, "`o", -1 );
1931 ok(ret == CSTR_GREATER_THAN, "-m vs `o CSTR_GREATER_THAN got %d\n", ret);
1932
1934 ok(ret == CSTR_GREATER_THAN, "`o vs -m CSTR_GREATER_THAN got %d\n", ret);
1935
1937 ok(ret == CSTR_LESS_THAN, "-m vs `o expected CSTR_LESS_THAN, got %d\n", ret);
1938 }
1939
1940
1941 /* WinXP handles embedded NULLs differently than earlier versions */
1942 ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLuZkUtZ", 8, "aLuZkUtZ\0A", 10);
1943 ok(ret == CSTR_LESS_THAN || ret == CSTR_EQUAL, "aLuZkUtZ vs aLuZkUtZ\\0A expected CSTR_LESS_THAN or CSTR_EQUAL, got %d\n", ret);
1944
1945 ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLu\0ZkUtZ", 8, "aLu\0ZkUtZ\0A", 10);
1946 ok(ret == CSTR_LESS_THAN || ret == CSTR_EQUAL, "aLu\\0ZkUtZ vs aLu\\0ZkUtZ\\0A expected CSTR_LESS_THAN or CSTR_EQUAL, got %d\n", ret);
1947
1948 ret = CompareStringA(lcid, 0, "a\0b", -1, "a", -1);
1949 ok(ret == CSTR_EQUAL, "a vs a expected CSTR_EQUAL, got %d\n", ret);
1950
1951 ret = CompareStringA(lcid, 0, "a\0b", 4, "a", 2);
1952 ok(ret == CSTR_EQUAL || /* win2k */
1954 "a\\0b vs a expected CSTR_EQUAL or CSTR_GREATER_THAN, got %d\n", ret);
1955
1956 ret = CompareStringA(lcid, 0, "\2", 2, "\1", 2);
1957 todo_wine ok(ret != CSTR_EQUAL, "\\2 vs \\1 expected unequal\n");
1958
1960 ok(ret == CSTR_LESS_THAN, "\"#\" vs \".\" expected CSTR_LESS_THAN, got %d\n", ret);
1961
1962 ret = CompareStringA(lcid, NORM_IGNORECASE, "_", -1, ".", -1);
1963 ok(ret == CSTR_GREATER_THAN, "\"_\" vs \".\" expected CSTR_GREATER_THAN, got %d\n", ret);
1964
1965 ret = lstrcmpiA("#", ".");
1966 ok(ret == -1, "\"#\" vs \".\" expected -1, got %d\n", ret);
1967
1969
1970 /* \xB9 character lies between a and b */
1971 ret = CompareStringA(lcid, 0, "a", 1, "\xB9", 1);
1972 todo_wine ok(ret == CSTR_LESS_THAN, "\'\\xB9\' character should be greater than \'a\'\n");
1973 ret = CompareStringA(lcid, 0, "\xB9", 1, "b", 1);
1974 ok(ret == CSTR_LESS_THAN, "\'\\xB9\' character should be smaller than \'b\'\n");
1975
1976 memset(a, 'a', sizeof(a));
1977 SetLastError(0xdeadbeef);
1978 ret = CompareStringA(lcid, 0, a, sizeof(a), a, sizeof(a));
1979 ok (GetLastError() == 0xdeadbeef && ret == CSTR_EQUAL,
1980 "ret %d, error %d, expected value %d\n", ret, GetLastError(), CSTR_EQUAL);
1981}
#define broken(x)
Definition: _sntprintf.h:21
#define SetLastError(x)
Definition: compat.h:752
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
uint32_t entry
Definition: isohybrid.c:63
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
static const struct comparestringa_entry comparestringa_data[]
Definition: locale.c:1791
#define todo_wine
Definition: custom.c:79
#define LOCALE_SYSTEM_DEFAULT
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_POLISH
Definition: nls.h:107
#define LANG_ENGLISH
Definition: nls.h:52
#define SUBLANG_DEFAULT
Definition: nls.h:168
DWORD LCID
Definition: nls.h:13
#define LANG_FRENCH
Definition: nls.h:58
#define SUBLANG_ENGLISH_US
Definition: nls.h:222
#define memset(x, y, z)
Definition: compat.h:39
Definition: locale.c:1781
LCID lcid
Definition: locale.c:1782
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define LOCALE_USE_CP_ACP
Definition: winnls.h:20
#define NORM_IGNORECASE
Definition: winnls.h:176
#define SORT_STRINGSORT
Definition: winnls.h:183
#define CSTR_EQUAL
Definition: winnls.h:456
#define CSTR_LESS_THAN
Definition: winnls.h:455
#define CSTR_GREATER_THAN
Definition: winnls.h:457

Referenced by START_TEST().

◆ test_CompareStringEx()

static void test_CompareStringEx ( void  )
static

Definition at line 2176 of file locale.c.

2177{
2178 const char *op[] = {"ERROR", "CSTR_LESS_THAN", "CSTR_EQUAL", "CSTR_GREATER_THAN"};
2179 WCHAR locale[6];
2180 INT ret, i;
2181
2182 /* CompareStringEx is only available on Vista+ */
2183 if (!pCompareStringEx)
2184 {
2185 win_skip("CompareStringEx not supported\n");
2186 return;
2187 }
2188
2189 for (i = 0; i < sizeof(comparestringex_tests)/sizeof(comparestringex_tests[0]); i++)
2190 {
2192
2193 MultiByteToWideChar(CP_ACP, 0, e->locale, -1, locale, sizeof(locale)/sizeof(WCHAR));
2194 ret = pCompareStringEx(locale, e->flags, e->first, -1, e->second, -1, NULL, NULL, 0);
2195 todo_wine_if (e->todo)
2196 ok(ret == e->ret || broken(ret == e->broken),
2197 "%d: got %s, expected %s\n", i, op[ret], op[e->ret]);
2198 }
2199
2200}
Definition: _locale.h:75
UINT op
Definition: effect.c:236
#define d
Definition: ke_i.h:81
#define e
Definition: ke_i.h:82
static const struct comparestringex_test comparestringex_tests[]
Definition: locale.c:2023
#define todo_wine_if(is_todo)
Definition: custom.c:76
#define win_skip
Definition: test.h:160
int32_t INT
Definition: typedefs.h:58

Referenced by START_TEST().

◆ test_CompareStringOrdinal()

static void test_CompareStringOrdinal ( void  )
static

Definition at line 4558 of file locale.c.

4559{
4560 INT ret;
4561 WCHAR test1[] = { 't','e','s','t',0 };
4562 WCHAR test2[] = { 'T','e','S','t',0 };
4563 WCHAR test3[] = { 't','e','s','t','3',0 };
4564 WCHAR null1[] = { 'a',0,'a',0 };
4565 WCHAR null2[] = { 'a',0,'b',0 };
4566 WCHAR bills1[] = { 'b','i','l','l','\'','s',0 };
4567 WCHAR bills2[] = { 'b','i','l','l','s',0 };
4568 WCHAR coop1[] = { 'c','o','-','o','p',0 };
4569 WCHAR coop2[] = { 'c','o','o','p',0 };
4570 WCHAR nonascii1[] = { 0x0102,0 };
4571 WCHAR nonascii2[] = { 0x0201,0 };
4572 WCHAR ch1, ch2;
4573
4574 if (!pCompareStringOrdinal)
4575 {
4576 win_skip("CompareStringOrdinal not supported\n");
4577 return;
4578 }
4579
4580 /* Check errors */
4581 SetLastError(0xdeadbeef);
4582 ret = pCompareStringOrdinal(NULL, 0, NULL, 0, FALSE);
4583 ok(!ret, "Got %u, expected 0\n", ret);
4585 SetLastError(0xdeadbeef);
4586 ret = pCompareStringOrdinal(test1, -1, NULL, 0, FALSE);
4587 ok(!ret, "Got %u, expected 0\n", ret);
4589 SetLastError(0xdeadbeef);
4590 ret = pCompareStringOrdinal(NULL, 0, test1, -1, FALSE);
4591 ok(!ret, "Got %u, expected 0\n", ret);
4593
4594 /* Check case */
4595 ret = pCompareStringOrdinal(test1, -1, test1, -1, FALSE);
4596 ok(ret == CSTR_EQUAL, "Got %u, expected %u\n", ret, CSTR_EQUAL);
4597 ret = pCompareStringOrdinal(test1, -1, test2, -1, FALSE);
4598 ok(ret == CSTR_GREATER_THAN, "Got %u, expected %u\n", ret, CSTR_GREATER_THAN);
4599 ret = pCompareStringOrdinal(test2, -1, test1, -1, FALSE);
4600 ok(ret == CSTR_LESS_THAN, "Got %u, expected %u\n", ret, CSTR_LESS_THAN);
4601 ret = pCompareStringOrdinal(test1, -1, test2, -1, TRUE);
4602 ok(ret == CSTR_EQUAL, "Got %u, expected %u\n", ret, CSTR_EQUAL);
4603
4604 /* Check different sizes */
4605 ret = pCompareStringOrdinal(test1, 3, test2, -1, TRUE);
4606 ok(ret == CSTR_LESS_THAN, "Got %u, expected %u\n", ret, CSTR_LESS_THAN);
4607 ret = pCompareStringOrdinal(test1, -1, test2, 3, TRUE);
4608 ok(ret == CSTR_GREATER_THAN, "Got %u, expected %u\n", ret, CSTR_GREATER_THAN);
4609
4610 /* Check null character */
4611 ret = pCompareStringOrdinal(null1, 3, null2, 3, FALSE);
4612 ok(ret == CSTR_LESS_THAN, "Got %u, expected %u\n", ret, CSTR_LESS_THAN);
4613 ret = pCompareStringOrdinal(null1, 3, null2, 3, TRUE);
4614 ok(ret == CSTR_LESS_THAN, "Got %u, expected %u\n", ret, CSTR_LESS_THAN);
4615 ret = pCompareStringOrdinal(test1, 5, test3, 5, FALSE);
4616 ok(ret == CSTR_LESS_THAN, "Got %u, expected %u\n", ret, CSTR_LESS_THAN);
4617 ret = pCompareStringOrdinal(test1, 4, test1, 5, FALSE);
4618 ok(ret == CSTR_LESS_THAN, "Got %u, expected %u\n", ret, CSTR_LESS_THAN);
4619
4620 /* Check ordinal behaviour */
4621 ret = pCompareStringOrdinal(bills1, -1, bills2, -1, FALSE);
4622 ok(ret == CSTR_LESS_THAN, "Got %u, expected %u\n", ret, CSTR_LESS_THAN);
4623 ret = pCompareStringOrdinal(coop2, -1, coop1, -1, FALSE);
4624 ok(ret == CSTR_GREATER_THAN, "Got %u, expected %u\n", ret, CSTR_GREATER_THAN);
4625 ret = pCompareStringOrdinal(nonascii1, -1, nonascii2, -1, FALSE);
4626 ok(ret == CSTR_LESS_THAN, "Got %u, expected %u\n", ret, CSTR_LESS_THAN);
4627 ret = pCompareStringOrdinal(nonascii1, -1, nonascii2, -1, TRUE);
4628 ok(ret == CSTR_LESS_THAN, "Got %u, expected %u\n", ret, CSTR_LESS_THAN);
4629
4630 for (ch1 = 0; ch1 < 512; ch1++)
4631 {
4632 for (ch2 = 0; ch2 < 1024; ch2++)
4633 {
4634 int diff = ch1 - ch2;
4635 ret = pCompareStringOrdinal( &ch1, 1, &ch2, 1, FALSE );
4636 ok( ret == (diff > 0 ? CSTR_GREATER_THAN : diff < 0 ? CSTR_LESS_THAN : CSTR_EQUAL),
4637 "wrong result %d %04x %04x\n", ret, ch1, ch2 );
4638 diff = pRtlUpcaseUnicodeChar( ch1 ) - pRtlUpcaseUnicodeChar( ch2 );
4639 ret = pCompareStringOrdinal( &ch1, 1, &ch2, 1, TRUE );
4640 ok( ret == (diff > 0 ? CSTR_GREATER_THAN : diff < 0 ? CSTR_LESS_THAN : CSTR_EQUAL),
4641 "wrong result %d %04x %04x\n", ret, ch1, ch2 );
4642 }
4643 }
4644}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
void test2()
Definition: ehthrow.cxx:284
void test1()
Definition: ehthrow.cxx:277
void test3()
Definition: ehthrow.cxx:291

Referenced by START_TEST().

◆ test_CompareStringW()

static void test_CompareStringW ( void  )
static

Definition at line 1983 of file locale.c.

1984{
1985 WCHAR *str1, *str2;
1986 SYSTEM_INFO si;
1987 DWORD old_prot;
1988 BOOL success;
1989 char *buf;
1990 int ret;
1991
1992 GetSystemInfo(&si);
1994 ok(buf != NULL, "VirtualAlloc failed with %u\n", GetLastError());
1996 ok(success, "VirtualProtect failed with %u\n", GetLastError());
1997 success = VirtualProtect(buf + 3 * si.dwPageSize, si.dwPageSize, PAGE_NOACCESS, &old_prot);
1998 ok(success, "VirtualProtect failed with %u\n", GetLastError());
1999
2000 str1 = (WCHAR *)(buf + si.dwPageSize - sizeof(WCHAR));
2001 str2 = (WCHAR *)(buf + 3 * si.dwPageSize - sizeof(WCHAR));
2002 *str1 = 'A';
2003 *str2 = 'B';
2004
2005 /* CompareStringW should abort on the first non-matching character */
2006 ret = CompareStringW(CP_ACP, 0, str1, 100, str2, 100);
2007 ok(ret == CSTR_LESS_THAN, "expected CSTR_LESS_THAN, got %d\n", ret);
2008
2010 ok(success, "VirtualFree failed with %u\n", GetLastError());
2011}
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:2671
#define PAGE_READWRITE
Definition: nt_native.h:1304
#define MEM_RELEASE
Definition: nt_native.h:1316
#define MEM_COMMIT
Definition: nt_native.h:1313
#define PAGE_NOACCESS
Definition: nt_native.h:1302
DWORD dwPageSize
Definition: winbase.h:1173
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:65
BOOL NTAPI VirtualProtect(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flNewProtect, OUT PDWORD lpflOldProtect)
Definition: virtmem.c:135
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:119
#define success(from, fromstr, to, tostr)

Referenced by START_TEST().

◆ test_ConvertDefaultLocale()

static void test_ConvertDefaultLocale ( void  )
static

Definition at line 3477 of file locale.c.

3478{
3479 LCID lcid;
3480
3481 /* Doesn't change lcid, even if non default sublang/sort used */
3486
3487 /* SUBLANG_NEUTRAL -> SUBLANG_DEFAULT */
3492
3493 /* Invariant language is not treated specially */
3495
3496 /* User/system default languages alone are not mapped */
3499
3500 /* Default lcids */
3505 ok(lcid == LOCALE_INVARIANT || broken(lcid == 0x47f) /* win2k[3]/winxp */,
3506 "Expected lcid = %08x, got %08x\n", LOCALE_INVARIANT, lcid);
3507}
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:778
LCID WINAPI GetSystemDefaultLCID(void)
Definition: lang.c:797
LCID WINAPI ConvertDefaultLocale(LCID lcid)
Definition: lang.c:1512
#define LCID_RES(src, res)
Definition: locale.c:3473
#define MKLCID(x, y, z)
Definition: locale.c:3472
#define TEST_LCIDLANG(a, b)
Definition: locale.c:3474
#define TEST_LCID(a, b, c)
Definition: locale.c:3475
#define LOCALE_NEUTRAL
#define SORT_JAPANESE_UNICODE
#define LANG_SYSTEM_DEFAULT
#define LOCALE_INVARIANT
#define SUBLANG_ENGLISH_UK
Definition: nls.h:223
#define SUBLANG_NEUTRAL
Definition: nls.h:167
#define LANG_JAPANESE
Definition: nls.h:76
#define LANG_INVARIANT
Definition: nls.h:23
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50

Referenced by START_TEST().

◆ test_EnumDateFormatsA()

static void test_EnumDateFormatsA ( void  )
static

Definition at line 3745 of file locale.c.

3746{
3747 char *p, buf[256];
3748 BOOL ret;
3750
3751 date_fmt_buf[0] = 0;
3752 SetLastError(0xdeadbeef);
3754 if (!ret && (GetLastError() == ERROR_INVALID_FLAGS))
3755 {
3756 win_skip("0 for dwFlags is not supported\n");
3757 }
3758 else
3759 {
3760 ok(ret, "EnumDateFormatsA(0) error %d\n", GetLastError());
3761 trace("EnumDateFormatsA(0): %s\n", date_fmt_buf);
3762 /* test the 1st enumerated format */
3763 if ((p = strchr(date_fmt_buf, '\n'))) *p = 0;
3764 ret = GetLocaleInfoA(lcid, LOCALE_SSHORTDATE, buf, sizeof(buf));
3765 ok(ret, "GetLocaleInfoA(LOCALE_SSHORTDATE) error %d\n", GetLastError());
3766 ok(!lstrcmpA(date_fmt_buf, buf), "expected \"%s\" got \"%s\"\n", date_fmt_buf, buf);
3767 }
3768
3769 date_fmt_buf[0] = 0;
3770 SetLastError(0xdeadbeef);
3772 if (!ret && (GetLastError() == ERROR_INVALID_FLAGS))
3773 {
3774 win_skip("LOCALE_USE_CP_ACP is not supported\n");
3775 }
3776 else
3777 {
3778 ok(ret, "EnumDateFormatsA(LOCALE_USE_CP_ACP) error %d\n", GetLastError());
3779 trace("EnumDateFormatsA(LOCALE_USE_CP_ACP): %s\n", date_fmt_buf);
3780 /* test the 1st enumerated format */
3781 if ((p = strchr(date_fmt_buf, '\n'))) *p = 0;
3782 ret = GetLocaleInfoA(lcid, LOCALE_SSHORTDATE, buf, sizeof(buf));
3783 ok(ret, "GetLocaleInfoA(LOCALE_SSHORTDATE) error %d\n", GetLastError());
3784 ok(!lstrcmpA(date_fmt_buf, buf), "expected \"%s\" got \"%s\"\n", date_fmt_buf, buf);
3785 }
3786
3787 date_fmt_buf[0] = 0;
3789 ok(ret, "EnumDateFormatsA(DATE_SHORTDATE) error %d\n", GetLastError());
3790 trace("EnumDateFormatsA(DATE_SHORTDATE): %s\n", date_fmt_buf);
3791 /* test the 1st enumerated format */
3792 if ((p = strchr(date_fmt_buf, '\n'))) *p = 0;
3793 ret = GetLocaleInfoA(lcid, LOCALE_SSHORTDATE, buf, sizeof(buf));
3794 ok(ret, "GetLocaleInfoA(LOCALE_SSHORTDATE) error %d\n", GetLastError());
3795 ok(!lstrcmpA(date_fmt_buf, buf), "expected \"%s\" got \"%s\"\n", date_fmt_buf, buf);
3796
3797 date_fmt_buf[0] = 0;
3799 ok(ret, "EnumDateFormatsA(DATE_LONGDATE) error %d\n", GetLastError());
3800 trace("EnumDateFormatsA(DATE_LONGDATE): %s\n", date_fmt_buf);
3801 /* test the 1st enumerated format */
3802 if ((p = strchr(date_fmt_buf, '\n'))) *p = 0;
3803 ret = GetLocaleInfoA(lcid, LOCALE_SLONGDATE, buf, sizeof(buf));
3804 ok(ret, "GetLocaleInfoA(LOCALE_SLONGDATE) error %d\n", GetLastError());
3805 ok(!lstrcmpA(date_fmt_buf, buf), "expected \"%s\" got \"%s\"\n", date_fmt_buf, buf);
3806
3807 date_fmt_buf[0] = 0;
3808 SetLastError(0xdeadbeef);
3809 ret = EnumDateFormatsA(enum_datetime_procA, lcid, DATE_YEARMONTH);
3810 if (!ret && (GetLastError() == ERROR_INVALID_FLAGS))
3811 {
3812 win_skip("DATE_YEARMONTH is only present on W2K and later\n");
3813 return;
3814 }
3815 ok(ret, "EnumDateFormatsA(DATE_YEARMONTH) error %d\n", GetLastError());
3816 trace("EnumDateFormatsA(DATE_YEARMONTH): %s\n", date_fmt_buf);
3817 /* test the 1st enumerated format */
3818 if ((p = strchr(date_fmt_buf, '\n'))) *p = 0;
3819 ret = GetLocaleInfoA(lcid, LOCALE_SYEARMONTH, buf, sizeof(buf));
3820 ok(ret, "GetLocaleInfoA(LOCALE_SYEARMONTH) error %d\n", GetLastError());
3821 ok(!lstrcmpA(date_fmt_buf, buf) || broken(!buf[0]) /* win9x */,
3822 "expected \"%s\" got \"%s\"\n", date_fmt_buf, buf);
3823}
char * strchr(const char *String, int ch)
Definition: utclib.c:501
GLfloat GLfloat p
Definition: glext.h:8902
INT WINAPI GetLocaleInfoA(LCID lcid, LCTYPE lctype, LPSTR buffer, INT len)
Definition: lang.c:1028
BOOL WINAPI EnumDateFormatsA(DATEFMT_ENUMPROCA proc, LCID lcid, DWORD flags)
Definition: lcformat.c:2017
static BOOL CALLBACK enum_datetime_procA(LPSTR fmt)
Definition: locale.c:3732
#define LOCALE_SLONGDATE
Definition: winnls.h:61
#define LOCALE_SSHORTDATE
Definition: winnls.h:60
#define DATE_LONGDATE
Definition: winnls.h:197
#define DATE_SHORTDATE
Definition: winnls.h:196

Referenced by START_TEST().

◆ test_EnumLanguageGroupLocalesA()

static void test_EnumLanguageGroupLocalesA ( void  )
static

Definition at line 3603 of file locale.c.

3604{
3605 BOOL ret;
3606
3607 if (!pEnumLanguageGroupLocalesA || !pIsValidLanguageGroup)
3608 {
3609 win_skip("EnumLanguageGroupLocalesA and/or IsValidLanguageGroup are not available\n");
3610 return;
3611 }
3612
3613 /* No enumeration proc */
3614 SetLastError(0);
3615 ret = pEnumLanguageGroupLocalesA(0, LGRPID_WESTERN_EUROPE, 0, 0);
3617 {
3618 win_skip("EnumLanguageGroupLocalesA is not implemented\n");
3619 return;
3620 }
3622 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3623
3624 /* lgrpid too small */
3625 SetLastError(0);
3626 ret = pEnumLanguageGroupLocalesA(lgrplocale_procA, 0, 0, 0);
3628 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3629
3630 /* lgrpid too big */
3631 SetLastError(0);
3632 ret = pEnumLanguageGroupLocalesA(lgrplocale_procA, LGRPID_ARMENIAN + 1, 0, 0);
3634 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3635
3636 /* dwFlags is reserved */
3637 SetLastError(0);
3638 ret = pEnumLanguageGroupLocalesA(0, LGRPID_WESTERN_EUROPE, 0x1, 0);
3640 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3641
3642 pEnumLanguageGroupLocalesA(lgrplocale_procA, LGRPID_WESTERN_EUROPE, 0, 0);
3643}
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
static BOOL CALLBACK lgrplocale_procA(LGRPID lgrpid, LCID lcid, LPSTR lpszNum, LONG_PTR lParam)
Definition: locale.c:3586
#define LGRPID_ARMENIAN
Definition: winnls.h:476
#define LGRPID_WESTERN_EUROPE
Definition: winnls.h:460

Referenced by START_TEST().

◆ test_EnumSystemGeoID()

static void test_EnumSystemGeoID ( void  )
static

Definition at line 4743 of file locale.c.

4744{
4745 BOOL ret;
4746
4747 if (!pEnumSystemGeoID)
4748 {
4749 win_skip("EnumSystemGeoID is not available.\n");
4750 return;
4751 }
4752
4753 SetLastError(0xdeadbeef);
4754 ret = pEnumSystemGeoID(GEOCLASS_NATION, 0, NULL);
4755 ok(!ret, "got %d\n", ret);
4757
4758 SetLastError(0xdeadbeef);
4759 ret = pEnumSystemGeoID(GEOCLASS_NATION+1, 0, test_geoid_enumproc);
4760 ok(!ret, "got %d\n", ret);
4761 ok(GetLastError() == ERROR_INVALID_FLAGS, "got %d\n", GetLastError());
4762
4763 SetLastError(0xdeadbeef);
4764 ret = pEnumSystemGeoID(GEOCLASS_NATION+1, 0, NULL);
4765 ok(!ret, "got %d\n", ret);
4767
4768 ret = pEnumSystemGeoID(GEOCLASS_NATION, 0, test_geoid_enumproc);
4769 ok(ret, "got %d\n", ret);
4770
4771 /* only the first level is enumerated, not the whole hierarchy */
4772 geoidenum_count = 0;
4773 ret = pEnumSystemGeoID(GEOCLASS_NATION, 39070, test_geoid_enumproc2);
4774 if (ret == 0)
4775 win_skip("Parent GEOID is not supported in EnumSystemGeoID.\n");
4776 else
4777 ok(ret && geoidenum_count > 0, "got %d, count %d\n", ret, geoidenum_count);
4778
4779 geoidenum_count = 0;
4780 ret = pEnumSystemGeoID(GEOCLASS_REGION, 39070, test_geoid_enumproc2);
4781 if (ret == 0)
4782 win_skip("GEOCLASS_REGION is not supported in EnumSystemGeoID.\n");
4783 else
4784 {
4785 ok(ret && geoidenum_count > 0, "got %d, count %d\n", ret, geoidenum_count);
4786
4787 geoidenum_count = 0;
4788 ret = pEnumSystemGeoID(GEOCLASS_REGION, 0, test_geoid_enumproc2);
4789 ok(ret && geoidenum_count > 0, "got %d, count %d\n", ret, geoidenum_count);
4790 }
4791}
static BOOL CALLBACK test_geoid_enumproc2(GEOID geoid)
Definition: locale.c:4737
static int geoidenum_count
Definition: locale.c:4726
static BOOL CALLBACK test_geoid_enumproc(GEOID geoid)
Definition: locale.c:4727
@ GEOCLASS_REGION
Definition: winnls.h:556
@ GEOCLASS_NATION
Definition: winnls.h:555

Referenced by START_TEST().

◆ test_EnumSystemLanguageGroupsA()

static void test_EnumSystemLanguageGroupsA ( void  )
static

Definition at line 3526 of file locale.c.

3527{
3528 BOOL ret;
3529
3530 if (!pEnumSystemLanguageGroupsA || !pIsValidLanguageGroup)
3531 {
3532 win_skip("EnumSystemLanguageGroupsA and/or IsValidLanguageGroup are not available\n");
3533 return;
3534 }
3535
3536 /* No enumeration proc */
3537 SetLastError(0);
3538 ret = pEnumSystemLanguageGroupsA(0, LGRPID_INSTALLED, 0);
3540 {
3541 win_skip("EnumSystemLanguageGroupsA is not implemented\n");
3542 return;
3543 }
3545 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3546
3547 /* Invalid flags */
3548 SetLastError(0);
3549 pEnumSystemLanguageGroupsA(langgrp_procA, LGRPID_INSTALLED|LGRPID_SUPPORTED, 0);
3550 ok(GetLastError() == ERROR_INVALID_FLAGS, "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
3551
3552 /* No flags - defaults to LGRPID_INSTALLED */
3553 SetLastError(0xdeadbeef);
3554 pEnumSystemLanguageGroupsA(langgrp_procA, 0, 1);
3555 ok(GetLastError() == 0xdeadbeef, "got error %d\n", GetLastError());
3556
3557 pEnumSystemLanguageGroupsA(langgrp_procA, LGRPID_INSTALLED, 0);
3558 pEnumSystemLanguageGroupsA(langgrp_procA, LGRPID_SUPPORTED, 0);
3559}
static BOOL CALLBACK langgrp_procA(LGRPID lgrpid, LPSTR lpszNum, LPSTR lpszName, DWORD dwFlags, LONG_PTR lParam)
Definition: locale.c:3509

Referenced by START_TEST().

◆ test_EnumSystemLocalesEx()

static void test_EnumSystemLocalesEx ( void  )
static

Definition at line 3568 of file locale.c.

3569{
3570 BOOL ret;
3571
3572 if (!pEnumSystemLocalesEx)
3573 {
3574 win_skip( "EnumSystemLocalesEx not available\n" );
3575 return;
3576 }
3577 SetLastError( 0xdeadbeef );
3578 ret = pEnumSystemLocalesEx( enum_func, LOCALE_ALL, 0, (void *)1 );
3579 ok( !ret, "should have failed\n" );
3580 ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
3581 SetLastError( 0xdeadbeef );
3582 ret = pEnumSystemLocalesEx( enum_func, 0, 0, NULL );
3583 ok( ret, "failed err %u\n", GetLastError() );
3584}
static BOOL CALLBACK enum_func(LPWSTR name, DWORD flags, LPARAM lparam)
Definition: locale.c:3561
#define LOCALE_ALL
Definition: winnls.h:205

Referenced by START_TEST().

◆ test_EnumTimeFormatsA()

static void test_EnumTimeFormatsA ( void  )
static

Definition at line 3825 of file locale.c.

3826{
3827 char *p, buf[256];
3828 BOOL ret;
3830
3831 date_fmt_buf[0] = 0;
3833 ok(ret, "EnumTimeFormatsA(0) error %d\n", GetLastError());
3834 trace("EnumTimeFormatsA(0): %s\n", date_fmt_buf);
3835 /* test the 1st enumerated format */
3836 if ((p = strchr(date_fmt_buf, '\n'))) *p = 0;
3837 ret = GetLocaleInfoA(lcid, LOCALE_STIMEFORMAT, buf, sizeof(buf));
3838 ok(ret, "GetLocaleInfoA(LOCALE_STIMEFORMAT) error %d\n", GetLastError());
3839 ok(!lstrcmpA(date_fmt_buf, buf), "expected \"%s\" got \"%s\"\n", date_fmt_buf, buf);
3840
3841 date_fmt_buf[0] = 0;
3843 ok(ret, "EnumTimeFormatsA(LOCALE_USE_CP_ACP) error %d\n", GetLastError());
3844 trace("EnumTimeFormatsA(LOCALE_USE_CP_ACP): %s\n", date_fmt_buf);
3845 /* test the 1st enumerated format */
3846 if ((p = strchr(date_fmt_buf, '\n'))) *p = 0;
3847 ret = GetLocaleInfoA(lcid, LOCALE_STIMEFORMAT, buf, sizeof(buf));
3848 ok(ret, "GetLocaleInfoA(LOCALE_STIMEFORMAT) error %d\n", GetLastError());
3849 ok(!lstrcmpA(date_fmt_buf, buf), "expected \"%s\" got \"%s\"\n", date_fmt_buf, buf);
3850}
BOOL WINAPI EnumTimeFormatsA(TIMEFMT_ENUMPROCA proc, LCID lcid, DWORD flags)
Definition: lcformat.c:2134
#define LOCALE_STIMEFORMAT
Definition: winnls.h:62

Referenced by START_TEST().

◆ test_EnumTimeFormatsW()

static void test_EnumTimeFormatsW ( void  )
static

Definition at line 3852 of file locale.c.

3853{
3855 WCHAR bufW[256];
3856 BOOL ret;
3857
3858 date_fmt_bufW[0] = 0;
3860 ok(ret, "EnumTimeFormatsW(0) error %d\n", GetLastError());
3861 ret = GetLocaleInfoW(lcid, LOCALE_STIMEFORMAT, bufW, sizeof(bufW)/sizeof(bufW[0]));
3862 ok(ret, "GetLocaleInfoW(LOCALE_STIMEFORMAT) error %d\n", GetLastError());
3863 ok(!lstrcmpW(date_fmt_bufW, bufW), "expected \"%s\" got \"%s\"\n", wine_dbgstr_w(date_fmt_bufW),
3864 wine_dbgstr_w(bufW));
3865
3866 date_fmt_bufW[0] = 0;
3868 ok(ret, "EnumTimeFormatsW(LOCALE_USE_CP_ACP) error %d\n", GetLastError());
3869 ret = GetLocaleInfoW(lcid, LOCALE_STIMEFORMAT, bufW, sizeof(bufW)/sizeof(bufW[0]));
3870 ok(ret, "GetLocaleInfoW(LOCALE_STIMEFORMAT) error %d\n", GetLastError());
3871 ok(!lstrcmpW(date_fmt_bufW, bufW), "expected \"%s\" got \"%s\"\n", wine_dbgstr_w(date_fmt_bufW),
3872 wine_dbgstr_w(bufW));
3873
3874 /* TIME_NOSECONDS is Win7+ feature */
3875 date_fmt_bufW[0] = 0;
3878 win_skip("EnumTimeFormatsW doesn't support TIME_NOSECONDS\n");
3879 else {
3880 char buf[256];
3881
3882 ok(ret, "EnumTimeFormatsW(TIME_NOSECONDS) error %d\n", GetLastError());
3883 ret = GetLocaleInfoW(lcid, LOCALE_SSHORTTIME, bufW, sizeof(bufW)/sizeof(bufW[0]));
3884 ok(ret, "GetLocaleInfoW(LOCALE_SSHORTTIME) error %d\n", GetLastError());
3885 ok(!lstrcmpW(date_fmt_bufW, bufW), "expected \"%s\" got \"%s\"\n", wine_dbgstr_w(date_fmt_bufW),
3886 wine_dbgstr_w(bufW));
3887
3888 /* EnumTimeFormatsA doesn't support this flag */
3890 ok(!ret && GetLastError() == ERROR_INVALID_FLAGS, "EnumTimeFormatsA(TIME_NOSECONDS) ret %d, error %d\n", ret,
3891 GetLastError());
3892
3894 ok(!ret && GetLastError() == ERROR_INVALID_FLAGS, "EnumTimeFormatsA(TIME_NOSECONDS) ret %d, error %d\n", ret,
3895 GetLastError());
3896
3897 /* And it's not supported by GetLocaleInfoA either */
3898 ret = GetLocaleInfoA(lcid, LOCALE_SSHORTTIME, buf, sizeof(buf)/sizeof(buf[0]));
3899 ok(!ret && GetLastError() == ERROR_INVALID_FLAGS, "GetLocaleInfoA(LOCALE_SSHORTTIME) ret %d, error %d\n", ret,
3900 GetLastError());
3901 }
3902}
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1108
BOOL WINAPI EnumTimeFormatsW(TIMEFMT_ENUMPROCW proc, LCID lcid, DWORD flags)
Definition: lcformat.c:2157
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static BOOL CALLBACK enum_datetime_procW(WCHAR *fmt)
Definition: locale.c:3739
#define LOCALE_SSHORTTIME
Definition: winnls.h:163
#define TIME_NOSECONDS
Definition: winnls.h:278

Referenced by START_TEST().

◆ test_EnumUILanguageA()

static void test_EnumUILanguageA ( void  )
static

Definition at line 3689 of file locale.c.

3690{
3691 BOOL ret;
3692 if (!pEnumUILanguagesA) {
3693 win_skip("EnumUILanguagesA is not available on Win9x or NT4\n");
3694 return;
3695 }
3696
3698 ret = pEnumUILanguagesA(luilocale_proc1A, 0, 0);
3700 {
3701 win_skip("EnumUILanguagesA is not implemented\n");
3702 return;
3703 }
3704 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
3705
3706 enumCount = 0;
3708 ret = pEnumUILanguagesA(luilocale_proc2A, 0, 0);
3709 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
3710
3712 ret = pEnumUILanguagesA(NULL, 0, 0);
3713 ok(!ret, "Expected return value FALSE, got %u\n", ret);
3715 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3716
3718 ret = pEnumUILanguagesA(luilocale_proc3A, 0x5a5a5a5a, 0);
3719 ok(!ret, "Expected return value FALSE, got %u\n", ret);
3720 ok(GetLastError() == ERROR_INVALID_FLAGS, "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
3721
3723 ret = pEnumUILanguagesA(NULL, 0x5a5a5a5a, 0);
3724 ok(!ret, "Expected return value FALSE, got %u\n", ret);
3726 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3727}
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL CALLBACK luilocale_proc2A(LPSTR value, LONG_PTR lParam)
Definition: locale.c:3676
static BOOL CALLBACK luilocale_proc1A(LPSTR value, LONG_PTR lParam)
Definition: locale.c:3669
static BOOL CALLBACK luilocale_proc3A(LPSTR value, LONG_PTR lParam)
Definition: locale.c:3683

Referenced by START_TEST().

◆ test_FoldStringA()

static void test_FoldStringA ( void  )
static

Definition at line 2957 of file locale.c.

2958{
2959 int ret, i, j;
2960 BOOL is_special;
2961 char src[256], dst[256];
2962 static const char digits_src[] = { 0xB9,0xB2,0xB3,'\0' };
2963 static const char digits_dst[] = { '1','2','3','\0' };
2964 static const char composite_src[] =
2965 {
2966 0x8a,0x8e,0x9a,0x9e,0x9f,0xc0,0xc1,0xc2,
2967 0xc3,0xc4,0xc5,0xc7,0xc8,0xc9,0xca,0xcb,
2968 0xcc,0xcd,0xce,0xcf,0xd1,0xd2,0xd3,0xd4,
2969 0xd5,0xd6,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,
2970 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe7,0xe8,
2971 0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,0xf1,
2972 0xf2,0xf3,0xf4,0xf5,0xf6,0xf8,0xf9,0xfa,
2973 0xfb,0xfc,0xfd,0xff,'\0'
2974 };
2975 static const char composite_dst[] =
2976 {
2977 0x53,0x3f,0x5a,0x3f,0x73,0x3f,0x7a,0x3f,
2978 0x59,0xa8,0x41,0x60,0x41,0xb4,0x41,0x5e,
2979 0x41,0x7e,0x41,0xa8,0x41,0xb0,0x43,0xb8,
2980 0x45,0x60,0x45,0xb4,0x45,0x5e,0x45,0xa8,
2981 0x49,0x60,0x49,0xb4,0x49,0x5e,0x49,0xa8,
2982 0x4e,0x7e,0x4f,0x60,0x4f,0xb4,0x4f,0x5e,
2983 0x4f,0x7e,0x4f,0xa8,0x4f,0x3f,0x55,0x60,
2984 0x55,0xb4,0x55,0x5e,0x55,0xa8,0x59,0xb4,
2985 0x61,0x60,0x61,0xb4,0x61,0x5e,0x61,0x7e,
2986 0x61,0xa8,0x61,0xb0,0x63,0xb8,0x65,0x60,
2987 0x65,0xb4,0x65,0x5e,0x65,0xa8,0x69,0x60,
2988 0x69,0xb4,0x69,0x5e,0x69,0xa8,0x6e,0x7e,
2989 0x6f,0x60,0x6f,0xb4,0x6f,0x5e,0x6f,0x7e,
2990 0x6f,0xa8,0x6f,0x3f,0x75,0x60,0x75,0xb4,
2991 0x75,0x5e,0x75,0xa8,0x79,0xb4,0x79,0xa8,'\0'
2992 };
2993 static const char composite_dst_alt[] =
2994 {
2995 0x53,0x3f,0x5a,0x3f,0x73,0x3f,0x7a,0x3f,
2996 0x59,0xa8,0x41,0x60,0x41,0xb4,0x41,0x5e,
2997 0x41,0x7e,0x41,0xa8,0x41,0xb0,0x43,0xb8,
2998 0x45,0x60,0x45,0xb4,0x45,0x5e,0x45,0xa8,
2999 0x49,0x60,0x49,0xb4,0x49,0x5e,0x49,0xa8,
3000 0x4e,0x7e,0x4f,0x60,0x4f,0xb4,0x4f,0x5e,
3001 0x4f,0x7e,0x4f,0xa8,0xd8,0x55,0x60,0x55,
3002 0xb4,0x55,0x5e,0x55,0xa8,0x59,0xb4,0x61,
3003 0x60,0x61,0xb4,0x61,0x5e,0x61,0x7e,0x61,
3004 0xa8,0x61,0xb0,0x63,0xb8,0x65,0x60,0x65,
3005 0xb4,0x65,0x5e,0x65,0xa8,0x69,0x60,0x69,
3006 0xb4,0x69,0x5e,0x69,0xa8,0x6e,0x7e,0x6f,
3007 0x60,0x6f,0xb4,0x6f,0x5e,0x6f,0x7e,0x6f,
3008 0xa8,0xf8,0x75,0x60,0x75,0xb4,0x75,0x5e,
3009 0x75,0xa8,0x79,0xb4,0x79,0xa8,'\0'
3010 };
3011 static const char ligatures_src[] =
3012 {
3013 0x8C,0x9C,0xC6,0xDE,0xDF,0xE6,0xFE,'\0'
3014 };
3015 static const char ligatures_dst[] =
3016 {
3017 'O','E','o','e','A','E','T','H','s','s','a','e','t','h','\0'
3018 };
3019 static const struct special
3020 {
3021 char src;
3022 char dst[4];
3023 } foldczone_special[] =
3024 {
3025 /* src dst */
3026 { 0x85, { 0x2e, 0x2e, 0x2e, 0x00 } },
3027 { 0x98, { 0x20, 0x7e, 0x00 } },
3028 { 0x99, { 0x54, 0x4d, 0x00 } },
3029 { 0xa0, { 0x20, 0x00 } },
3030 { 0xa8, { 0x20, 0xa8, 0x00 } },
3031 { 0xaa, { 0x61, 0x00 } },
3032 { 0xaf, { 0x20, 0xaf, 0x00 } },
3033 { 0xb2, { 0x32, 0x00 } },
3034 { 0xb3, { 0x33, 0x00 } },
3035 { 0xb4, { 0x20, 0xb4, 0x00 } },
3036 { 0xb8, { 0x20, 0xb8, 0x00 } },
3037 { 0xb9, { 0x31, 0x00 } },
3038 { 0xba, { 0x6f, 0x00 } },
3039 { 0xbc, { 0x31, 0x2f, 0x34, 0x00 } },
3040 { 0xbd, { 0x31, 0x2f, 0x32, 0x00 } },
3041 { 0xbe, { 0x33, 0x2f, 0x34, 0x00 } },
3042 { 0x00 }
3043 };
3044
3045 if (!pFoldStringA)
3046 return; /* FoldString is present in NT v3.1+, but not 95/98/Me */
3047
3048 /* these tests are locale specific */
3049 if (GetACP() != 1252)
3050 {
3051 trace("Skipping FoldStringA tests for a not Latin 1 locale\n");
3052 return;
3053 }
3054
3055 /* MAP_FOLDDIGITS */
3056 SetLastError(0);
3057 ret = pFoldStringA(MAP_FOLDDIGITS, digits_src, -1, dst, 256);
3059 {
3060 win_skip("FoldStringA is not implemented\n");
3061 return;
3062 }
3063 ok(ret == 4, "Expected ret == 4, got %d, error %d\n", ret, GetLastError());
3064 ok(strcmp(dst, digits_dst) == 0,
3065 "MAP_FOLDDIGITS: Expected '%s', got '%s'\n", digits_dst, dst);
3066 for (i = 1; i < 256; i++)
3067 {
3068 if (!strchr(digits_src, i))
3069 {
3070 src[0] = i;
3071 src[1] = '\0';
3072 SetLastError(0);
3073 ret = pFoldStringA(MAP_FOLDDIGITS, src, -1, dst, 256);
3074 ok(ret == 2, "Expected ret == 2, got %d, error %d\n", ret, GetLastError());
3075 ok(dst[0] == src[0],
3076 "MAP_FOLDDIGITS: Expected '%s', got '%s'\n", src, dst);
3077 }
3078 }
3079
3080 /* MAP_EXPAND_LIGATURES */
3081 SetLastError(0);
3082 ret = pFoldStringA(MAP_EXPAND_LIGATURES, ligatures_src, -1, dst, 256);
3083 /* NT 4.0 doesn't support MAP_EXPAND_LIGATURES */
3084 if (!(ret == 0 && GetLastError() == ERROR_INVALID_FLAGS)) {
3085 ok(ret == sizeof(ligatures_dst), "Got %d, error %d\n", ret, GetLastError());
3086 ok(strcmp(dst, ligatures_dst) == 0,
3087 "MAP_EXPAND_LIGATURES: Expected '%s', got '%s'\n", ligatures_dst, dst);
3088 for (i = 1; i < 256; i++)
3089 {
3090 if (!strchr(ligatures_src, i))
3091 {
3092 src[0] = i;
3093 src[1] = '\0';
3094 SetLastError(0);
3095 ret = pFoldStringA(MAP_EXPAND_LIGATURES, src, -1, dst, 256);
3096 if (ret == 3)
3097 {
3098 /* Vista */
3099 ok((i == 0xDC && lstrcmpA(dst, "UE") == 0) ||
3100 (i == 0xFC && lstrcmpA(dst, "ue") == 0),
3101 "Got %s for %d\n", dst, i);
3102 }
3103 else
3104 {
3105 ok(ret == 2, "Expected ret == 2, got %d, error %d\n", ret, GetLastError());
3106 ok(dst[0] == src[0],
3107 "MAP_EXPAND_LIGATURES: Expected '%s', got '%s'\n", src, dst);
3108 }
3109 }
3110 }
3111 }
3112
3113 /* MAP_COMPOSITE */
3114 SetLastError(0);
3115 ret = pFoldStringA(MAP_COMPOSITE, composite_src, -1, dst, 256);
3116 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
3117 ok(ret == 121 || ret == 119, "Expected 121 or 119, got %d\n", ret);
3118 ok(strcmp(dst, composite_dst) == 0 || strcmp(dst, composite_dst_alt) == 0,
3119 "MAP_COMPOSITE: Mismatch, got '%s'\n", dst);
3120
3121 for (i = 1; i < 256; i++)
3122 {
3123 if (!strchr(composite_src, i))
3124 {
3125 src[0] = i;
3126 src[1] = '\0';
3127 SetLastError(0);
3128 ret = pFoldStringA(MAP_COMPOSITE, src, -1, dst, 256);
3129 ok(ret == 2, "Expected ret == 2, got %d, error %d\n", ret, GetLastError());
3130 ok(dst[0] == src[0],
3131 "0x%02x, 0x%02x,0x%02x,0x%02x,\n", (unsigned char)src[0],
3132 (unsigned char)dst[0],(unsigned char)dst[1],(unsigned char)dst[2]);
3133 }
3134 }
3135
3136 /* MAP_FOLDCZONE */
3137 for (i = 1; i < 256; i++)
3138 {
3139 src[0] = i;
3140 src[1] = '\0';
3141 SetLastError(0);
3142 ret = pFoldStringA(MAP_FOLDCZONE, src, -1, dst, 256);
3143 is_special = FALSE;
3144 for (j = 0; foldczone_special[j].src != 0 && ! is_special; j++)
3145 {
3146 if (foldczone_special[j].src == src[0])
3147 {
3148 ok(ret == 2 || ret == lstrlenA(foldczone_special[j].dst) + 1,
3149 "Expected ret == 2 or %d, got %d, error %d\n",
3150 lstrlenA(foldczone_special[j].dst) + 1, ret, GetLastError());
3151 ok(src[0] == dst[0] || lstrcmpA(foldczone_special[j].dst, dst) == 0,
3152 "MAP_FOLDCZONE: string mismatch for 0x%02x\n",
3153 (unsigned char)src[0]);
3154 is_special = TRUE;
3155 }
3156 }
3157 if (! is_special)
3158 {
3159 ok(ret == 2, "Expected ret == 2, got %d, error %d\n", ret, GetLastError());
3160 ok(src[0] == dst[0],
3161 "MAP_FOLDCZONE: Expected 0x%02x, got 0x%02x\n",
3162 (unsigned char)src[0], (unsigned char)dst[0]);
3163 }
3164 }
3165
3166 /* MAP_PRECOMPOSED */
3167 for (i = 1; i < 256; i++)
3168 {
3169 src[0] = i;
3170 src[1] = '\0';
3171 SetLastError(0);
3172 ret = pFoldStringA(MAP_PRECOMPOSED, src, -1, dst, 256);
3173 ok(ret == 2, "Expected ret == 2, got %d, error %d\n", ret, GetLastError());
3174 ok(src[0] == dst[0],
3175 "MAP_PRECOMPOSED: Expected 0x%02x, got 0x%02x\n",
3176 (unsigned char)src[0], (unsigned char)dst[0]);
3177 }
3178}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define MAP_FOLDDIGITS
Definition: winnls.h:214
UINT WINAPI GetACP(void)
Definition: nls.c:2307
#define MAP_PRECOMPOSED
Definition: winnls.h:215
#define MAP_COMPOSITE
Definition: winnls.h:216
#define MAP_FOLDCZONE
Definition: winnls.h:213

Referenced by START_TEST().

◆ test_FoldStringW()

static void test_FoldStringW ( void  )
static

Definition at line 3180 of file locale.c.

3181{
3182 int ret;
3183 unsigned int i, j;
3184 WCHAR src[256], dst[256], ch, prev_ch = 1;
3185 static const DWORD badFlags[] =
3186 {
3187 0,
3189 MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES,
3190 MAP_COMPOSITE|MAP_EXPAND_LIGATURES
3191 };
3192 /* Ranges of digits 0-9 : Must be sorted! */
3193 static const WCHAR digitRanges[] =
3194 {
3195 0x0030, /* '0'-'9' */
3196 0x0660, /* Eastern Arabic */
3197 0x06F0, /* Arabic - Hindu */
3198 0x07C0, /* Nko */
3199 0x0966, /* Devengari */
3200 0x09E6, /* Bengalii */
3201 0x0A66, /* Gurmukhi */
3202 0x0AE6, /* Gujarati */
3203 0x0B66, /* Oriya */
3204 0x0BE6, /* Tamil - No 0 */
3205 0x0C66, /* Telugu */
3206 0x0CE6, /* Kannada */
3207 0x0D66, /* Maylayalam */
3208 0x0DE6, /* Sinhala Lith */
3209 0x0E50, /* Thai */
3210 0x0ED0, /* Laos */
3211 0x0F20, /* Tibet */
3212 0x0F29, /* Tibet half - 0 is out of sequence */
3213 0x1040, /* Myanmar */
3214 0x1090, /* Myanmar Shan */
3215 0x1368, /* Ethiopic - no 0 */
3216 0x17E0, /* Khmer */
3217 0x1810, /* Mongolian */
3218 0x1946, /* Limbu */
3219 0x19D0, /* New Tai Lue */
3220 0x1A80, /* Tai Tham Hora */
3221 0x1A90, /* Tai Tham Tham */
3222 0x1B50, /* Balinese */
3223 0x1BB0, /* Sundanese */
3224 0x1C40, /* Lepcha */
3225 0x1C50, /* Ol Chiki */
3226 0x2070, /* Superscript - 1, 2, 3 are out of sequence */
3227 0x2080, /* Subscript */
3228 0x245F, /* Circled - 0 is out of sequence */
3229 0x2473, /* Bracketed */
3230 0x2487, /* Full stop */
3231 0x24F4, /* Double Circled */
3232 0x2775, /* Inverted circled - No 0 */
3233 0x277F, /* Patterned circled - No 0 */
3234 0x2789, /* Inverted Patterned circled - No 0 */
3235 0x3020, /* Hangzhou */
3236 0xA620, /* Vai */
3237 0xA8D0, /* Saurashtra */
3238 0xA900, /* Kayah Li */
3239 0xA9D0, /* Javanese */
3240 0xA9F0, /* Myanmar Tai Laing */
3241 0xAA50, /* Cham */
3242 0xABF0, /* Meetei Mayek */
3243 0xff10, /* Pliene chasse (?) */
3244 0xffff /* Terminator */
3245 };
3246 /* Digits which are represented, but out of sequence */
3247 static const WCHAR outOfSequenceDigits[] =
3248 {
3249 0xB9, /* Superscript 1 */
3250 0xB2, /* Superscript 2 */
3251 0xB3, /* Superscript 3 */
3252 0x0C78, /* Telugu Fraction 0 */
3253 0x0C79, /* Telugu Fraction 1 */
3254 0x0C7A, /* Telugu Fraction 2 */
3255 0x0C7B, /* Telugu Fraction 3 */
3256 0x0C7C, /* Telugu Fraction 1 */
3257 0x0C7D, /* Telugu Fraction 2 */
3258 0x0C7E, /* Telugu Fraction 3 */
3259 0x0F33, /* Tibetan half zero */
3260 0x19DA, /* New Tai Lue Tham 1 */
3261 0x24EA, /* Circled 0 */
3262 0x24FF, /* Negative Circled 0 */
3263 0x3007, /* Ideographic number zero */
3264 '\0' /* Terminator */
3265 };
3266 /* Digits in digitRanges for which no representation is available */
3267 static const WCHAR noDigitAvailable[] =
3268 {
3269 0x0BE6, /* No Tamil 0 */
3270 0x0F29, /* No Tibetan half zero (out of sequence) */
3271 0x1368, /* No Ethiopic 0 */
3272 0x2473, /* No Bracketed 0 */
3273 0x2487, /* No 0 Full stop */
3274 0x24F4, /* No double circled 0 */
3275 0x2775, /* No inverted circled 0 */
3276 0x277F, /* No patterned circled */
3277 0x2789, /* No inverted Patterned circled */
3278 0x3020, /* No Hangzhou 0 */
3279 '\0' /* Terminator */
3280 };
3281 static const WCHAR foldczone_src[] =
3282 {
3283 'W', 'i', 'n', 'e', 0x0348, 0x0551, 0x1323, 0x280d,
3284 0xff37, 0xff49, 0xff4e, 0xff45, '\0'
3285 };
3286 static const WCHAR foldczone_dst[] =
3287 {
3288 'W','i','n','e',0x0348,0x0551,0x1323,0x280d,'W','i','n','e','\0'
3289 };
3290 static const WCHAR foldczone_todo_src[] =
3291 {
3292 0x3c5,0x308,0x6a,0x30c,0xa0,0xaa,0
3293 };
3294 static const WCHAR foldczone_todo_dst[] =
3295 {
3296 0x3cb,0x1f0,' ','a',0
3297 };
3298 static const WCHAR foldczone_todo_broken_dst[] =
3299 {
3300 0x3cb,0x1f0,0xa0,0xaa,0
3301 };
3302 static const WCHAR ligatures_src[] =
3303 {
3304 'W', 'i', 'n', 'e', 0x03a6, 0x03b9, 0x03bd, 0x03b5,
3305 0x00c6, 0x00de, 0x00df, 0x00e6, 0x00fe, 0x0132, 0x0133, 0x0152,
3306 0x0153, 0x01c4, 0x01c5, 0x01c6, 0x01c7, 0x01c8, 0x01c9, 0x01ca,
3307 0x01cb, 0x01cc, 0x01e2, 0x01e3, 0x01f1, 0x01f2, 0x01f3, 0x01fc,
3308 0x01fd, 0x05f0, 0x05f1, 0x05f2, 0xfb00, 0xfb01, 0xfb02, 0xfb03,
3309 0xfb04, 0xfb05, 0xfb06, '\0'
3310 };
3311 static const WCHAR ligatures_dst[] =
3312 {
3313 'W','i','n','e',0x03a6,0x03b9,0x03bd,0x03b5,
3314 'A','E','T','H','s','s','a','e','t','h','I','J','i','j','O','E','o','e',
3315 'D',0x017d,'D',0x017e,'d',0x017e,'L','J','L','j','l','j','N','J','N','j',
3316 'n','j',0x0100,0x0112,0x0101,0x0113,'D','Z','D','z','d','z',0x00c1,0x00c9,
3317 0x00e1,0x00e9,0x05d5,0x05d5,0x05d5,0x05d9,0x05d9,0x05d9,'f','f','f','i',
3318 'f','l','f','f','i','f','f','l',0x017f,'t','s','t','\0'
3319 };
3320
3321 if (!pFoldStringW)
3322 {
3323 win_skip("FoldStringW is not available\n");
3324 return; /* FoldString is present in NT v3.1+, but not 95/98/Me */
3325 }
3326
3327 /* Invalid flag combinations */
3328 for (i = 0; i < sizeof(badFlags)/sizeof(badFlags[0]); i++)
3329 {
3330 src[0] = dst[0] = '\0';
3331 SetLastError(0);
3332 ret = pFoldStringW(badFlags[i], src, 256, dst, 256);
3334 {
3335 win_skip("FoldStringW is not implemented\n");
3336 return;
3337 }
3339 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
3340 }
3341
3342 /* src & dst cannot be the same */
3343 SetLastError(0);
3344 ret = pFoldStringW(MAP_FOLDCZONE, src, -1, src, 256);
3346 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3347
3348 /* src can't be NULL */
3349 SetLastError(0);
3350 ret = pFoldStringW(MAP_FOLDCZONE, NULL, -1, dst, 256);
3352 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3353
3354 /* srclen can't be 0 */
3355 SetLastError(0);
3356 ret = pFoldStringW(MAP_FOLDCZONE, src, 0, dst, 256);
3358 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3359
3360 /* dstlen can't be < 0 */
3361 SetLastError(0);
3362 ret = pFoldStringW(MAP_FOLDCZONE, src, -1, dst, -1);
3364 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3365
3366 /* Ret includes terminating NUL which is appended if srclen = -1 */
3367 SetLastError(0);
3368 src[0] = 'A';
3369 src[1] = '\0';
3370 dst[0] = '\0';
3371 ret = pFoldStringW(MAP_FOLDCZONE, src, -1, dst, 256);
3372 ok(ret == 2, "Expected ret == 2, got %d, error %d\n", ret, GetLastError());
3373 ok(dst[0] == 'A' && dst[1] == '\0',
3374 "srclen=-1: Expected ret=2 [%d,%d], got ret=%d [%d,%d], err=%d\n",
3375 'A', '\0', ret, dst[0], dst[1], GetLastError());
3376
3377 /* If size is given, result is not NUL terminated */
3378 SetLastError(0);
3379 src[0] = 'A';
3380 src[1] = 'A';
3381 dst[0] = 'X';
3382 dst[1] = 'X';
3383 ret = pFoldStringW(MAP_FOLDCZONE, src, 1, dst, 256);
3384 ok(ret == 1, "Expected ret == 1, got %d, error %d\n", ret, GetLastError());
3385 ok(dst[0] == 'A' && dst[1] == 'X',
3386 "srclen=1: Expected ret=1, [%d,%d], got ret=%d,[%d,%d], err=%d\n",
3387 'A','X', ret, dst[0], dst[1], GetLastError());
3388
3389 /* MAP_FOLDDIGITS */
3390 for (j = 0; j < sizeof(digitRanges)/sizeof(digitRanges[0]); j++)
3391 {
3392 /* Check everything before this range */
3393 for (ch = prev_ch; ch < digitRanges[j]; ch++)
3394 {
3395 SetLastError(0);
3396 src[0] = ch;
3397 src[1] = dst[0] = '\0';
3398 ret = pFoldStringW(MAP_FOLDDIGITS, src, -1, dst, 256);
3399 ok(ret == 2, "Expected ret == 2, got %d, error %d\n", ret, GetLastError());
3400
3401 ok(dst[0] == ch || strchrW(outOfSequenceDigits, ch) ||
3402 (ch >= 0xa8e0 && ch <= 0xa8e9), /* combining Devanagari on Win8 */
3403 "MAP_FOLDDIGITS: ch 0x%04x Expected unchanged got %04x\n", ch, dst[0]);
3404 ok(!isdigitW(ch) || strchrW(outOfSequenceDigits, ch) ||
3405 broken( ch >= 0xbf0 && ch <= 0xbf2 ), /* win2k */
3406 "char %04x should not be a digit\n", ch );
3407 }
3408
3409 if (digitRanges[j] == 0xffff)
3410 break; /* Finished the whole code point space */
3411
3412 for (ch = digitRanges[j]; ch < digitRanges[j] + 10; ch++)
3413 {
3414 WCHAR c;
3415
3416 /* Map out of sequence characters */
3417 if (ch == 0x2071) c = 0x00B9; /* Superscript 1 */
3418 else if (ch == 0x2072) c = 0x00B2; /* Superscript 2 */
3419 else if (ch == 0x2073) c = 0x00B3; /* Superscript 3 */
3420 else if (ch == 0x245F) c = 0x24EA; /* Circled 0 */
3421 else c = ch;
3422 SetLastError(0);
3423 src[0] = c;
3424 src[1] = dst[0] = '\0';
3425 ret = pFoldStringW(MAP_FOLDDIGITS, src, -1, dst, 256);
3426 ok(ret == 2, "Expected ret == 2, got %d, error %d\n", ret, GetLastError());
3427
3428 ok((dst[0] == '0' + ch - digitRanges[j] && dst[1] == '\0') ||
3429 broken( dst[0] == ch ) || /* old Windows versions don't have all mappings */
3430 (digitRanges[j] == 0x3020 && dst[0] == ch) || /* Hangzhou not present in all Windows versions */
3431 (digitRanges[j] == 0x0F29 && dst[0] == ch) || /* Tibetan not present in all Windows versions */
3432 strchrW(noDigitAvailable, c),
3433 "MAP_FOLDDIGITS: ch %04x Expected %04x got %04x\n",
3434 ch, '0' + digitRanges[j] - ch, dst[0]);
3435 }
3436 prev_ch = ch;
3437 }
3438
3439 /* MAP_FOLDCZONE */
3440 SetLastError(0);
3441 ret = pFoldStringW(MAP_FOLDCZONE, foldczone_src, -1, dst, 256);
3442 ok(ret == sizeof(foldczone_dst)/sizeof(foldczone_dst[0]),
3443 "Got %d, error %d\n", ret, GetLastError());
3444 ok(!memcmp(dst, foldczone_dst, sizeof(foldczone_dst)),
3445 "MAP_FOLDCZONE: Expanded incorrectly\n");
3446
3447 ret = pFoldStringW(MAP_FOLDCZONE|MAP_PRECOMPOSED, foldczone_todo_src, -1, dst, 256);
3448 todo_wine ok(ret == sizeof(foldczone_todo_dst)/sizeof(foldczone_todo_dst[0]),
3449 "Got %d, error %d\n", ret, GetLastError());
3450 todo_wine ok(!memcmp(dst, foldczone_todo_dst, sizeof(foldczone_todo_dst))
3451 || broken(!memcmp(dst, foldczone_todo_broken_dst, sizeof(foldczone_todo_broken_dst))),
3452 "MAP_FOLDCZONE: Expanded incorrectly (%s)\n", wine_dbgstr_w(dst));
3453
3454 /* MAP_EXPAND_LIGATURES */
3455 SetLastError(0);
3456 ret = pFoldStringW(MAP_EXPAND_LIGATURES, ligatures_src, -1, dst, 256);
3457 /* NT 4.0 doesn't support MAP_EXPAND_LIGATURES */
3458 if (!(ret == 0 && GetLastError() == ERROR_INVALID_FLAGS)) {
3459 ok(ret == sizeof(ligatures_dst)/sizeof(ligatures_dst[0]),
3460 "Got %d, error %d\n", ret, GetLastError());
3461 ok(!memcmp(dst, ligatures_dst, sizeof(ligatures_dst)),
3462 "MAP_EXPAND_LIGATURES: Expanded incorrectly\n");
3463 }
3464
3465 /* FIXME: MAP_PRECOMPOSED : MAP_COMPOSITE */
3466}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
#define isdigitW(n)
Definition: unicode.h:50
#define strchrW(s, c)
Definition: unicode.h:34

Referenced by START_TEST().

◆ test_geoid_enumproc()

static BOOL CALLBACK test_geoid_enumproc ( GEOID  geoid)
static

Definition at line 4727 of file locale.c.

4728{
4729 INT ret = pGetGeoInfoA(geoid, GEO_ISO2, NULL, 0, 0);
4730 ok(ret == 3, "got %d for %d\n", ret, geoid);
4731 /* valid geoid starts at 2 */
4732 ok(geoid >= 2, "got geoid %d\n", geoid);
4733
4734 return geoidenum_count++ < 5;
4735}
@ GEO_ISO2
Definition: winnls.h:565

Referenced by test_EnumSystemGeoID().

◆ test_geoid_enumproc2()

static BOOL CALLBACK test_geoid_enumproc2 ( GEOID  geoid)
static

Definition at line 4737 of file locale.c.

4738{
4740 return TRUE;
4741}

Referenced by test_EnumSystemGeoID().

◆ test_GetCPInfo()

static void test_GetCPInfo ( void  )
static

Definition at line 3903 of file locale.c.

3904{
3905 BOOL ret;
3906 CPINFO cpinfo;
3907
3908 SetLastError(0xdeadbeef);
3909 ret = GetCPInfo(CP_SYMBOL, &cpinfo);
3910 ok(!ret, "GetCPInfo(CP_SYMBOL) should fail\n");
3912 "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
3913
3914 SetLastError(0xdeadbeef);
3915 ret = GetCPInfo(CP_UTF7, &cpinfo);
3917 {
3918 win_skip("Codepage CP_UTF7 is not installed/available\n");
3919 }
3920 else
3921 {
3922 ok(ret, "GetCPInfo(CP_UTF7) error %u\n", GetLastError());
3923 ok(cpinfo.DefaultChar[0] == 0x3f, "expected 0x3f, got 0x%x\n", cpinfo.DefaultChar[0]);
3924 ok(cpinfo.DefaultChar[1] == 0, "expected 0, got 0x%x\n", cpinfo.DefaultChar[1]);
3925 ok(cpinfo.LeadByte[0] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[0]);
3926 ok(cpinfo.LeadByte[1] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[1]);
3927 ok(cpinfo.MaxCharSize == 5, "expected 5, got 0x%x\n", cpinfo.MaxCharSize);
3928 }
3929
3930 SetLastError(0xdeadbeef);
3931 ret = GetCPInfo(CP_UTF8, &cpinfo);
3933 {
3934 win_skip("Codepage CP_UTF8 is not installed/available\n");
3935 }
3936 else
3937 {
3938 ok(ret, "GetCPInfo(CP_UTF8) error %u\n", GetLastError());
3939 ok(cpinfo.DefaultChar[0] == 0x3f, "expected 0x3f, got 0x%x\n", cpinfo.DefaultChar[0]);
3940 ok(cpinfo.DefaultChar[1] == 0, "expected 0, got 0x%x\n", cpinfo.DefaultChar[1]);
3941 ok(cpinfo.LeadByte[0] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[0]);
3942 ok(cpinfo.LeadByte[1] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[1]);
3943 ok(cpinfo.MaxCharSize == 4 || broken(cpinfo.MaxCharSize == 3) /* win9x */,
3944 "expected 4, got %u\n", cpinfo.MaxCharSize);
3945 }
3946}
BOOL WINAPI GetCPInfo(UINT CodePage, LPCPINFO CodePageInfo)
Definition: nls.c:2039
#define CP_UTF8
Definition: nls.h:20
BYTE LeadByte[MAX_LEADBYTES]
Definition: winnls.h:583
BYTE DefaultChar[MAX_DEFAULTCHAR]
Definition: winnls.h:582
UINT MaxCharSize
Definition: winnls.h:581
#define CP_SYMBOL
Definition: winnls.h:234
#define CP_UTF7
Definition: winnls.h:235

Referenced by START_TEST().

◆ test_GetCurrencyFormatA()

static void test_GetCurrencyFormatA ( void  )
static

Definition at line 1162 of file locale.c.

1163{
1164 static char szDot[] = { '.', '\0' };
1165 static char szComma[] = { ',', '\0' };
1166 static char szDollar[] = { '$', '\0' };
1167 int ret;
1171
1172 memset(&format, 0, sizeof(format));
1173
1174 STRINGSA("23",""); /* NULL output, length > 0 --> Error */
1175 SetLastError(0xdeadbeef);
1178 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1179
1180 STRINGSA("23,53",""); /* Invalid character --> Error */
1181 SetLastError(0xdeadbeef);
1184 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1185
1186 STRINGSA("--",""); /* Double '-' --> Error */
1187 SetLastError(0xdeadbeef);
1190 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1191
1192 STRINGSA("0-",""); /* Trailing '-' --> Error */
1193 SetLastError(0xdeadbeef);
1196 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1197
1198 STRINGSA("0..",""); /* Double '.' --> Error */
1199 SetLastError(0xdeadbeef);
1202 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1203
1204 STRINGSA(" 0.1",""); /* Leading space --> Error */
1205 SetLastError(0xdeadbeef);
1208 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1209
1210 STRINGSA("1234","$"); /* Length too small --> Write up to length chars */
1211 SetLastError(0xdeadbeef);
1212 ret = GetCurrencyFormatA(lcid, NUO, input, NULL, buffer, 2);
1214 "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
1215
1216 STRINGSA("2353",""); /* Format and flags given --> Error */
1217 SetLastError(0xdeadbeef);
1219 ok( !ret, "Expected ret == 0, got %d\n", ret);
1221 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
1222
1223 STRINGSA("2353",""); /* Invalid format --> Error */
1224 SetLastError(0xdeadbeef);
1227 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1228
1229 STRINGSA("2353","$2,353.00"); /* Valid number */
1231 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1233
1234 STRINGSA("-2353","($2,353.00)"); /* Valid negative number */
1236 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1238
1239 STRINGSA("2353.1","$2,353.10"); /* Valid real number */
1241 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1243
1244 STRINGSA("2353.111","$2,353.11"); /* Too many DP --> Truncated */
1246 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1248
1249 STRINGSA("2353.119","$2,353.12"); /* Too many DP --> Rounded */
1251 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1253
1254 format.NumDigits = 0; /* No decimal separator */
1255 format.LeadingZero = 0;
1256 format.Grouping = 0; /* No grouping char */
1257 format.NegativeOrder = 0;
1258 format.PositiveOrder = CY_POS_LEFT;
1259 format.lpDecimalSep = szDot;
1260 format.lpThousandSep = szComma;
1261 format.lpCurrencySymbol = szDollar;
1262
1263 STRINGSA("2353","$2353"); /* No decimal or grouping chars expected */
1265 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1267
1268 format.NumDigits = 1; /* 1 DP --> Expect decimal separator */
1269 STRINGSA("2353","$2353.0");
1271 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1273
1274 format.Grouping = 2; /* Group by 100's */
1275 STRINGSA("2353","$23,53.0");
1277 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1279
1280 STRINGSA("235","$235.0"); /* Grouping of a positive number */
1281 format.Grouping = 3;
1283 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1285
1286 STRINGSA("-235","$-235.0"); /* Grouping of a negative number */
1287 format.NegativeOrder = 2;
1289 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1291
1292 format.LeadingZero = 1; /* Always provide leading zero */
1293 STRINGSA(".5","$0.5");
1295 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1297
1298 format.PositiveOrder = CY_POS_RIGHT;
1299 STRINGSA("1","1.0$");
1301 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1303
1304 format.PositiveOrder = CY_POS_LEFT_SPACE;
1305 STRINGSA("1","$ 1.0");
1307 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1309
1310 format.PositiveOrder = CY_POS_RIGHT_SPACE;
1311 STRINGSA("1","1.0 $");
1313 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1315
1316 format.NegativeOrder = 0;
1317 STRINGSA("-1","($1.0)");
1319 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1321
1322 format.NegativeOrder = 1;
1323 STRINGSA("-1","-$1.0");
1325 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1327
1328 format.NegativeOrder = 2;
1329 STRINGSA("-1","$-1.0");
1331 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1333
1334 format.NegativeOrder = 3;
1335 STRINGSA("-1","$1.0-");
1337 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1339
1340 format.NegativeOrder = 4;
1341 STRINGSA("-1","(1.0$)");
1343 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1345
1346 format.NegativeOrder = 5;
1347 STRINGSA("-1","-1.0$");
1349 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1351
1352 format.NegativeOrder = 6;
1353 STRINGSA("-1","1.0-$");
1355 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1357
1358 format.NegativeOrder = 7;
1359 STRINGSA("-1","1.0$-");
1361 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1363
1364 format.NegativeOrder = 8;
1365 STRINGSA("-1","-1.0 $");
1367 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1369
1370 format.NegativeOrder = 9;
1371 STRINGSA("-1","-$ 1.0");
1373 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1375
1376 format.NegativeOrder = 10;
1377 STRINGSA("-1","1.0 $-");
1379 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1381
1382 format.NegativeOrder = 11;
1383 STRINGSA("-1","$ 1.0-");
1385 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1387
1388 format.NegativeOrder = 12;
1389 STRINGSA("-1","$ -1.0");
1391 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1393
1394 format.NegativeOrder = 13;
1395 STRINGSA("-1","1.0- $");
1397 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1399
1400 format.NegativeOrder = 14;
1401 STRINGSA("-1","($ 1.0)");
1403 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1405
1406 format.NegativeOrder = 15;
1407 STRINGSA("-1","(1.0 $)");
1409 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1411}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
INT WINAPI GetCurrencyFormatA(LCID lcid, DWORD dwFlags, LPCSTR lpszValue, const CURRENCYFMTA *lpFormat, LPSTR lpCurrencyStr, int cchOut)
Definition: lcformat.c:1496
#define CY_POS_LEFT_SPACE
Definition: locale.c:1159
#define CY_POS_LEFT
Definition: locale.c:1157
#define EXPECT_EQA
Definition: locale.c:153
#define BUFFER_SIZE
Definition: locale.c:148
#define EXPECT_LENA
Definition: locale.c:152
#define STRINGSA(x, y)
Definition: locale.c:151
#define CY_POS_RIGHT
Definition: locale.c:1158
#define NUO
Definition: locale.c:162
#define CY_POS_RIGHT_SPACE
Definition: locale.c:1160

Referenced by START_TEST().

◆ test_GetDateFormatA()

static void test_GetDateFormatA ( void  )
static

Definition at line 819 of file locale.c.

820{
821 int ret;
822 SYSTEMTIME curtime;
826 char Broken[BUFFER_SIZE];
827 char short_day[10], month[10], genitive_month[10];
828
829 memset(&curtime, 2, sizeof(SYSTEMTIME)); /* Invalid time */
830 STRINGSA("ddd',' MMM dd yy","");
831 SetLastError(0xdeadbeef);
832 ret = GetDateFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
834 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
835
836 curtime.wYear = 2002;
837 curtime.wMonth = 5;
838 curtime.wDay = 4;
839 curtime.wDayOfWeek = 3;
840 STRINGSA("ddd',' MMM dd yy","Sat, May 04 02"); /* Simple case */
841 ret = GetDateFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
842 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
844
845 /* Same as above but with LOCALE_NOUSEROVERRIDE */
846 STRINGSA("ddd',' MMM dd yy",""); /* Simple case */
847 SetLastError(0xdeadbeef);
848 ret = GetDateFormatA(lcid, NUO, &curtime, input, buffer, COUNTOF(buffer));
850 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
852
853 STRINGSA("ddd',' MMM dd yy","Sat, May 04 02"); /* Format containing "'" */
854 ret = GetDateFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
855 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
857
858 curtime.wHour = 36; /* Invalid */
859 STRINGSA("ddd',' MMM dd ''''yy","Sat, May 04 '02"); /* Invalid time */
860 ret = GetDateFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
861 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
863
864 STRINGSA("ddd',' MMM dd ''''yy",""); /* Get size only */
865 ret = GetDateFormatA(lcid, 0, &curtime, input, NULL, 0);
866 ok(ret == 16, "Expected ret == 16, got %d, error %d\n", ret, GetLastError());
868
869 STRINGSA("ddd',' MMM dd ''''yy",""); /* Buffer too small */
870 SetLastError(0xdeadbeef);
871 ret = GetDateFormatA(lcid, 0, &curtime, input, buffer, 2);
873 "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
874
875 STRINGSA("ddd',' MMM dd ''''yy","5/4/2002"); /* Default to DATE_SHORTDATE */
876 ret = GetDateFormatA(lcid, NUO, &curtime, NULL, buffer, COUNTOF(buffer));
877 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
878 if (strncmp(buffer, Expected, strlen(Expected)) && strncmp(buffer, "5/4/02", strlen(Expected)) != 0)
879 ok (0, "Expected '%s' or '5/4/02', got '%s'\n", Expected, buffer);
880
881 SetLastError(0xdeadbeef); buffer[0] = '\0'; /* DATE_LONGDATE */
883 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
884 ok(strcmp(buffer, "Saturday, May 04, 2002") == 0 ||
885 strcmp(buffer, "Saturday, May 4, 2002") == 0 /* Win 8 */,
886 "got an unexpected date string '%s'\n", buffer);
887
888 /* test for expected DATE_YEARMONTH behavior with null format */
889 /* NT4 returns ERROR_INVALID_FLAGS for DATE_YEARMONTH */
890 STRINGSA("ddd',' MMM dd ''''yy", ""); /* DATE_YEARMONTH */
891 SetLastError(0xdeadbeef);
892 ret = GetDateFormatA(lcid, NUO|DATE_YEARMONTH, &curtime, input, buffer, COUNTOF(buffer));
894 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
896
897 /* Test that using invalid DATE_* flags results in the correct error */
898 /* and return values */
899 STRINGSA("m/d/y", ""); /* Invalid flags */
900 SetLastError(0xdeadbeef);
901 ret = GetDateFormatA(lcid, DATE_YEARMONTH|DATE_SHORTDATE|DATE_LONGDATE,
902 &curtime, input, buffer, COUNTOF(buffer));
904 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
905
906 ret = GetDateFormatA(lcid_ru, 0, &curtime, "ddMMMM", buffer, COUNTOF(buffer));
907 if (!ret)
908 {
909 win_skip("LANG_RUSSIAN locale data unavailable\n");
910 return;
911 }
912
913 /* month part should be in genitive form */
914 strcpy(genitive_month, buffer + 2);
915 ret = GetDateFormatA(lcid_ru, 0, &curtime, "MMMM", buffer, COUNTOF(buffer));
916 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
918 ok(strcmp(genitive_month, month) != 0, "Expected different month forms\n");
919
920 ret = GetDateFormatA(lcid_ru, 0, &curtime, "ddd", buffer, COUNTOF(buffer));
921 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
922 strcpy(short_day, buffer);
923
924 STRINGSA("dd MMMMddd dd", "");
925 sprintf(Expected, "04 %s%s 04", genitive_month, short_day);
926 ret = GetDateFormatA(lcid_ru, 0, &curtime, input, buffer, COUNTOF(buffer));
927 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
929
930 STRINGSA("MMMMddd dd", "");
931 sprintf(Expected, "%s%s 04", month, short_day);
932 ret = GetDateFormatA(lcid_ru, 0, &curtime, input, buffer, COUNTOF(buffer));
933 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
935
936 STRINGSA("MMMMddd", "");
937 sprintf(Expected, "%s%s", month, short_day);
938 ret = GetDateFormatA(lcid_ru, 0, &curtime, input, buffer, COUNTOF(buffer));
939 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
941
942 STRINGSA("MMMMdd", "");
943 sprintf(Expected, "%s04", genitive_month);
944 sprintf(Broken, "%s04", month);
945 ret = GetDateFormatA(lcid_ru, 0, &curtime, input, buffer, COUNTOF(buffer));
946 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
948 broken(strncmp(buffer, Broken, strlen(Broken)) == 0) /* nt4 */,
949 "Expected '%s', got '%s'\n", Expected, buffer);
950
951 STRINGSA("MMMMdd ddd", "");
952 sprintf(Expected, "%s04 %s", genitive_month, short_day);
953 sprintf(Broken, "%s04 %s", month, short_day);
954 ret = GetDateFormatA(lcid_ru, 0, &curtime, input, buffer, COUNTOF(buffer));
955 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
957 broken(strncmp(buffer, Broken, strlen(Broken)) == 0) /* nt4 */,
958 "Expected '%s', got '%s'\n", Expected, buffer);
959
960 STRINGSA("dd dddMMMM", "");
961 sprintf(Expected, "04 %s%s", short_day, month);
962 ret = GetDateFormatA(lcid_ru, 0, &curtime, input, buffer, COUNTOF(buffer));
963 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
965
966 STRINGSA("dd dddMMMM ddd MMMMdd", "");
967 sprintf(Expected, "04 %s%s %s %s04", short_day, month, short_day, genitive_month);
968 sprintf(Broken, "04 %s%s %s %s04", short_day, month, short_day, month);
969 ret = GetDateFormatA(lcid_ru, 0, &curtime, input, buffer, COUNTOF(buffer));
970 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
972 broken(strncmp(buffer, Broken, strlen(Broken)) == 0) /* nt4 */,
973 "Expected '%s', got '%s'\n", Expected, buffer);
974
975 /* with literal part */
976 STRINGSA("ddd',' MMMM dd", "");
977 sprintf(Expected, "%s, %s 04", short_day, genitive_month);
978 sprintf(Broken, "%s, %s 04", short_day, month);
979 ret = GetDateFormatA(lcid_ru, 0, &curtime, input, buffer, COUNTOF(buffer));
980 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
982 broken(strncmp(buffer, Broken, strlen(Broken)) == 0) /* nt4 */,
983 "Expected '%s', got '%s'\n", Expected, buffer);
984}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static const WCHAR month[12][4]
Definition: session.c:2150
INT WINAPI GetDateFormatA(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCSTR lpFormat, LPSTR lpDateStr, INT cchOut)
Definition: lcformat.c:936
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define LANG_RUSSIAN
Definition: nls.h:113
WORD wYear
Definition: winbase.h:905
WORD wMonth
Definition: winbase.h:906
WORD wHour
Definition: winbase.h:909
WORD wDay
Definition: winbase.h:908
WORD wDayOfWeek
Definition: winbase.h:907

Referenced by START_TEST().

◆ test_GetDateFormatEx()

static void test_GetDateFormatEx ( void  )
static

Definition at line 986 of file locale.c.

987{
988 int ret;
989 SYSTEMTIME curtime;
991
992 if (!pGetDateFormatEx)
993 {
994 win_skip("GetDateFormatEx not supported\n");
995 return;
996 }
997
998 STRINGSW("",""); /* If flags are set, then format must be NULL */
999 SetLastError(0xdeadbeef);
1000 ret = pGetDateFormatEx(localeW, DATE_LONGDATE, NULL,
1003 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
1004 EXPECT_EQW;
1005
1006 STRINGSW("",""); /* NULL buffer, len > 0 */
1007 SetLastError(0xdeadbeef);
1008 ret = pGetDateFormatEx(localeW, 0, NULL, input, NULL, COUNTOF(buffer), NULL);
1010 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1011
1012 STRINGSW("",""); /* NULL buffer, len == 0 */
1013 ret = pGetDateFormatEx(localeW, 0, NULL, input, NULL, 0, NULL);
1014 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1016
1017 STRINGSW("",""); /* Invalid flag combination */
1018 SetLastError(0xdeadbeef);
1019 ret = pGetDateFormatEx(localeW, DATE_LONGDATE|DATE_SHORTDATE, NULL,
1020 input, NULL, 0, NULL);
1022 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
1023 EXPECT_EQW;
1024
1025 curtime.wYear = 2002;
1026 curtime.wMonth = 10;
1027 curtime.wDay = 23;
1028 curtime.wDayOfWeek = 45612; /* Should be 3 - Wednesday */
1029 curtime.wHour = 65432; /* Invalid */
1030 curtime.wMinute = 34512; /* Invalid */
1031 curtime.wSecond = 65535; /* Invalid */
1032 curtime.wMilliseconds = 12345;
1033 STRINGSW("dddd d MMMM yyyy","Wednesday 23 October 2002"); /* Incorrect DOW and time */
1034 ret = pGetDateFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer), NULL);
1035 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1037
1038 curtime.wYear = 2002;
1039 curtime.wMonth = 10;
1040 curtime.wDay = 23;
1041 curtime.wDayOfWeek = 45612; /* Should be 3 - Wednesday */
1042 curtime.wHour = 65432; /* Invalid */
1043 curtime.wMinute = 34512; /* Invalid */
1044 curtime.wSecond = 65535; /* Invalid */
1045 curtime.wMilliseconds = 12345;
1046 STRINGSW("dddd d MMMM yyyy","Wednesday 23 October 2002");
1047 ret = pGetDateFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer), emptyW); /* Use reserved arg */
1049 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1050
1051 /* Limit tests */
1052
1053 curtime.wYear = 1601;
1054 curtime.wMonth = 1;
1055 curtime.wDay = 1;
1056 curtime.wDayOfWeek = 0; /* Irrelevant */
1057 curtime.wHour = 0;
1058 curtime.wMinute = 0;
1059 curtime.wSecond = 0;
1060 curtime.wMilliseconds = 0;
1061 STRINGSW("dddd d MMMM yyyy","Monday 1 January 1601");
1062 SetLastError(0xdeadbeef);
1063 ret = pGetDateFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer), NULL);
1064 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1066
1067 curtime.wYear = 1600;
1068 curtime.wMonth = 12;
1069 curtime.wDay = 31;
1070 curtime.wDayOfWeek = 0; /* Irrelevant */
1071 curtime.wHour = 23;
1072 curtime.wMinute = 59;
1073 curtime.wSecond = 59;
1074 curtime.wMilliseconds = 999;
1075 STRINGSW("dddd d MMMM yyyy","Friday 31 December 1600");
1076 SetLastError(0xdeadbeef);
1077 ret = pGetDateFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer), NULL);
1079 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1080}
static const WCHAR localeW[]
Definition: locale.c:43
#define STRINGSW(x, y)
Definition: locale.c:156
#define EXPECT_LENW
Definition: locale.c:159
static const WCHAR emptyW[]
Definition: locale.c:45
#define EXPECT_EQW
Definition: locale.c:160
WORD wMilliseconds
Definition: winbase.h:912
WORD wSecond
Definition: winbase.h:911
WORD wMinute
Definition: winbase.h:910

Referenced by START_TEST().

◆ test_GetDateFormatW()

static void test_GetDateFormatW ( void  )
static

Definition at line 1082 of file locale.c.

1083{
1084 int ret;
1085 SYSTEMTIME curtime;
1088
1089 STRINGSW("",""); /* If flags is not zero then format must be NULL */
1093 {
1094 win_skip("GetDateFormatW is not implemented\n");
1095 return;
1096 }
1098 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
1099 EXPECT_EQW;
1100
1101 STRINGSW("",""); /* NULL buffer, len > 0 */
1102 SetLastError(0xdeadbeef);
1103 ret = GetDateFormatW (lcid, 0, NULL, input, NULL, COUNTOF(buffer));
1105 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1106
1107 STRINGSW("",""); /* NULL buffer, len == 0 */
1108 ret = GetDateFormatW (lcid, 0, NULL, input, NULL, 0);
1109 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1111
1112 curtime.wYear = 2002;
1113 curtime.wMonth = 10;
1114 curtime.wDay = 23;
1115 curtime.wDayOfWeek = 45612; /* Should be 3 - Wednesday */
1116 curtime.wHour = 65432; /* Invalid */
1117 curtime.wMinute = 34512; /* Invalid */
1118 curtime.wSecond = 65535; /* Invalid */
1119 curtime.wMilliseconds = 12345;
1120 STRINGSW("dddd d MMMM yyyy","Wednesday 23 October 2002"); /* Incorrect DOW and time */
1121 ret = GetDateFormatW (lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
1122 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1124
1125 /* Limit tests */
1126
1127 curtime.wYear = 1601;
1128 curtime.wMonth = 1;
1129 curtime.wDay = 1;
1130 curtime.wDayOfWeek = 0; /* Irrelevant */
1131 curtime.wHour = 0;
1132 curtime.wMinute = 0;
1133 curtime.wSecond = 0;
1134 curtime.wMilliseconds = 0;
1135 STRINGSW("dddd d MMMM yyyy","Monday 1 January 1601");
1136 SetLastError(0xdeadbeef);
1137 ret = GetDateFormatW (lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
1138 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1140
1141 curtime.wYear = 1600;
1142 curtime.wMonth = 12;
1143 curtime.wDay = 31;
1144 curtime.wDayOfWeek = 0; /* Irrelevant */
1145 curtime.wHour = 23;
1146 curtime.wMinute = 59;
1147 curtime.wSecond = 59;
1148 curtime.wMilliseconds = 999;
1149 STRINGSW("dddd d MMMM yyyy","Friday 31 December 1600");
1150 SetLastError(0xdeadbeef);
1151 ret = GetDateFormatW (lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
1153 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1154}
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:993

Referenced by START_TEST().

◆ test_GetGeoInfo()

static void test_GetGeoInfo ( void  )
static

Definition at line 4646 of file locale.c.

4647{
4648 char buffA[20];
4649 INT ret;
4650
4651 if (!pGetGeoInfoA)
4652 {
4653 win_skip("GetGeoInfo is not available.\n");
4654 return;
4655 }
4656
4657 /* unassigned id */
4658 SetLastError(0xdeadbeef);
4659 ret = pGetGeoInfoA(344, GEO_ISO2, NULL, 0, 0);
4660 ok(ret == 0, "got %d\n", ret);
4662
4663 ret = pGetGeoInfoA(203, GEO_ISO2, NULL, 0, 0);
4664 ok(ret == 3, "got %d\n", ret);
4665
4666 ret = pGetGeoInfoA(203, GEO_ISO3, NULL, 0, 0);
4667 ok(ret == 4, "got %d\n", ret);
4668
4669 ret = pGetGeoInfoA(203, GEO_ISO2, buffA, 3, 0);
4670 ok(ret == 3, "got %d\n", ret);
4671 ok(!strcmp(buffA, "RU"), "got %s\n", buffA);
4672
4673 /* buffer pointer not NULL, length is 0 - return required length */
4674 buffA[0] = 'a';
4675 SetLastError(0xdeadbeef);
4676 ret = pGetGeoInfoA(203, GEO_ISO2, buffA, 0, 0);
4677 ok(ret == 3, "got %d\n", ret);
4678 ok(buffA[0] == 'a', "got %c\n", buffA[0]);
4679
4680 ret = pGetGeoInfoA(203, GEO_ISO3, buffA, 4, 0);
4681 ok(ret == 4, "got %d\n", ret);
4682 ok(!strcmp(buffA, "RUS"), "got %s\n", buffA);
4683
4684 /* shorter buffer */
4685 SetLastError(0xdeadbeef);
4686 buffA[1] = buffA[2] = 0;
4687 ret = pGetGeoInfoA(203, GEO_ISO2, buffA, 2, 0);
4688 ok(ret == 0, "got %d\n", ret);
4689 ok(!strcmp(buffA, "RU"), "got %s\n", buffA);
4691
4692 /* GEO_NATION returns GEOID in a string form */
4693 buffA[0] = 0;
4694 ret = pGetGeoInfoA(203, GEO_NATION, buffA, 20, 0);
4695 ok(ret == 4, "got %d\n", ret);
4696 ok(!strcmp(buffA, "203"), "got %s\n", buffA);
4697
4698 /* GEO_PARENT */
4699 buffA[0] = 0;
4700 ret = pGetGeoInfoA(203, GEO_PARENT, buffA, 20, 0);
4701 if (ret == 0)
4702 win_skip("GEO_PARENT not supported.\n");
4703 else
4704 {
4705 ok(ret == 6, "got %d\n", ret);
4706 ok(!strcmp(buffA, "47609"), "got %s\n", buffA);
4707 }
4708
4709 buffA[0] = 0;
4710 ret = pGetGeoInfoA(203, GEO_ISO_UN_NUMBER, buffA, 20, 0);
4711 if (ret == 0)
4712 win_skip("GEO_ISO_UN_NUMBER not supported.\n");
4713 else
4714 {
4715 ok(ret == 4, "got %d\n", ret);
4716 ok(!strcmp(buffA, "643"), "got %s\n", buffA);
4717 }
4718
4719 /* try invalid type value */
4720 SetLastError(0xdeadbeef);
4721 ret = pGetGeoInfoA(203, GEO_CURRENCYSYMBOL + 1, NULL, 0, 0);
4722 ok(ret == 0, "got %d\n", ret);
4723 ok(GetLastError() == ERROR_INVALID_FLAGS, "got %d\n", GetLastError());
4724}
@ GEO_ISO3
Definition: winnls.h:566
@ GEO_CURRENCYSYMBOL
Definition: winnls.h:577
@ GEO_ISO_UN_NUMBER
Definition: winnls.h:573
@ GEO_PARENT
Definition: winnls.h:574
@ GEO_NATION
Definition: winnls.h:562

Referenced by START_TEST().

◆ test_GetLocaleInfoA()

static void test_GetLocaleInfoA ( void  )
static

Definition at line 164 of file locale.c.

165{
166 int ret;
167 int len;
169 char buffer[BUFFER_SIZE];
170 char expected[BUFFER_SIZE];
171 DWORD val;
172
173 ok(lcid == 0x409, "wrong LCID calculated - %d\n", lcid);
174
175 ret = GetLocaleInfoA(lcid, LOCALE_ILANGUAGE|LOCALE_RETURN_NUMBER, (char*)&val, sizeof(val));
176 ok(ret, "got %d\n", ret);
177 ok(val == lcid, "got 0x%08x\n", val);
178
179 /* en and ar use SUBLANG_NEUTRAL, but GetLocaleInfo assume SUBLANG_DEFAULT
180 Same is true for zh on pre-Vista, but on Vista and higher GetLocaleInfo
181 assumes SUBLANG_NEUTRAL for zh */
184 SetLastError(0xdeadbeef);
187 ok((ret == len) && !lstrcmpA(buffer, expected),
188 "got %d with '%s' (expected %d with '%s')\n",
190
193 if (len) {
194 SetLastError(0xdeadbeef);
197 ok((ret == len) && !lstrcmpA(buffer, expected),
198 "got %d with '%s' (expected %d with '%s')\n",
200 }
201 else
202 win_skip("LANG_ARABIC not installed\n");
203
204 /* SUBLANG_DEFAULT is required for mlang.dll, but optional for GetLocaleInfo */
207 SetLastError(0xdeadbeef);
210 ok((ret == len) && !lstrcmpA(buffer, expected),
211 "got %d with '%s' (expected %d with '%s')\n",
213
214
215 /* HTMLKit and "Font xplorer lite" expect GetLocaleInfoA to
216 * partially fill the buffer even if it is too short. See bug 637.
217 */
218 SetLastError(0xdeadbeef);
221 ok(ret == 7 && !buffer[0], "Expected len=7, got %d\n", ret);
222
223 SetLastError(0xdeadbeef);
227 "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
228 ok(!strcmp(buffer, "Mon"), "Expected 'Mon', got '%s'\n", buffer);
229
230 SetLastError(0xdeadbeef);
233 ok(ret == 7, "Expected ret == 7, got %d, error %d\n", ret, GetLastError());
234 ok(!strcmp(buffer, "Monday"), "Expected 'Monday', got '%s'\n", buffer);
235}
GLuint GLfloat * val
Definition: glext.h:7180
GLenum GLsizei len
Definition: glext.h:6722
#define LANG_GERMAN
Definition: nls.h:62
#define LANG_ARABIC
Definition: nls.h:29
#define LOCALE_SDAYNAME1
Definition: winnls.h:77
#define LOCALE_ILANGUAGE
Definition: winnls.h:25
#define LOCALE_SLANGUAGE
Definition: winnls.h:26

Referenced by START_TEST().

◆ test_GetLocaleInfoEx()

static void test_GetLocaleInfoEx ( void  )
static

Definition at line 4439 of file locale.c.

4440{
4441 static const WCHAR enW[] = {'e','n',0};
4442 WCHAR bufferW[80], buffer2[80];
4443 INT ret;
4444
4445 if (!pGetLocaleInfoEx)
4446 {
4447 win_skip("GetLocaleInfoEx not supported\n");
4448 return;
4449 }
4450
4451 ret = pGetLocaleInfoEx(enW, LOCALE_SNAME, bufferW, sizeof(bufferW)/sizeof(WCHAR));
4452 ok(ret || broken(ret == 0) /* Vista */, "got %d\n", ret);
4453 if (ret)
4454 {
4455 static const WCHAR statesW[] = {'U','n','i','t','e','d',' ','S','t','a','t','e','s',0};
4456 static const WCHAR dummyW[] = {'d','u','m','m','y',0};
4457 static const WCHAR enusW[] = {'e','n','-','U','S',0};
4458 static const WCHAR usaW[] = {'U','S','A',0};
4459 static const WCHAR enuW[] = {'E','N','U',0};
4461 DWORD val;
4462
4463 ok(ret == lstrlenW(bufferW)+1, "got %d\n", ret);
4464 ok(!lstrcmpW(bufferW, enW), "got %s\n", wine_dbgstr_w(bufferW));
4465
4466 SetLastError(0xdeadbeef);
4467 ret = pGetLocaleInfoEx(enW, LOCALE_SNAME, bufferW, 2);
4468 ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %d, %d\n", ret, GetLastError());
4469
4470 SetLastError(0xdeadbeef);
4471 ret = pGetLocaleInfoEx(enW, LOCALE_SNAME, NULL, 0);
4472 ok(ret == 3 && GetLastError() == 0xdeadbeef, "got %d, %d\n", ret, GetLastError());
4473
4474 ret = pGetLocaleInfoEx(enusW, LOCALE_SNAME, bufferW, sizeof(bufferW)/sizeof(WCHAR));
4475 ok(ret == lstrlenW(bufferW)+1, "got %d\n", ret);
4476 ok(!lstrcmpW(bufferW, enusW), "got %s\n", wine_dbgstr_w(bufferW));
4477
4478 ret = pGetLocaleInfoEx(enW, LOCALE_SABBREVCTRYNAME, bufferW, sizeof(bufferW)/sizeof(WCHAR));
4479 ok(ret == lstrlenW(bufferW)+1, "got %d\n", ret);
4480 ok(!lstrcmpW(bufferW, usaW), "got %s\n", wine_dbgstr_w(bufferW));
4481
4482 ret = pGetLocaleInfoEx(enW, LOCALE_SABBREVLANGNAME, bufferW, sizeof(bufferW)/sizeof(WCHAR));
4483 ok(ret == lstrlenW(bufferW)+1, "got %d\n", ret);
4484 ok(!lstrcmpW(bufferW, enuW), "got %s\n", wine_dbgstr_w(bufferW));
4485
4486 ret = pGetLocaleInfoEx(enusW, LOCALE_SPARENT, bufferW, sizeof(bufferW)/sizeof(WCHAR));
4487 ok(ret == lstrlenW(bufferW)+1, "got %d\n", ret);
4488 ok(!lstrcmpW(bufferW, enW), "got %s\n", wine_dbgstr_w(bufferW));
4489
4490 ret = pGetLocaleInfoEx(enW, LOCALE_SPARENT, bufferW, sizeof(bufferW)/sizeof(WCHAR));
4491 ok(ret == 1, "got %d\n", ret);
4492 ok(!bufferW[0], "got %s\n", wine_dbgstr_w(bufferW));
4493
4494 ret = pGetLocaleInfoEx(enW, LOCALE_SCOUNTRY, bufferW, sizeof(bufferW)/sizeof(WCHAR));
4495 ok(ret == lstrlenW(bufferW)+1, "got %d\n", ret);
4498 {
4499 skip("Non-English locale\n");
4500 }
4501 else
4502 ok(!lstrcmpW(bufferW, statesW), "got %s\n", wine_dbgstr_w(bufferW));
4503
4504 bufferW[0] = 0;
4505 SetLastError(0xdeadbeef);
4506 ret = pGetLocaleInfoEx(dummyW, LOCALE_SNAME, bufferW, sizeof(bufferW)/sizeof(WCHAR));
4507 ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "got %d, error %d\n", ret, GetLastError());
4508
4509 while (*ptr->name)
4510 {
4511 val = 0;
4512 pGetLocaleInfoEx(ptr->name, LOCALE_ILANGUAGE|LOCALE_RETURN_NUMBER, (WCHAR*)&val, sizeof(val)/sizeof(WCHAR));
4513 todo_wine_if (ptr->todo)
4514 ok(val == ptr->lcid, "%s: got wrong lcid 0x%04x, expected 0x%04x\n", wine_dbgstr_w(ptr->name), val, ptr->lcid);
4515 bufferW[0] = 0;
4516 ret = pGetLocaleInfoEx(ptr->name, LOCALE_SNAME, bufferW, sizeof(bufferW)/sizeof(WCHAR));
4517 ok(ret == lstrlenW(bufferW)+1, "%s: got ret value %d\n", wine_dbgstr_w(ptr->name), ret);
4518 ok(!lstrcmpW(bufferW, ptr->name), "%s: got wrong LOCALE_SNAME %s\n", wine_dbgstr_w(ptr->name), wine_dbgstr_w(bufferW));
4519 ptr++;
4520 }
4521
4522 ret = pGetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, bufferW, sizeof(bufferW)/sizeof(WCHAR));
4523 ok(ret && ret == lstrlenW(bufferW)+1, "got ret value %d\n", ret);
4525 ok(ret && ret == lstrlenW(buffer2)+1, "got ret value %d\n", ret);
4526 ok(!lstrcmpW(bufferW, buffer2), "LOCALE_SNAMEs don't match %s %s\n", wine_dbgstr_w(bufferW), wine_dbgstr_w(buffer2));
4527 }
4528}
#define skip(...)
Definition: atltest.h:64
#define lstrlenW
Definition: compat.h:750
GLdouble GLdouble t
Definition: gl.h:2047
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1459
static PVOID ptr
Definition: dispmode.c:27
static const struct neutralsublang_name_t neutralsublang_names[]
Definition: locale.c:2683
static const WCHAR dummyW[]
Definition: directory.c:79
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define PRIMARYLANGID(l)
Definition: nls.h:16
Definition: match.c:28
#define LOCALE_SCOUNTRY
Definition: winnls.h:31
#define LOCALE_SNAME
Definition: winnls.h:130
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:28
#define LOCALE_SABBREVCTRYNAME
Definition: winnls.h:33
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by START_TEST().

◆ test_GetLocaleInfoW()

static void test_GetLocaleInfoW ( void  )
static

Definition at line 280 of file locale.c.

281{
285 WCHAR bufferW[80], buffer2W[80];
286 CHAR bufferA[80];
287 DWORD val;
288 DWORD ret;
289 INT i;
290
291 ret = GetLocaleInfoW(lcid_en, LOCALE_SMONTHNAME1, bufferW, COUNTOF(bufferW));
292 if (!ret) {
293 win_skip("GetLocaleInfoW() isn't implemented\n");
294 return;
295 }
296
297 ret = GetLocaleInfoW(lcid_en, LOCALE_ILANGUAGE|LOCALE_RETURN_NUMBER, (WCHAR*)&val, sizeof(val)/sizeof(WCHAR));
298 ok(ret, "got %d\n", ret);
299 ok(val == lcid_en, "got 0x%08x\n", val);
300
301 ret = GetLocaleInfoW(lcid_en_neut, LOCALE_SNAME, bufferW, COUNTOF(bufferW));
302 if (ret)
303 {
304 static const WCHAR slangW[] = {'E','n','g','l','i','s','h',' ','(','U','n','i','t','e','d',' ',
305 'S','t','a','t','e','s',')',0};
306 static const WCHAR statesW[] = {'U','n','i','t','e','d',' ','S','t','a','t','e','s',0};
307 static const WCHAR enW[] = {'e','n','-','U','S',0};
309
310 ok(!lstrcmpW(bufferW, enW), "got wrong name %s\n", wine_dbgstr_w(bufferW));
311
312 ret = GetLocaleInfoW(lcid_en_neut, LOCALE_SCOUNTRY, bufferW, COUNTOF(bufferW));
313 ok(ret, "got %d\n", ret);
316 {
317 skip("Non-English locale\n");
318 }
319 else
320 ok(!lstrcmpW(statesW, bufferW), "got wrong name %s\n", wine_dbgstr_w(bufferW));
321
322 ret = GetLocaleInfoW(lcid_en_neut, LOCALE_SLANGUAGE, bufferW, COUNTOF(bufferW));
323 ok(ret, "got %d\n", ret);
326 {
327 skip("Non-English locale\n");
328 }
329 else
330 ok(!lstrcmpW(slangW, bufferW), "got wrong name %s\n", wine_dbgstr_w(bufferW));
331
332 while (*ptr->name)
333 {
335 LCID lcid;
336
337 /* make neutral lcid */
340
341 val = 0;
342 GetLocaleInfoW(lcid, LOCALE_ILANGUAGE|LOCALE_RETURN_NUMBER, (WCHAR*)&val, sizeof(val)/sizeof(WCHAR));
343 todo_wine_if (ptr->todo & 0x1)
344 ok(val == ptr->lcid || (val && broken(val == ptr->lcid_broken)), "%s: got wrong lcid 0x%04x, expected 0x%04x\n",
346
347 /* now check LOCALE_SNAME */
348 GetLocaleInfoW(lcid, LOCALE_SNAME, bufferW, COUNTOF(bufferW));
349 todo_wine_if (ptr->todo & 0x2)
350 ok(!lstrcmpW(bufferW, ptr->sname) ||
351 (*ptr->sname_broken && broken(!lstrcmpW(bufferW, ptr->sname_broken))),
352 "%s: got %s\n", wine_dbgstr_w(ptr->name), wine_dbgstr_w(bufferW));
353 ptr++;
354 }
355 }
356 else
357 win_skip("English neutral locale not supported\n");
358
359 ret = GetLocaleInfoW(lcid_ru, LOCALE_SMONTHNAME1, bufferW, COUNTOF(bufferW));
360 if (!ret) {
361 win_skip("LANG_RUSSIAN locale data unavailable\n");
362 return;
363 }
365 bufferW, COUNTOF(bufferW));
366 if (!ret) {
367 win_skip("LOCALE_RETURN_GENITIVE_NAMES isn't supported\n");
368 return;
369 }
370
371 /* LOCALE_RETURN_GENITIVE_NAMES isn't supported for GetLocaleInfoA */
372 bufferA[0] = 'a';
373 SetLastError(0xdeadbeef);
375 bufferA, COUNTOF(bufferA));
376 ok(ret == 0, "LOCALE_RETURN_GENITIVE_NAMES should fail with GetLocaleInfoA\n");
377 ok(bufferA[0] == 'a', "Expected buffer to be untouched\n");
379 "Expected ERROR_INVALID_FLAGS, got %x\n", GetLastError());
380
381 bufferW[0] = 'a';
382 SetLastError(0xdeadbeef);
384 bufferW, COUNTOF(bufferW));
385 ok(ret == 0,
386 "LOCALE_RETURN_GENITIVE_NAMES itself doesn't return anything, got %d\n", ret);
387 ok(bufferW[0] == 'a', "Expected buffer to be untouched\n");
389 "Expected ERROR_INVALID_FLAGS, got %x\n", GetLastError());
390
391 /* yes, test empty 13 month entry too */
392 for (i = 0; i < 12; i++) {
393 bufferW[0] = 0;
395 bufferW, COUNTOF(bufferW));
396 ok(ret, "Expected non zero result\n");
397 ok(ret == lstrlenW(bufferW)+1, "Expected actual length, got %d, length %d\n",
398 ret, lstrlenW(bufferW));
399 buffer2W[0] = 0;
401 buffer2W, COUNTOF(buffer2W));
402 ok(ret, "Expected non zero result\n");
403 ok(ret == lstrlenW(buffer2W)+1, "Expected actual length, got %d, length %d\n",
404 ret, lstrlenW(buffer2W));
405
406 ok(lstrcmpW(bufferW, buffer2W) != 0,
407 "Expected genitive name to differ, got the same for month %d\n", i+1);
408
409 /* for locale without genitive names nominative returned in both cases */
410 bufferW[0] = 0;
412 bufferW, COUNTOF(bufferW));
413 ok(ret, "Expected non zero result\n");
414 ok(ret == lstrlenW(bufferW)+1, "Expected actual length, got %d, length %d\n",
415 ret, lstrlenW(bufferW));
416 buffer2W[0] = 0;
418 buffer2W, COUNTOF(buffer2W));
419 ok(ret, "Expected non zero result\n");
420 ok(ret == lstrlenW(buffer2W)+1, "Expected actual length, got %d, length %d\n",
421 ret, lstrlenW(buffer2W));
422
423 ok(lstrcmpW(bufferW, buffer2W) == 0,
424 "Expected same names, got different for month %d\n", i+1);
425 }
426}
USHORT LANGID
Definition: mui.h:9
if(dx< 0)
Definition: linetemp.h:194
BOOL todo
Definition: filedlg.c:313
static const struct neutralsublang_name2_t neutralsublang_names2[]
Definition: locale.c:246
LANGID langid
Definition: msctf.idl:644
WCHAR sname_broken[15]
Definition: locale.c:242
else
Definition: tritemp.h:161
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
#define LOCALE_SMONTHNAME1
Definition: winnls.h:91
#define LOCALE_RETURN_GENITIVE_NAMES
Definition: winnls.h:24
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

◆ test_GetNumberFormatA()

static void test_GetNumberFormatA ( void  )
static

Definition at line 1419 of file locale.c.

1420{
1421 static char szDot[] = { '.', '\0' };
1422 static char szComma[] = { ',', '\0' };
1423 int ret;
1427
1428 memset(&format, 0, sizeof(format));
1429
1430 STRINGSA("23",""); /* NULL output, length > 0 --> Error */
1431 SetLastError(0xdeadbeef);
1434 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1435
1436 STRINGSA("23,53",""); /* Invalid character --> Error */
1437 SetLastError(0xdeadbeef);
1440 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1441
1442 STRINGSA("--",""); /* Double '-' --> Error */
1443 SetLastError(0xdeadbeef);
1446 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1447
1448 STRINGSA("0-",""); /* Trailing '-' --> Error */
1449 SetLastError(0xdeadbeef);
1452 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1453
1454 STRINGSA("0..",""); /* Double '.' --> Error */
1455 SetLastError(0xdeadbeef);
1458 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1459
1460 STRINGSA(" 0.1",""); /* Leading space --> Error */
1461 SetLastError(0xdeadbeef);
1464 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1465
1466 STRINGSA("1234","1"); /* Length too small --> Write up to length chars */
1467 SetLastError(0xdeadbeef);
1468 ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, 2);
1470 "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
1471
1472 STRINGSA("2353",""); /* Format and flags given --> Error */
1473 SetLastError(0xdeadbeef);
1475 ok( !ret, "Expected ret == 0, got %d\n", ret);
1477 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
1478
1479 STRINGSA("2353",""); /* Invalid format --> Error */
1480 SetLastError(0xdeadbeef);
1483 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1484
1485 STRINGSA("2353","2,353.00"); /* Valid number */
1487 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1489
1490 STRINGSA("-2353","-2,353.00"); /* Valid negative number */
1492 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1494
1495 STRINGSA("-353","-353.00"); /* test for off by one error in grouping */
1497 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1499
1500 STRINGSA("2353.1","2,353.10"); /* Valid real number */
1502 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1504
1505 STRINGSA("2353.111","2,353.11"); /* Too many DP --> Truncated */
1507 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1509
1510 STRINGSA("2353.119","2,353.12"); /* Too many DP --> Rounded */
1512 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1514
1515 format.NumDigits = 0; /* No decimal separator */
1516 format.LeadingZero = 0;
1517 format.Grouping = 0; /* No grouping char */
1518 format.NegativeOrder = 0;
1519 format.lpDecimalSep = szDot;
1520 format.lpThousandSep = szComma;
1521
1522 STRINGSA("2353","2353"); /* No decimal or grouping chars expected */
1524 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1526
1527 format.NumDigits = 1; /* 1 DP --> Expect decimal separator */
1528 STRINGSA("2353","2353.0");
1530 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1532
1533 format.Grouping = 2; /* Group by 100's */
1534 STRINGSA("2353","23,53.0");
1536 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1538
1539 STRINGSA("235","235.0"); /* Grouping of a positive number */
1540 format.Grouping = 3;
1542 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1544
1545 STRINGSA("-235","-235.0"); /* Grouping of a negative number */
1546 format.NegativeOrder = NEG_LEFT;
1548 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1550
1551 format.LeadingZero = 1; /* Always provide leading zero */
1552 STRINGSA(".5","0.5");
1554 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1556
1557 format.NegativeOrder = NEG_PARENS;
1558 STRINGSA("-1","(1.0)");
1560 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1562
1563 format.NegativeOrder = NEG_LEFT;
1564 STRINGSA("-1","-1.0");
1566 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1568
1569 format.NegativeOrder = NEG_LEFT_SPACE;
1570 STRINGSA("-1","- 1.0");
1572 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1574
1575 format.NegativeOrder = NEG_RIGHT;
1576 STRINGSA("-1","1.0-");
1578 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1580
1581 format.NegativeOrder = NEG_RIGHT_SPACE;
1582 STRINGSA("-1","1.0 -");
1584 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1586
1588
1589 if (IsValidLocale(lcid, 0))
1590 {
1591 STRINGSA("-12345","-12 345,00"); /* Try French formatting */
1592 Expected[3] = 160; /* Non breaking space */
1594 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1596 }
1597}
INT WINAPI GetNumberFormatA(LCID lcid, DWORD dwFlags, LPCSTR lpszValue, const NUMBERFMTA *lpFormat, LPSTR lpNumberStr, int cchOut)
Definition: lcformat.c:1130
#define NEG_LEFT_SPACE
Definition: locale.c:1415
#define NEG_PARENS
Definition: locale.c:1413
#define NEG_RIGHT
Definition: locale.c:1416
#define NEG_LEFT
Definition: locale.c:1414
#define NEG_RIGHT_SPACE
Definition: locale.c:1417

Referenced by START_TEST().

◆ test_GetNumberFormatEx()

static void test_GetNumberFormatEx ( void  )
static

Definition at line 1599 of file locale.c.

1600{
1601 int ret;
1603 static WCHAR dotW[] = {'.',0};
1604 static WCHAR commaW[] = {',',0};
1605 static const WCHAR enW[] = {'e','n','-','U','S',0};
1606 static const WCHAR frW[] = {'f','r','-','F','R',0};
1607 static const WCHAR bogusW[] = {'b','o','g','u','s',0};
1609
1610 if (!pGetNumberFormatEx)
1611 {
1612 win_skip("GetNumberFormatEx is not available.\n");
1613 return;
1614 }
1615
1616 STRINGSW("23",""); /* NULL output, length > 0 --> Error */
1617 ret = pGetNumberFormatEx(enW, 0, input, NULL, NULL, COUNTOF(buffer));
1619 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1620
1621 STRINGSW("23,53",""); /* Invalid character --> Error */
1622 ret = pGetNumberFormatEx(enW, 0, input, NULL, buffer, COUNTOF(buffer));
1624 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1625
1626 STRINGSW("--",""); /* Double '-' --> Error */
1627 ret = pGetNumberFormatEx(enW, 0, input, NULL, buffer, COUNTOF(buffer));
1629 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1630
1631 STRINGSW("0-",""); /* Trailing '-' --> Error */
1632 ret = pGetNumberFormatEx(enW, 0, input, NULL, buffer, COUNTOF(buffer));
1634 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1635
1636 STRINGSW("0..",""); /* Double '.' --> Error */
1637 ret = pGetNumberFormatEx(enW, 0, input, NULL, buffer, COUNTOF(buffer));
1639 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1640
1641 STRINGSW(" 0.1",""); /* Leading space --> Error */
1642 ret = pGetNumberFormatEx(enW, 0, input, NULL, buffer, COUNTOF(buffer));
1644 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1645
1646 STRINGSW("1234","1"); /* Length too small --> Write up to length chars */
1647 ret = pGetNumberFormatEx(enW, NUO, input, NULL, buffer, 2);
1649 "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
1650
1651 STRINGSW("23",""); /* Bogus locale --> Error */
1652 ret = pGetNumberFormatEx(bogusW, NUO, input, NULL, buffer, COUNTOF(buffer));
1654 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1655
1656 memset(&format, 0, sizeof(format));
1657
1658 STRINGSW("2353",""); /* Format and flags given --> Error */
1659 ret = pGetNumberFormatEx(enW, NUO, input, &format, buffer, COUNTOF(buffer));
1660 ok( !ret, "Expected ret == 0, got %d\n", ret);
1662 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
1663
1664 STRINGSW("2353",""); /* Invalid format --> Error */
1665 ret = pGetNumberFormatEx(enW, 0, input, &format, buffer, COUNTOF(buffer));
1667 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1668
1669 STRINGSW("2353","2,353.00"); /* Valid number */
1670 ret = pGetNumberFormatEx(enW, NUO, input, NULL, buffer, COUNTOF(buffer));
1671 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1673
1674 STRINGSW("-2353","-2,353.00"); /* Valid negative number */
1675 ret = pGetNumberFormatEx(enW, NUO, input, NULL, buffer, COUNTOF(buffer));
1676 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1678
1679 STRINGSW("-353","-353.00"); /* test for off by one error in grouping */
1680 ret = pGetNumberFormatEx(enW, NUO, input, NULL, buffer, COUNTOF(buffer));
1681 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1683
1684 STRINGSW("2353.1","2,353.10"); /* Valid real number */
1685 ret = pGetNumberFormatEx(enW, NUO, input, NULL, buffer, COUNTOF(buffer));
1686 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1688
1689 STRINGSW("2353.111","2,353.11"); /* Too many DP --> Truncated */
1690 ret = pGetNumberFormatEx(enW, NUO, input, NULL, buffer, COUNTOF(buffer));
1691 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1693
1694 STRINGSW("2353.119","2,353.12"); /* Too many DP --> Rounded */
1695 ret = pGetNumberFormatEx(enW, NUO, input, NULL, buffer, COUNTOF(buffer));
1696 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1698
1699 format.NumDigits = 0; /* No decimal separator */
1700 format.LeadingZero = 0;
1701 format.Grouping = 0; /* No grouping char */
1702 format.NegativeOrder = 0;
1703 format.lpDecimalSep = dotW;
1704 format.lpThousandSep = commaW;
1705
1706 STRINGSW("2353","2353"); /* No decimal or grouping chars expected */
1707 ret = pGetNumberFormatEx(enW, 0, input, &format, buffer, COUNTOF(buffer));
1708 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1710
1711 format.NumDigits = 1; /* 1 DP --> Expect decimal separator */
1712 STRINGSW("2353","2353.0");
1713 ret = pGetNumberFormatEx(enW, 0, input, &format, buffer, COUNTOF(buffer));
1714 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1716
1717 format.Grouping = 2; /* Group by 100's */
1718 STRINGSW("2353","23,53.0");
1719 ret = pGetNumberFormatEx(enW, 0, input, &format, buffer, COUNTOF(buffer));
1720 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1722
1723 STRINGSW("235","235.0"); /* Grouping of a positive number */
1724 format.Grouping = 3;
1725 ret = pGetNumberFormatEx(enW, 0, input, &format, buffer, COUNTOF(buffer));
1726 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1728
1729 STRINGSW("-235","-235.0"); /* Grouping of a negative number */
1730 format.NegativeOrder = NEG_LEFT;
1731 ret = pGetNumberFormatEx(enW, 0, input, &format, buffer, COUNTOF(buffer));
1732 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1734
1735 format.LeadingZero = 1; /* Always provide leading zero */
1736 STRINGSW(".5","0.5");
1737 ret = pGetNumberFormatEx(enW, 0, input, &format, buffer, COUNTOF(buffer));
1738 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1740
1741 format.NegativeOrder = NEG_PARENS;
1742 STRINGSW("-1","(1.0)");
1743 ret = pGetNumberFormatEx(enW, 0, input, &format, buffer, COUNTOF(buffer));
1744 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1746
1747 format.NegativeOrder = NEG_LEFT;
1748 STRINGSW("-1","-1.0");
1749 ret = pGetNumberFormatEx(enW, 0, input, &format, buffer, COUNTOF(buffer));
1750 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1752
1753 format.NegativeOrder = NEG_LEFT_SPACE;
1754 STRINGSW("-1","- 1.0");
1755 ret = pGetNumberFormatEx(enW, 0, input, &format, buffer, COUNTOF(buffer));
1756 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1758
1759 format.NegativeOrder = NEG_RIGHT;
1760 STRINGSW("-1","1.0-");
1761 ret = pGetNumberFormatEx(enW, 0, input, &format, buffer, COUNTOF(buffer));
1762 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1764
1765 format.NegativeOrder = NEG_RIGHT_SPACE;
1766 STRINGSW("-1","1.0 -");
1767 ret = pGetNumberFormatEx(enW, 0, input, &format, buffer, COUNTOF(buffer));
1768 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1770
1771 if (pIsValidLocaleName(frW))
1772 {
1773 STRINGSW("-12345","-12 345,00"); /* Try French formatting */
1774 Expected[3] = 160; /* Non breaking space */
1775 ret = pGetNumberFormatEx(frW, NUO, input, NULL, buffer, COUNTOF(buffer));
1776 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
1778 }
1779}
static const WCHAR dotW[]
Definition: directory.c:80

Referenced by START_TEST().

◆ test_GetStringTypeW()

static void test_GetStringTypeW ( void  )
static

Definition at line 3955 of file locale.c.

3956{
3957 static const WCHAR blanks[] = {0x9, 0x20, 0xa0, 0x3000, 0xfeff};
3958 static const WORD blanks_new[] = {C1_SPACE | C1_CNTRL | C1_BLANK | C1_DEFINED,
3963 static const WORD blanks_old[] ={C1_SPACE | C1_CNTRL | C1_BLANK,
3967 C1_SPACE | C1_BLANK};
3968
3969 static const WCHAR undefined[] = {0x378, 0x379, 0x5ff, 0xfff8, 0xfffe};
3970
3971 /* Lu, Ll, Lt */
3972 static const WCHAR alpha[] = {0x47, 0x67, 0x1c5};
3973 static const WORD alpha_old[] = {C1_UPPER | C1_ALPHA,
3976 C1_ALPHA};
3977
3978 /* Sk, Sk, Mn, So, Me */
3979 static const WCHAR oldpunc[] = { 0x2c2, 0x2e5, 0x322, 0x482, 0x6de,
3980 /* Sc, Sm, No,*/
3981 0xffe0, 0xffe9, 0x2153};
3982
3983 /* Lm, Nl, Cf, 0xad(Cf), 0x1f88 (Lt), Lo, Mc */
3984 static const WCHAR changed[] = {0x2b0, 0x2160, 0x600, 0xad, 0x1f88, 0x294, 0x903};
3985 static const WORD changed_old[] = { C1_PUNCT, C1_PUNCT, 0, C1_PUNCT, C1_UPPER | C1_ALPHA, C1_ALPHA, C1_PUNCT };
3986 static const WORD changed_xp[] = {C1_ALPHA | C1_DEFINED,
3992 C1_ALPHA | C1_DEFINED };
3993 static const WORD changed_new[] = { C1_ALPHA | C1_DEFINED,
4000 };
4001 /* Pc, Pd, Ps, Pe, Pi, Pf, Po*/
4002 static const WCHAR punct[] = { 0x5f, 0x2d, 0x28, 0x29, 0xab, 0xbb, 0x21 };
4003
4004 static const WCHAR punct_special[] = {0x24, 0x2b, 0x3c, 0x3e, 0x5e, 0x60,
4005 0x7c, 0x7e, 0xa2, 0xbe, 0xd7, 0xf7};
4006 static const WCHAR digit_special[] = {0xb2, 0xb3, 0xb9};
4007 static const WCHAR lower_special[] = {0x2071, 0x207f};
4008 static const WCHAR cntrl_special[] = {0x070f, 0x200c, 0x200d,
4009 0x200e, 0x200f, 0x202a, 0x202b, 0x202c, 0x202d, 0x202e,
4010 0x206a, 0x206b, 0x206c, 0x206d, 0x206e, 0x206f, 0xfeff,
4011 0xfff9, 0xfffa, 0xfffb};
4012 static const WCHAR space_special[] = {0x09, 0x0d, 0x85};
4013
4014 WORD types[20];
4015 WCHAR ch[2];
4016 BOOL ret;
4017 int i;
4018
4019 /* NULL src */
4020 SetLastError(0xdeadbeef);
4022 ok(!ret, "got %d\n", ret);
4023 ok(GetLastError() == ERROR_INVALID_PARAMETER, "got error %d\n", GetLastError());
4024
4025 SetLastError(0xdeadbeef);
4027 ok(!ret, "got %d\n", ret);
4028 ok(GetLastError() == ERROR_INVALID_PARAMETER, "got error %d\n", GetLastError());
4029
4030 SetLastError(0xdeadbeef);
4032 ok(!ret, "got %d\n", ret);
4033 ok(GetLastError() == ERROR_INVALID_PARAMETER, "got error %d\n", GetLastError());
4034
4035 memset(types,0,sizeof(types));
4036 GetStringTypeW(CT_CTYPE1, blanks, 5, types);
4037 for (i = 0; i < 5; i++)
4038 ok(types[i] == blanks_new[i] || broken(types[i] == blanks_old[i] || broken(types[i] == 0)), "incorrect type1 returned for %x -> (%x != %x)\n",blanks[i],types[i],blanks_new[i]);
4039
4040 memset(types,0,sizeof(types));
4042 for (i = 0; i < 3; i++)
4043 ok(types[i] == (C1_DEFINED | alpha_old[i]) || broken(types[i] == alpha_old[i]) || broken(types[i] == 0), "incorrect types returned for %x -> (%x != %x)\n",alpha[i], types[i],(C1_DEFINED | alpha_old[i]));
4044 memset(types,0,sizeof(types));
4046 for (i = 0; i < 5; i++)
4047 ok(types[i] == 0, "incorrect types returned for %x -> (%x != 0)\n",undefined[i], types[i]);
4048
4049 memset(types,0,sizeof(types));
4050 GetStringTypeW(CT_CTYPE1, oldpunc, 8, types);
4051 for (i = 0; i < 8; i++)
4052 ok(types[i] == C1_DEFINED || broken(types[i] == C1_PUNCT) || broken(types[i] == 0), "incorrect types returned for %x -> (%x != %x)\n",oldpunc[i], types[i], C1_DEFINED);
4053
4054 memset(types,0,sizeof(types));
4055 GetStringTypeW(CT_CTYPE1, changed, 7, types);
4056 for (i = 0; i < 7; i++)
4057 ok(types[i] == changed_new[i] || broken(types[i] == changed_old[i]) || broken(types[i] == changed_xp[i]) || broken(types[i] == 0), "incorrect types returned for %x -> (%x != %x)\n",changed[i], types[i], changed_new[i]);
4058
4059 memset(types,0,sizeof(types));
4060 GetStringTypeW(CT_CTYPE1, punct, 7, types);
4061 for (i = 0; i < 7; i++)
4062 ok(types[i] == (C1_PUNCT | C1_DEFINED) || broken(types[i] == C1_PUNCT) || broken(types[i] == 0), "incorrect types returned for %x -> (%x != %x)\n",punct[i], types[i], (C1_PUNCT | C1_DEFINED));
4063
4064
4065 memset(types,0,sizeof(types));
4066 GetStringTypeW(CT_CTYPE1, punct_special, 12, types);
4067 for (i = 0; i < 12; i++)
4068 ok(types[i] & C1_PUNCT || broken(types[i] == 0), "incorrect types returned for %x -> (%x doest not have %x)\n",punct_special[i], types[i], C1_PUNCT);
4069
4070 memset(types,0,sizeof(types));
4071 GetStringTypeW(CT_CTYPE1, digit_special, 3, types);
4072 for (i = 0; i < 3; i++)
4073 ok(types[i] & C1_DIGIT || broken(types[i] == 0), "incorrect types returned for %x -> (%x doest not have = %x)\n",digit_special[i], types[i], C1_DIGIT);
4074
4075 memset(types,0,sizeof(types));
4076 GetStringTypeW(CT_CTYPE1, lower_special, 2, types);
4077 for (i = 0; i < 2; i++)
4078 ok(types[i] & C1_LOWER || broken(types[i] == C1_PUNCT) || broken(types[i] == 0), "incorrect types returned for %x -> (%x does not have %x)\n",lower_special[i], types[i], C1_LOWER);
4079
4080 memset(types,0,sizeof(types));
4081 GetStringTypeW(CT_CTYPE1, cntrl_special, 20, types);
4082 for (i = 0; i < 20; i++)
4083 ok(types[i] & C1_CNTRL || broken(types[i] == (C1_BLANK|C1_SPACE)) || broken(types[i] == C1_PUNCT) || broken(types[i] == 0), "incorrect types returned for %x -> (%x does not have %x)\n",cntrl_special[i], types[i], C1_CNTRL);
4084
4085 memset(types,0,sizeof(types));
4086 GetStringTypeW(CT_CTYPE1, space_special, 3, types);
4087 for (i = 0; i < 3; i++)
4088 ok(types[i] & C1_SPACE || broken(types[i] == C1_CNTRL) || broken(types[i] == 0), "incorrect types returned for %x -> (%x does not have %x)\n",space_special[i], types[i], C1_SPACE );
4089
4090 /* surrogate pairs */
4091 ch[0] = 0xd800;
4092 memset(types, 0, sizeof(types));
4094 if (types[0] == C3_NOTAPPLICABLE)
4095 win_skip("C3_HIGHSURROGATE/C3_LOWSURROGATE are not supported.\n");
4096 else {
4097 ok(types[0] == C3_HIGHSURROGATE, "got %x\n", types[0]);
4098
4099 ch[0] = 0xdc00;
4100 memset(types, 0, sizeof(types));
4102 ok(types[0] == C3_LOWSURROGATE, "got %x\n", types[0]);
4103 }
4104
4105 /* Zl, Zp categories */
4106 ch[0] = 0x2028;
4107 ch[1] = 0x2029;
4108 memset(types, 0, sizeof(types));
4110 ok(types[0] == (C1_DEFINED|C1_SPACE), "got %x\n", types[0]);
4111 ok(types[1] == (C1_DEFINED|C1_SPACE), "got %x\n", types[1]);
4112
4113 /* check Arabic range for kashida flag */
4114 for (ch[0] = 0x600; ch[0] <= 0x6ff; ch[0] += 1)
4115 {
4116 types[0] = 0;
4117 ret = GetStringTypeW(CT_CTYPE3, ch, 1, types);
4118 ok(ret, "%#x: failed %d\n", ch[0], ret);
4119 if (ch[0] == 0x640) /* ARABIC TATWEEL (Kashida) */
4120 ok(types[0] & C3_KASHIDA, "%#x: type %#x\n", ch[0], types[0]);
4121 else
4122 ok(!(types[0] & C3_KASHIDA), "%#x: type %#x\n", ch[0], types[0]);
4123 }
4124}
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
#define C1_CNTRL
Definition: unicode.h:36
#define C1_PUNCT
Definition: unicode.h:35
#define C1_SPACE
Definition: unicode.h:34
#define C1_ALPHA
Definition: unicode.h:39
#define C1_BLANK
Definition: unicode.h:37
#define C1_LOWER
Definition: unicode.h:32
#define C1_UPPER
Definition: unicode.h:31
Definition: cmds.c:130
@ undefined
Definition: whoami.c:26
#define C3_NOTAPPLICABLE
Definition: winnls.h:274
#define CT_CTYPE3
Definition: winnls.h:239
#define C3_LOWSURROGATE
Definition: winnls.h:276
#define C1_DEFINED
Definition: winnls.h:249
#define C3_KASHIDA
Definition: winnls.h:271
#define C3_HIGHSURROGATE
Definition: winnls.h:275

Referenced by START_TEST().

◆ test_GetSystemPreferredUILanguages()

static void test_GetSystemPreferredUILanguages ( void  )
static

Definition at line 4979 of file locale.c.

4980{
4981 BOOL ret;
4982 ULONG count, size, size_id, size_name, size_buffer;
4983 WCHAR *buffer;
4984
4985
4986 if (!pGetSystemPreferredUILanguages)
4987 {
4988 win_skip("GetSystemPreferredUILanguages is not available.\n");
4989 return;
4990 }
4991
4992 /* (in)valid first parameter */
4993 count = 0xdeadbeef;
4994 size = 0;
4995 SetLastError(0xdeadbeef);
4996 ret = pGetSystemPreferredUILanguages(0, &count, NULL, &size);
4997 ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
4998 ok(count, "Expected count > 0\n");
4999 ok(size % 6 == 1, "Expected size (%d) %% 6 == 1\n", size);
5000
5001 count = 0xdeadbeef;
5002 size = 0;
5003 SetLastError(0xdeadbeef);
5004 ret = pGetSystemPreferredUILanguages(MUI_FULL_LANGUAGE, &count, NULL, &size);
5005 ok(!ret, "Expected GetSystemPreferredUILanguages to fail\n");
5007 "Expected error ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
5008
5009 count = 0xdeadbeef;
5010 size = 0;
5011 SetLastError(0xdeadbeef);
5012 ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID | MUI_FULL_LANGUAGE, &count, NULL, &size);
5013 ok(!ret, "Expected GetSystemPreferredUILanguages to fail\n");
5015 "Expected error ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
5016
5017 count = 0xdeadbeef;
5018 size = 0;
5019 SetLastError(0xdeadbeef);
5020 ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID | MUI_LANGUAGE_NAME, &count, NULL, &size);
5021 ok(!ret, "Expected GetSystemPreferredUILanguages to fail\n");
5023 "Expected error ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
5024
5025 count = 0xdeadbeef;
5026 size = 0;
5027 SetLastError(0xdeadbeef);
5028 ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID | MUI_MACHINE_LANGUAGE_SETTINGS, &count, NULL, &size);
5029 ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
5030 ok(count, "Expected count > 0\n");
5031 ok(size % 5 == 1, "Expected size (%d) %% 5 == 1\n", size);
5032
5033 count = 0xdeadbeef;
5034 size = 0;
5035 SetLastError(0xdeadbeef);
5036 ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_NAME | MUI_MACHINE_LANGUAGE_SETTINGS, &count, NULL, &size);
5037 ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
5038 ok(count, "Expected count > 0\n");
5039 ok(size % 6 == 1, "Expected size (%d) %% 6 == 1\n", size);
5040
5041 /* second parameter
5042 * ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, NULL, NULL, &size);
5043 * -> unhandled exception c0000005
5044 */
5045
5046 /* invalid third parameter */
5047 count = 0xdeadbeef;
5048 size = 1;
5049 SetLastError(0xdeadbeef);
5050 ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, &count, NULL, &size);
5051 ok(!ret, "Expected GetSystemPreferredUILanguages to fail\n");
5053 "Expected error ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
5054
5055 /* fourth parameter
5056 * ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, &count, NULL, NULL);
5057 * -> unhandled exception c0000005
5058 */
5059
5060 count = 0xdeadbeef;
5061 size_id = 0;
5062 SetLastError(0xdeadbeef);
5063 ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, &count, NULL, &size_id);
5064 ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
5065 ok(count, "Expected count > 0\n");
5066 ok(size_id % 5 == 1, "Expected size (%d) %% 5 == 1\n", size_id);
5067
5068 count = 0xdeadbeef;
5069 size_name = 0;
5070 SetLastError(0xdeadbeef);
5071 ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_NAME, &count, NULL, &size_name);
5072 ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
5073 ok(count, "Expected count > 0\n");
5074 ok(size_name % 6 == 1, "Expected size (%d) %% 6 == 1\n", size_name);
5075
5076 size_buffer = max(size_id, size_name);
5077 if(!size_buffer)
5078 {
5079 skip("No valid buffer size\n");
5080 return;
5081 }
5082
5083 buffer = HeapAlloc(GetProcessHeap(), 0, size_buffer * sizeof(WCHAR));
5084 if (!buffer)
5085 {
5086 skip("Failed to allocate memory for %d chars\n", size_buffer);
5087 return;
5088 }
5089
5090 count = 0xdeadbeef;
5091 size = size_buffer;
5092 memset(buffer, 0x5a, size_buffer * sizeof(WCHAR));
5093 SetLastError(0xdeadbeef);
5094 ret = pGetSystemPreferredUILanguages(0, &count, buffer, &size);
5095 ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
5096 ok(count, "Expected count > 0\n");
5097 ok(size % 6 == 1, "Expected size (%d) %% 6 == 1\n", size);
5098 if (ret && size % 6 == 1)
5099 ok(!buffer[size -2] && !buffer[size -1],
5100 "Expected last two WCHARs being empty, got 0x%x 0x%x\n",
5101 buffer[size -2], buffer[size -1]);
5102
5103 count = 0xdeadbeef;
5104 size = size_buffer;
5105 memset(buffer, 0x5a, size_buffer * sizeof(WCHAR));
5106 SetLastError(0xdeadbeef);
5107 ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, &count, buffer, &size);
5108 ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
5109 ok(count, "Expected count > 0\n");
5110 ok(size % 5 == 1, "Expected size (%d) %% 5 == 1\n", size);
5111 if (ret && size % 5 == 1)
5112 ok(!buffer[size -2] && !buffer[size -1],
5113 "Expected last two WCHARs being empty, got 0x%x 0x%x\n",
5114 buffer[size -2], buffer[size -1]);
5115
5116 count = 0xdeadbeef;
5117 size = size_buffer;
5118 SetLastError(0xdeadbeef);
5119 ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_NAME, &count, buffer, &size);
5120 ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
5121 ok(count, "Expected count > 0\n");
5122 ok(size % 6 == 1, "Expected size (%d) %% 6 == 1\n", size);
5123 if (ret && size % 5 == 1)
5124 ok(!buffer[size -2] && !buffer[size -1],
5125 "Expected last two WCHARs being empty, got 0x%x 0x%x\n",
5126 buffer[size -2], buffer[size -1]);
5127
5128 count = 0xdeadbeef;
5129 size = 0;
5130 SetLastError(0xdeadbeef);
5131 ret = pGetSystemPreferredUILanguages(MUI_MACHINE_LANGUAGE_SETTINGS, &count, NULL, &size);
5132 ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
5133 ok(count, "Expected count > 0\n");
5134 ok(size % 6 == 1, "Expected size (%d) %% 6 == 1\n", size);
5135 if (ret && size % 6 == 1)
5136 ok(!buffer[size -2] && !buffer[size -1],
5137 "Expected last two WCHARs being empty, got 0x%x 0x%x\n",
5138 buffer[size -2], buffer[size -1]);
5139
5140 count = 0xdeadbeef;
5141 size = 1;
5142 SetLastError(0xdeadbeef);
5143 ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, &count, buffer, &size);
5144 ok(!ret, "Expected GetSystemPreferredUILanguages to fail\n");
5146 "Expected error ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
5147
5148 count = 0xdeadbeef;
5149 size = size_id -1;
5150 memset(buffer, 0x5a, size_buffer * sizeof(WCHAR));
5151 SetLastError(0xdeadbeef);
5152 ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, &count, buffer, &size);
5153 ok(!ret, "Expected GetSystemPreferredUILanguages to fail\n");
5155 "Expected error ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
5156
5157 count = 0xdeadbeef;
5158 size = size_id -2;
5159 memset(buffer, 0x5a, size_buffer * sizeof(WCHAR));
5160 SetLastError(0xdeadbeef);
5161 ret = pGetSystemPreferredUILanguages(0, &count, buffer, &size);
5162 ok(!ret, "Expected GetSystemPreferredUILanguages to fail\n");
5164 "Expected error ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
5165
5167}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
#define max(a, b)
Definition: svc.c:63
uint32_t ULONG
Definition: typedefs.h:59

Referenced by START_TEST().

◆ test_GetThreadPreferredUILanguages()

static void test_GetThreadPreferredUILanguages ( void  )
static

Definition at line 5169 of file locale.c.

5170{
5171 BOOL ret;
5172 ULONG count, size;
5173 WCHAR *buf;
5174
5175 if (!pGetThreadPreferredUILanguages)
5176 {
5177 win_skip("GetThreadPreferredUILanguages is not available.\n");
5178 return;
5179 }
5180
5181 size = count = 0;
5182 ret = pGetThreadPreferredUILanguages(MUI_LANGUAGE_ID|MUI_UI_FALLBACK, &count, NULL, &size);
5183 ok(ret, "got %u\n", GetLastError());
5184 ok(count, "expected count > 0\n");
5185 ok(size, "expected size > 0\n");
5186
5187 count = 0;
5189 ret = pGetThreadPreferredUILanguages(MUI_LANGUAGE_ID|MUI_UI_FALLBACK, &count, buf, &size);
5190 ok(ret, "got %u\n", GetLastError());
5191 ok(count, "expected count > 0\n");
5193}
#define HEAP_ZERO_MEMORY
Definition: compat.h:134

Referenced by START_TEST().

◆ test_GetTimeFormatA()

static void test_GetTimeFormatA ( void  )
static

Definition at line 428 of file locale.c.

429{
430 int ret;
431 SYSTEMTIME curtime;
434
435 memset(&curtime, 2, sizeof(SYSTEMTIME));
436 STRINGSA("tt HH':'mm'@'ss", ""); /* Invalid time */
437 SetLastError(0xdeadbeef);
440 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
441
442 curtime.wHour = 8;
443 curtime.wMinute = 56;
444 curtime.wSecond = 13;
445 curtime.wMilliseconds = 22;
446 STRINGSA("tt HH':'mm'@'ss", "AM 08:56@13"); /* Valid time */
447 SetLastError(0xdeadbeef);
449 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
451
452 /* MSDN: LOCALE_NOUSEROVERRIDE can't be specified with a format string */
453 SetLastError(0xdeadbeef);
456 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
457
458 STRINGSA("tt HH':'mm'@'ss", "A"); /* Insufficient buffer */
459 SetLastError(0xdeadbeef);
460 ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, input, buffer, 2);
462 "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
463
464 STRINGSA("tt HH':'mm'@'ss", "AM 08:56@13"); /* Calculate length only */
465 ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, input, NULL, 0);
466 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
468
469 STRINGSA("", "8 AM"); /* TIME_NOMINUTESORSECONDS, default format */
471 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
473
474 STRINGSA("m1s2m3s4", ""); /* TIME_NOMINUTESORSECONDS/complex format */
476 ok(ret == strlen(buffer)+1, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
477 ok( !strcmp( buffer, "" ) || broken( !strcmp( buffer, "4" )), /* win9x */
478 "Expected '', got '%s'\n", buffer );
479
480 STRINGSA("", "8:56 AM"); /* TIME_NOSECONDS/Default format */
482 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
484
485 STRINGSA("h:m:s tt", "8:56 AM"); /* TIME_NOSECONDS */
486 strcpy(Expected, "8:56 AM");
488 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
490
491 STRINGSA("h.@:m.@:s.@:tt", "8.@:56AM"); /* Multiple delimiters */
493 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
494 ok( !strcmp( buffer, "8.@:56AM" ) || broken( !strcmp( buffer, "8.@:56.@:AM" )) /* win9x */,
495 "Expected '8.@:56AM', got '%s'\n", buffer );
496
497 STRINGSA("s1s2s3", ""); /* Duplicate tokens */
499 ok(ret == strlen(buffer)+1, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
500 ok( !strcmp( buffer, "" ) || broken( !strcmp( buffer, "3" )), /* win9x */
501 "Expected '', got '%s'\n", buffer );
502
503 STRINGSA("t/tt", "A/AM"); /* AM time marker */
504 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
505 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
507
508 curtime.wHour = 13;
509 STRINGSA("t/tt", "P/PM"); /* PM time marker */
510 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
511 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
513
514 STRINGSA("h1t2tt3m", "156"); /* TIME_NOTIMEMARKER: removes text around time marker token */
516 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
518
519 STRINGSA("h:m:s tt", "13:56:13 PM"); /* TIME_FORCE24HOURFORMAT */
521 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
523
524 STRINGSA("h:m:s", "13:56:13"); /* TIME_FORCE24HOURFORMAT doesn't add time marker */
526 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
528
529 curtime.wHour = 14; /* change this to 14 or 2pm */
530 curtime.wMinute = 5;
531 curtime.wSecond = 3;
532 STRINGSA("h hh H HH m mm s ss t tt", "2 02 14 14 5 05 3 03 P PM"); /* 24 hrs, leading 0 */
533 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
534 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
536
537 curtime.wHour = 0;
538 STRINGSA("h/H/hh/HH", "12/0/12/00"); /* "hh" and "HH" */
539 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
540 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
542
543 STRINGSA("h:m:s tt", "12:5:3 AM"); /* non-zero flags should fail with format, doesn't */
544 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
545 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
547
548 /* try to convert formatting strings with more than two letters
549 * "h:hh:hhh:H:HH:HHH:m:mm:mmm:M:MM:MMM:s:ss:sss:S:SS:SSS"
550 * NOTE: We expect any letter for which there is an upper case value
551 * we should see a replacement. For letters that DO NOT have
552 * upper case values we should see NO REPLACEMENT.
553 */
554 curtime.wHour = 8;
555 curtime.wMinute = 56;
556 curtime.wSecond = 13;
557 curtime.wMilliseconds = 22;
558 STRINGSA("h:hh:hhh H:HH:HHH m:mm:mmm M:MM:MMM s:ss:sss S:SS:SSS",
559 "8:08:08 8:08:08 56:56:56 M:MM:MMM 13:13:13 S:SS:SSS");
560 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
561 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
563
564 STRINGSA("h", "text"); /* Don't write to buffer if len is 0 */
565 strcpy(buffer, "text");
566 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, 0);
567 ok(ret == 2, "Expected ret == 2, got %d, error %d\n", ret, GetLastError());
569
570 STRINGSA("h 'h' H 'H' HH 'HH' m 'm' s 's' t 't' tt 'tt'",
571 "8 h 8 H 08 HH 56 m 13 s A t AM tt"); /* "'" preserves tokens */
572 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
573 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
575
576 STRINGSA("'''", "'"); /* invalid quoted string */
577 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
578 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
580
581 /* test that msdn suggested single quotation usage works as expected */
582 STRINGSA("''''", "'"); /* single quote mark */
583 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
584 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
586
587 STRINGSA("''HHHHHH", "08"); /* Normal use */
588 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
589 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
591
592 /* and test for normal use of the single quotation mark */
593 STRINGSA("'''HHHHHH'", "'HHHHHH"); /* Normal use */
594 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
595 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
597
598 STRINGSA("'''HHHHHH", "'HHHHHH"); /* Odd use */
599 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
600 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
602
603 STRINGSA("'123'tt", ""); /* TIME_NOTIMEMARKER drops literals too */
605 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
607
608 curtime.wHour = 25;
609 STRINGSA("'123'tt", ""); /* Invalid time */
610 SetLastError(0xdeadbeef);
611 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
613 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
614
615 curtime.wHour = 12;
616 curtime.wMonth = 60; /* Invalid */
617 STRINGSA("h:m:s", "12:56:13"); /* Invalid date */
618 ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
619 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
621}
INT WINAPI GetTimeFormatA(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCSTR lpFormat, LPSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1044
#define TIME_NOTIMEMARKER
Definition: winnls.h:279
#define TIME_NOMINUTESORSECONDS
Definition: winnls.h:277
#define TIME_FORCE24HOURFORMAT
Definition: winnls.h:280

Referenced by START_TEST().

◆ test_GetTimeFormatEx()

static void test_GetTimeFormatEx ( void  )
static

Definition at line 623 of file locale.c.

624{
625 int ret;
626 SYSTEMTIME curtime;
628
629 if (!pGetTimeFormatEx)
630 {
631 win_skip("GetTimeFormatEx not supported\n");
632 return;
633 }
634
635 memset(&curtime, 2, sizeof(SYSTEMTIME));
636 STRINGSW("tt HH':'mm'@'ss", ""); /* Invalid time */
637 SetLastError(0xdeadbeef);
638 ret = pGetTimeFormatEx(localeW, TIME_FORCE24HOURFORMAT, &curtime, input, buffer, COUNTOF(buffer));
640 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
641
642 curtime.wHour = 8;
643 curtime.wMinute = 56;
644 curtime.wSecond = 13;
645 curtime.wMilliseconds = 22;
646 STRINGSW("tt HH':'mm'@'ss", "AM 08:56@13"); /* Valid time */
647 SetLastError(0xdeadbeef);
648 ret = pGetTimeFormatEx(localeW, TIME_FORCE24HOURFORMAT, &curtime, input, buffer, COUNTOF(buffer));
649 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
651
652 /* MSDN: LOCALE_NOUSEROVERRIDE can't be specified with a format string */
653 SetLastError(0xdeadbeef);
654 ret = pGetTimeFormatEx(localeW, NUO|TIME_FORCE24HOURFORMAT, &curtime, input, buffer, COUNTOF(buffer));
656 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
657
658 STRINGSW("tt HH':'mm'@'ss", "A"); /* Insufficient buffer */
659 SetLastError(0xdeadbeef);
660 ret = pGetTimeFormatEx(localeW, TIME_FORCE24HOURFORMAT, &curtime, input, buffer, 2);
662 "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
663
664 STRINGSW("tt HH':'mm'@'ss", "AM 08:56@13"); /* Calculate length only */
665 ret = pGetTimeFormatEx(localeW, TIME_FORCE24HOURFORMAT, &curtime, input, NULL, 0);
666 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
668
669 STRINGSW("", "8 AM"); /* TIME_NOMINUTESORSECONDS, default format */
670 ret = pGetTimeFormatEx(localeW, NUO|TIME_NOMINUTESORSECONDS, &curtime, NULL, buffer, COUNTOF(buffer));
671 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
673
674 STRINGSW("m1s2m3s4", ""); /* TIME_NOMINUTESORSECONDS/complex format */
675 ret = pGetTimeFormatEx(localeW, TIME_NOMINUTESORSECONDS, &curtime, input, buffer, COUNTOF(buffer));
676 ok(ret == strlenW(buffer)+1, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
678
679 STRINGSW("", "8:56 AM"); /* TIME_NOSECONDS/Default format */
680 ret = pGetTimeFormatEx(localeW, NUO|TIME_NOSECONDS, &curtime, NULL, buffer, COUNTOF(buffer));
681 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
683
684 STRINGSW("h:m:s tt", "8:56 AM"); /* TIME_NOSECONDS */
685 ret = pGetTimeFormatEx(localeW, TIME_NOSECONDS, &curtime, input, buffer, COUNTOF(buffer));
686 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
688
689 STRINGSW("h.@:m.@:s.@:tt", "8.@:56AM"); /* Multiple delimiters */
690 ret = pGetTimeFormatEx(localeW, TIME_NOSECONDS, &curtime, input, buffer, COUNTOF(buffer));
691 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
693
694 STRINGSW("s1s2s3", ""); /* Duplicate tokens */
695 ret = pGetTimeFormatEx(localeW, TIME_NOSECONDS, &curtime, input, buffer, COUNTOF(buffer));
696 ok(ret == strlenW(buffer)+1, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
698
699 STRINGSW("t/tt", "A/AM"); /* AM time marker */
700 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
701 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
703
704 curtime.wHour = 13;
705 STRINGSW("t/tt", "P/PM"); /* PM time marker */
706 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
707 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
709
710 STRINGSW("h1t2tt3m", "156"); /* TIME_NOTIMEMARKER: removes text around time marker token */
711 ret = pGetTimeFormatEx(localeW, TIME_NOTIMEMARKER, &curtime, input, buffer, COUNTOF(buffer));
712 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
714
715 STRINGSW("h:m:s tt", "13:56:13 PM"); /* TIME_FORCE24HOURFORMAT */
716 ret = pGetTimeFormatEx(localeW, TIME_FORCE24HOURFORMAT, &curtime, input, buffer, COUNTOF(buffer));
717 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
719
720 STRINGSW("h:m:s", "13:56:13"); /* TIME_FORCE24HOURFORMAT doesn't add time marker */
721 ret = pGetTimeFormatEx(localeW, TIME_FORCE24HOURFORMAT, &curtime, input, buffer, COUNTOF(buffer));
722 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
724
725 curtime.wHour = 14; /* change this to 14 or 2pm */
726 curtime.wMinute = 5;
727 curtime.wSecond = 3;
728 STRINGSW("h hh H HH m mm s ss t tt", "2 02 14 14 5 05 3 03 P PM"); /* 24 hrs, leading 0 */
729 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
730 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
732
733 curtime.wHour = 0;
734 STRINGSW("h/H/hh/HH", "12/0/12/00"); /* "hh" and "HH" */
735 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
736 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
738
739 STRINGSW("h:m:s tt", "12:5:3 AM"); /* non-zero flags should fail with format, doesn't */
740 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
741 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
743
744 /* try to convert formatting strings with more than two letters
745 * "h:hh:hhh:H:HH:HHH:m:mm:mmm:M:MM:MMM:s:ss:sss:S:SS:SSS"
746 * NOTE: We expect any letter for which there is an upper case value
747 * we should see a replacement. For letters that DO NOT have
748 * upper case values we should see NO REPLACEMENT.
749 */
750 curtime.wHour = 8;
751 curtime.wMinute = 56;
752 curtime.wSecond = 13;
753 curtime.wMilliseconds = 22;
754 STRINGSW("h:hh:hhh H:HH:HHH m:mm:mmm M:MM:MMM s:ss:sss S:SS:SSS",
755 "8:08:08 8:08:08 56:56:56 M:MM:MMM 13:13:13 S:SS:SSS");
756 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
757 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
759
760 STRINGSW("h", "text"); /* Don't write to buffer if len is 0 */
762 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, 0);
763 ok(ret == 2, "Expected ret == 2, got %d, error %d\n", ret, GetLastError());
765
766 STRINGSW("h 'h' H 'H' HH 'HH' m 'm' s 's' t 't' tt 'tt'",
767 "8 h 8 H 08 HH 56 m 13 s A t AM tt"); /* "'" preserves tokens */
768 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
769 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
771
772 STRINGSW("'''", "'"); /* invalid quoted string */
773 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
774 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
776
777 /* test that msdn suggested single quotation usage works as expected */
778 STRINGSW("''''", "'"); /* single quote mark */
779 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
780 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
782
783 STRINGSW("''HHHHHH", "08"); /* Normal use */
784 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
785 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
787
788 /* and test for normal use of the single quotation mark */
789 STRINGSW("'''HHHHHH'", "'HHHHHH"); /* Normal use */
790 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
791 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
793
794 STRINGSW("'''HHHHHH", "'HHHHHH"); /* Odd use */
795 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
796 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
798
799 STRINGSW("'123'tt", ""); /* TIME_NOTIMEMARKER drops literals too */
800 ret = pGetTimeFormatEx(localeW, TIME_NOTIMEMARKER, &curtime, input, buffer, COUNTOF(buffer));
801 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
803
804 curtime.wHour = 25;
805 STRINGSW("'123'tt", ""); /* Invalid time */
806 SetLastError(0xdeadbeef);
807 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
809 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
810
811 curtime.wHour = 12;
812 curtime.wMonth = 60; /* Invalid */
813 STRINGSW("h:m:s", "12:56:13"); /* Invalid date */
814 ret = pGetTimeFormatEx(localeW, 0, &curtime, input, buffer, COUNTOF(buffer));
815 ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
817}
#define lstrcpyW
Definition: compat.h:749
#define strlenW(s)
Definition: unicode.h:28

Referenced by START_TEST().

◆ test_GetUserPreferredUILanguages()

static void test_GetUserPreferredUILanguages ( void  )
static

Definition at line 5195 of file locale.c.

5196{
5197 BOOL ret;
5198 ULONG count, size, size_id, size_name, size_buffer;
5199 WCHAR *buffer;
5200
5201
5202 if (!pGetUserPreferredUILanguages)
5203 {
5204 win_skip("GetUserPreferredUILanguages is not available.\n");
5205 return;
5206 }
5207
5208 count = 0xdeadbeef;
5209 size = 0;
5210 SetLastError(0xdeadbeef);
5211 ret = pGetUserPreferredUILanguages(MUI_FULL_LANGUAGE, &count, NULL, &size);
5212 ok(!ret, "Expected GetUserPreferredUILanguages to fail\n");
5214 "Expected error ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
5215
5216 count = 0xdeadbeef;
5217 size = 0;
5218 SetLastError(0xdeadbeef);
5219 ret = pGetUserPreferredUILanguages(MUI_LANGUAGE_ID | MUI_FULL_LANGUAGE, &count, NULL, &size);
5220 ok(!ret, "Expected GetUserPreferredUILanguages to fail\n");
5222 "Expected error ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
5223
5224 count = 0xdeadbeef;
5225 size = 0;
5226 SetLastError(0xdeadbeef);
5227 ret = pGetUserPreferredUILanguages(MUI_LANGUAGE_ID | MUI_MACHINE_LANGUAGE_SETTINGS, &count, NULL, &size);
5228 ok(!ret, "Expected GetUserPreferredUILanguages to fail\n");
5230 "Expected error ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
5231
5232 count = 0xdeadbeef;
5233 size = 1;
5234 SetLastError(0xdeadbeef);
5235 ret = pGetUserPreferredUILanguages(MUI_LANGUAGE_ID, &count, NULL, &size);
5236 ok(!ret, "Expected GetUserPreferredUILanguages to fail\n");
5238 "Expected error ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
5239
5240 count = 0xdeadbeef;
5241 size_id = 0;
5242 SetLastError(0xdeadbeef);
5243 ret = pGetUserPreferredUILanguages(MUI_LANGUAGE_ID, &count, NULL, &size_id);
5244 ok(ret, "Expected GetUserPreferredUILanguages to succeed\n");
5245 ok(count, "Expected count > 0\n");
5246 ok(size_id % 5 == 1, "Expected size (%d) %% 5 == 1\n", size_id);
5247
5248 count = 0xdeadbeef;
5249 size_name = 0;
5250 SetLastError(0xdeadbeef);
5251 ret = pGetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &count, NULL, &size_name);
5252 ok(ret, "Expected GetUserPreferredUILanguages to succeed\n");
5253 ok(count, "Expected count > 0\n");
5254 ok(size_name % 6 == 1, "Expected size (%d) %% 6 == 1\n", size_name);
5255
5256 size_buffer = max(size_id, size_name);
5257 if(!size_buffer)
5258 {
5259 skip("No valid buffer size\n");
5260 return;
5261 }
5262
5263 buffer = HeapAlloc(GetProcessHeap(), 0, size_buffer * sizeof(WCHAR));
5264
5265 count = 0xdeadbeef;
5266 size = size_buffer;
5267 memset(buffer, 0x5a, size_buffer * sizeof(WCHAR));
5268 SetLastError(0xdeadbeef);
5269 ret = pGetUserPreferredUILanguages(0, &count, buffer, &size);
5270 ok(ret, "Expected GetUserPreferredUILanguages to succeed\n");
5271 ok(count, "Expected count > 0\n");
5272 ok(size % 6 == 1, "Expected size (%d) %% 6 == 1\n", size);
5273 if (ret && size % 6 == 1)
5274 ok(!buffer[size -2] && !buffer[size -1],
5275 "Expected last two WCHARs being empty, got 0x%x 0x%x\n",
5276 buffer[size -2], buffer[size -1]);
5277
5278 count = 0xdeadbeef;
5279 size = size_buffer;
5280 memset(buffer, 0x5a, size_buffer * sizeof(WCHAR));
5281 SetLastError(0xdeadbeef);
5282 ret = pGetUserPreferredUILanguages(MUI_LANGUAGE_ID, &count, buffer, &size);
5283 ok(ret, "Expected GetUserPreferredUILanguages to succeed\n");
5284 ok(count, "Expected count > 0\n");
5285 ok(size % 5 == 1, "Expected size (%d) %% 5 == 1\n", size);
5286 if (ret && size % 5 == 1)
5287 ok(!buffer[size -2] && !buffer[size -1],
5288 "Expected last two WCHARs being empty, got 0x%x 0x%x\n",
5289 buffer[size -2], buffer[size -1]);
5290
5291 count = 0xdeadbeef;
5292 size = size_buffer;
5293 SetLastError(0xdeadbeef);
5294 ret = pGetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &count, buffer, &size);
5295 ok(ret, "Expected GetUserPreferredUILanguages to succeed\n");
5296 ok(count, "Expected count > 0\n");
5297 ok(size % 6 == 1, "Expected size (%d) %% 6 == 1\n", size);
5298 if (ret && size % 5 == 1)
5299 ok(!buffer[size -2] && !buffer[size -1],
5300 "Expected last two WCHARs being empty, got 0x%x 0x%x\n",
5301 buffer[size -2], buffer[size -1]);
5302
5303 count = 0xdeadbeef;
5304 size = 1;
5305 SetLastError(0xdeadbeef);
5306 ret = pGetUserPreferredUILanguages(MUI_LANGUAGE_ID, &count, buffer, &size);
5307 ok(!ret, "Expected GetUserPreferredUILanguages to fail\n");
5309 "Expected error ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
5310
5311 count = 0xdeadbeef;
5312 size = size_id -1;
5313 memset(buffer, 0x5a, size_buffer * sizeof(WCHAR));
5314 SetLastError(0xdeadbeef);
5315 ret = pGetUserPreferredUILanguages(MUI_LANGUAGE_ID, &count, buffer, &size);
5316 ok(!ret, "Expected GetUserPreferredUILanguages to fail\n");
5318 "Expected error ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
5319
5320 count = 0xdeadbeef;
5321 size = size_id -2;
5322 memset(buffer, 0x5a, size_buffer * sizeof(WCHAR));
5323 SetLastError(0xdeadbeef);
5324 ret = pGetUserPreferredUILanguages(0, &count, buffer, &size);
5325 ok(!ret, "Expected GetUserPreferredUILanguages to fail\n");
5327 "Expected error ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
5328
5330}

Referenced by START_TEST().

◆ test_IdnToAscii()

static void test_IdnToAscii ( void  )
static

Definition at line 4293 of file locale.c.

4294{
4295 struct {
4296 DWORD in_len;
4297 const WCHAR in[64];
4298 DWORD ret;
4299 const WCHAR out[64];
4300 DWORD flags;
4301 DWORD err;
4302 } test_data[] = {
4303 {
4304 5, {'T','e','s','t',0},
4305 5, {'T','e','s','t',0},
4306 0, 0xdeadbeef
4307 },
4308 {
4309 5, {'T','e',0x017c,'s','t',0},
4310 12, {'x','n','-','-','t','e','s','t','-','c','b','b',0},
4311 0, 0xdeadbeef
4312 },
4313 {
4314 12, {'t','e',0x0105,'s','t','.','t','e',0x017c,'s','t',0},
4315 26, {'x','n','-','-','t','e','s','t','-','c','t','a','.','x','n','-','-','t','e','s','t','-','c','b','b',0},
4316 0, 0xdeadbeef
4317 },
4318 {
4319 3, {0x0105,'.',0},
4320 9, {'x','n','-','-','2','d','a','.',0},
4321 0, 0xdeadbeef
4322 },
4323 {
4324 10, {'h','t','t','p',':','/','/','t',0x0106,0},
4325 17, {'x','n','-','-','h','t','t','p',':','/','/','t','-','7','8','a',0},
4326 0, 0xdeadbeef
4327 },
4328 {
4329 10, {0x4e3a,0x8bf4,0x4e0d,0x4ed6,0x5011,0x10d,0x11b,0x305c,0x306a,0},
4330 35, {'x','n','-','-','b','e','a','2','a','1','6','3','1','a','v','b','a',
4331 'v','4','4','t','y','h','a','3','2','b','9','1','e','g','s','2','t',0},
4332 0, 0xdeadbeef
4333 },
4334 {
4335 2, {0x221,0},
4336 8, {'x','n','-','-','6','l','a',0},
4337 IDN_ALLOW_UNASSIGNED, 0xdeadbeef
4338 },
4339 };
4340
4341 WCHAR buf[1024];
4342 DWORD i, ret, err;
4343
4344 if (!pIdnToAscii)
4345 {
4346 win_skip("IdnToAscii is not available\n");
4347 return;
4348 }
4349
4350 for (i=0; i<sizeof(test_data)/sizeof(*test_data); i++)
4351 {
4352 SetLastError(0xdeadbeef);
4353 ret = pIdnToAscii(test_data[i].flags, test_data[i].in,
4354 test_data[i].in_len, buf, sizeof(buf));
4355 err = GetLastError();
4356 ok(ret == test_data[i].ret, "%d) ret = %d\n", i, ret);
4357 ok(err == test_data[i].err, "%d) err = %d\n", i, err);
4358 ok(!memcmp(test_data[i].out, buf, ret*sizeof(WCHAR)),
4359 "%d) buf = %s\n", i, wine_dbgstr_wn(buf, ret));
4360 }
4361}
const char * wine_dbgstr_wn(const WCHAR *str, int n)
Definition: compat.c:367
GLuint in
Definition: glext.h:9616
#define err(...)
static FILE * out
Definition: regtests2xml.c:44

Referenced by START_TEST().

◆ test_IdnToNameprepUnicode()

static void test_IdnToNameprepUnicode ( void  )
static

Definition at line 4126 of file locale.c.

4127{
4128 struct {
4129 DWORD in_len;
4130 const WCHAR in[64];
4131 DWORD ret;
4132 DWORD broken_ret;
4133 const WCHAR out[64];
4134 DWORD flags;
4135 DWORD err;
4136 DWORD todo;
4137 } test_data[] = {
4138 {
4139 5, {'t','e','s','t',0},
4140 5, 5, {'t','e','s','t',0},
4141 0, 0xdeadbeef
4142 },
4143 {
4144 3, {'a',0xe111,'b'},
4145 0, 0, {0},
4147 },
4148 {
4149 4, {'t',0,'e',0},
4150 0, 0, {0},
4152 },
4153 {
4154 1, {'T',0},
4155 1, 1, {'T',0},
4156 0, 0xdeadbeef
4157 },
4158 {
4159 1, {0},
4160 0, 0, {0},
4162 },
4163 {
4164 6, {' ','-','/','[',']',0},
4165 6, 6, {' ','-','/','[',']',0},
4166 0, 0xdeadbeef
4167 },
4168 {
4169 3, {'a','-','a'},
4170 3, 3, {'a','-','a'},
4171 IDN_USE_STD3_ASCII_RULES, 0xdeadbeef
4172 },
4173 {
4174 3, {'a','a','-'},
4175 0, 0, {0},
4176 IDN_USE_STD3_ASCII_RULES, ERROR_INVALID_NAME
4177 },
4178 { /* FoldString is not working as expected when MAP_FOLDCZONE is specified (composition+compatibility) */
4179 10, {'T',0xdf,0x130,0x143,0x37a,0x6a,0x30c,' ',0xaa,0},
4180 12, 12, {'t','s','s','i',0x307,0x144,' ',0x3b9,0x1f0,' ','a',0},
4181 0, 0xdeadbeef, TRUE
4182 },
4183 {
4184 11, {'t',0xad,0x34f,0x1806,0x180b,0x180c,0x180d,0x200b,0x200c,0x200d,0},
4185 2, 0, {'t',0},
4186 0, 0xdeadbeef
4187 },
4188 { /* Another example of incorrectly working FoldString (composition) */
4189 2, {0x3b0, 0},
4190 2, 2, {0x3b0, 0},
4191 0, 0xdeadbeef, TRUE
4192 },
4193 {
4194 2, {0x221, 0},
4195 0, 2, {0},
4197 },
4198 {
4199 2, {0x221, 0},
4200 2, 2, {0x221, 0},
4201 IDN_ALLOW_UNASSIGNED, 0xdeadbeef
4202 },
4203 {
4204 5, {'a','.','.','a',0},
4205 0, 0, {0},
4207 },
4208 {
4209 3, {'a','.',0},
4210 3, 3, {'a','.',0},
4211 0, 0xdeadbeef
4212 },
4213 };
4214
4215 WCHAR buf[1024];
4216 DWORD i, ret, err;
4217
4218 if (!pIdnToNameprepUnicode)
4219 {
4220 win_skip("IdnToNameprepUnicode is not available\n");
4221 return;
4222 }
4223
4224 ret = pIdnToNameprepUnicode(0, test_data[0].in,
4225 test_data[0].in_len, NULL, 0);
4226 ok(ret == test_data[0].ret, "ret = %d\n", ret);
4227
4228 SetLastError(0xdeadbeef);
4229 ret = pIdnToNameprepUnicode(0, test_data[1].in,
4230 test_data[1].in_len, NULL, 0);
4231 err = GetLastError();
4232 ok(ret == test_data[1].ret, "ret = %d\n", ret);
4233 ok(err == test_data[1].err, "err = %d\n", err);
4234
4235 SetLastError(0xdeadbeef);
4236 ret = pIdnToNameprepUnicode(0, test_data[0].in, -1,
4237 buf, sizeof(buf)/sizeof(WCHAR));
4238 err = GetLastError();
4239 ok(ret == test_data[0].ret, "ret = %d\n", ret);
4240 ok(err == 0xdeadbeef, "err = %d\n", err);
4241
4242 SetLastError(0xdeadbeef);
4243 ret = pIdnToNameprepUnicode(0, test_data[0].in, -2,
4244 buf, sizeof(buf)/sizeof(WCHAR));
4245 err = GetLastError();
4246 ok(ret == 0, "ret = %d\n", ret);
4247 ok(err == ERROR_INVALID_PARAMETER, "err = %d\n", err);
4248
4249 SetLastError(0xdeadbeef);
4250 ret = pIdnToNameprepUnicode(0, test_data[0].in, 0,
4251 buf, sizeof(buf)/sizeof(WCHAR));
4252 err = GetLastError();
4253 ok(ret == 0, "ret = %d\n", ret);
4254 ok(err == ERROR_INVALID_NAME, "err = %d\n", err);
4255
4256 ret = pIdnToNameprepUnicode(IDN_ALLOW_UNASSIGNED|IDN_USE_STD3_ASCII_RULES,
4257 test_data[0].in, -1, buf, sizeof(buf)/sizeof(WCHAR));
4258 ok(ret == test_data[0].ret, "ret = %d\n", ret);
4259
4260 SetLastError(0xdeadbeef);
4261 ret = pIdnToNameprepUnicode(0, NULL, 0, NULL, 0);
4262 err = GetLastError();
4263 ok(ret == 0, "ret = %d\n", ret);
4264 ok(err == ERROR_INVALID_PARAMETER, "err = %d\n", err);
4265
4266 SetLastError(0xdeadbeef);
4267 ret = pIdnToNameprepUnicode(4, NULL, 0, NULL, 0);
4268 err = GetLastError();
4269 ok(ret == 0, "ret = %d\n", ret);
4271 "err = %d\n", err);
4272
4273 for (i=0; i<sizeof(test_data)/sizeof(*test_data); i++)
4274 {
4275 SetLastError(0xdeadbeef);
4276 ret = pIdnToNameprepUnicode(test_data[i].flags, test_data[i].in,
4277 test_data[i].in_len, buf, sizeof(buf)/sizeof(WCHAR));
4278 err = GetLastError();
4279
4281 ok(ret == test_data[i].ret ||
4282 broken(ret == test_data[i].broken_ret), "%d) ret = %d\n", i, ret);
4283
4284 if(ret != test_data[i].ret)
4285 continue;
4286
4287 ok(err == test_data[i].err, "%d) err = %d\n", i, err);
4288 ok(!memcmp(test_data[i].out, buf, ret*sizeof(WCHAR)),
4289 "%d) buf = %s\n", i, wine_dbgstr_wn(buf, ret));
4290 }
4291}
#define ERROR_INVALID_NAME
Definition: compat.h:103
#define ERROR_NO_UNICODE_TRANSLATION
Definition: winerror.h:649

Referenced by START_TEST().

◆ test_IdnToUnicode()

static void test_IdnToUnicode ( void  )
static

Definition at line 4363 of file locale.c.

4364{
4365 struct {
4366 DWORD in_len;
4367 const WCHAR in[64];
4368 DWORD ret;
4369 const WCHAR out[64];
4370 DWORD flags;
4371 DWORD err;
4372 } test_data[] = {
4373 {
4374 5, {'T','e','s','.',0},
4375 5, {'T','e','s','.',0},
4376 0, 0xdeadbeef
4377 },
4378 {
4379 2, {0x105,0},
4380 0, {0},
4382 },
4383 {
4384 33, {'x','n','-','-','4','d','b','c','a','g','d','a','h','y','m','b',
4385 'x','e','k','h','e','h','6','e','0','a','7','f','e','i','0','b',0},
4386 23, {0x05dc,0x05de,0x05d4,0x05d4,0x05dd,0x05e4,0x05e9,0x05d5,0x05d8,
4387 0x05dc,0x05d0,0x05de,0x05d3,0x05d1,0x05e8,0x05d9,0x05dd,0x05e2,
4388 0x05d1,0x05e8,0x05d9,0x05ea,0},
4389 0, 0xdeadbeef
4390 },
4391 {
4392 34, {'t','e','s','t','.','x','n','-','-','k','d','a','9','a','g','5','e',
4393 '9','j','n','f','s','j','.','x','n','-','-','p','d','-','f','n','a'},
4394 16, {'t','e','s','t','.',0x0105,0x0119,0x015b,0x0107,
4395 0x0142,0x00f3,0x017c,'.','p',0x0119,'d'},
4396 0, 0xdeadbeef
4397 },
4398 {
4399 64, {'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a',
4400 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a',
4401 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a',
4402 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a'},
4403 0, {0},
4405 },
4406 {
4407 8, {'x','n','-','-','6','l','a',0},
4408 2, {0x221,0},
4409 IDN_ALLOW_UNASSIGNED, 0xdeadbeef
4410 },
4411 };
4412
4413 WCHAR buf[1024];
4414 DWORD i, ret, err;
4415
4416 if (!pIdnToUnicode)
4417 {
4418 win_skip("IdnToUnicode is not available\n");
4419 return;
4420 }
4421
4422 for (i=0; i<sizeof(test_data)/sizeof(*test_data); i++)
4423 {
4424 ret = pIdnToUnicode(test_data[i].flags, test_data[i].in,
4425 test_data[i].in_len, NULL, 0);
4426 ok(ret == test_data[i].ret, "%d) ret = %d\n", i, ret);
4427
4428 SetLastError(0xdeadbeef);
4429 ret = pIdnToUnicode(test_data[i].flags, test_data[i].in,
4430 test_data[i].in_len, buf, sizeof(buf));
4431 err = GetLastError();
4432 ok(ret == test_data[i].ret, "%d) ret = %d\n", i, ret);
4433 ok(err == test_data[i].err, "%d) err = %d\n", i, err);
4434 ok(!memcmp(test_data[i].out, buf, ret*sizeof(WCHAR)),
4435 "%d) buf = %s\n", i, wine_dbgstr_wn(buf, ret));
4436 }
4437}

Referenced by START_TEST().

◆ test_invariant()

static void test_invariant ( void  )
static

Definition at line 4913 of file locale.c.

4914{
4915 int ret;
4916 int len;
4917 char buffer[BUFFER_SIZE];
4918 const struct invariant_entry *ptr = invariant_list;
4919
4921 {
4922 win_skip("GetLocaleInfoA(LOCALE_INVARIANT) not supported\n"); /* win2k */
4923 return;
4924 }
4925
4926 while (ptr->name)
4927 {
4929 if (!ret && (ptr->id == LOCALE_SNAME || ptr->id == LOCALE_SSCRIPTS))
4930 win_skip("not supported\n"); /* winxp/win2k3 */
4931 else
4932 {
4933 len = strlen(ptr->expect)+1; /* include \0 */
4934 ok(ret == len || (ptr->expect2 && ret == strlen(ptr->expect2)+1),
4935 "For id %d, expected ret == %d, got %d, error %d\n",
4936 ptr->id, len, ret, GetLastError());
4937 ok(!strcmp(buffer, ptr->expect) || (ptr->expect2 && !strcmp(buffer, ptr->expect2)),
4938 "For id %d, Expected %s, got '%s'\n",
4939 ptr->id, ptr->expect, buffer);
4940 }
4941
4942 ptr++;
4943 }
4944
4947 {
4948 skip("Non US-English locale\n");
4949 }
4950 else
4951 {
4952 /* some locales translate these */
4953 static const char lang[] = "Invariant Language (Invariant Country)";
4954 static const char cntry[] = "Invariant Country";
4955 static const char sortm[] = "Math Alphanumerics";
4956 static const char sortd[] = "Default"; /* win2k3 */
4957
4959 len = lstrlenA(lang) + 1;
4960 ok(ret == len, "Expected ret == %d, got %d, error %d\n", len, ret, GetLastError());
4961 ok(!strcmp(buffer, lang), "Expected %s, got '%s'\n", lang, buffer);
4962
4964 len = lstrlenA(cntry) + 1;
4965 ok(ret == len, "Expected ret == %d, got %d, error %d\n", len, ret, GetLastError());
4966 ok(!strcmp(buffer, cntry), "Expected %s, got '%s'\n", cntry, buffer);
4967
4968 ret = GetLocaleInfoA(LOCALE_INVARIANT, NUO|LOCALE_SSORTNAME, buffer, sizeof(buffer));
4969 if (ret == lstrlenA(sortm)+1)
4970 ok(!strcmp(buffer, sortm), "Expected %s, got '%s'\n", sortm, buffer);
4971 else if (ret == lstrlenA(sortd)+1) /* win2k3 */
4972 ok(!strcmp(buffer, sortd), "Expected %s, got '%s'\n", sortd, buffer);
4973 else
4974 ok(0, "Expected ret == %d or %d, got %d, error %d\n",
4975 lstrlenA(sortm)+1, lstrlenA(sortd)+1, ret, GetLastError());
4976 }
4977}
static const struct invariant_entry invariant_list[]
Definition: locale.c:4800
Definition: locale.c:4793
static const WCHAR lang[]
Definition: wbemdisp.c:287

Referenced by START_TEST().

◆ test_IsValidLocaleName()

static void test_IsValidLocaleName ( void  )
static

Definition at line 4530 of file locale.c.

4531{
4532 static const WCHAR enusW[] = {'e','n','-','U','S',0};
4533 static const WCHAR zzW[] = {'z','z',0};
4534 static const WCHAR zz_zzW[] = {'z','z','-','Z','Z',0};
4535 static const WCHAR zzzzW[] = {'z','z','z','z',0};
4536 BOOL ret;
4537
4538 if (!pIsValidLocaleName)
4539 {
4540 win_skip("IsValidLocaleName not supported\n");
4541 return;
4542 }
4543
4544 ret = pIsValidLocaleName(enusW);
4545 ok(ret, "IsValidLocaleName failed\n");
4546 ret = pIsValidLocaleName(zzW);
4547 ok(!ret || broken(ret), "IsValidLocaleName should have failed\n");
4548 ret = pIsValidLocaleName(zz_zzW);
4549 ok(!ret || broken(ret), "IsValidLocaleName should have failed\n");
4550 ret = pIsValidLocaleName(zzzzW);
4551 ok(!ret, "IsValidLocaleName should have failed\n");
4552 ret = pIsValidLocaleName(LOCALE_NAME_INVARIANT);
4553 ok(ret, "IsValidLocaleName failed\n");
4554 ret = pIsValidLocaleName(NULL);
4555 ok(!ret, "IsValidLocaleName should have failed\n");
4556}

Referenced by START_TEST().

◆ test_lcmapstring_unicode()

static void test_lcmapstring_unicode ( lcmapstring_wrapper  func_ptr,
const char func_name 
)
static

Definition at line 2392 of file locale.c.

2393{
2394 static const WCHAR japanese_text[] = {
2395 0x3044, 0x309d, 0x3084, 0x3001, 0x30a4, 0x30fc, 0x30cf,
2396 0x30c8, 0x30fc, 0x30f4, 0x30a9, 0x306e, 0x2026, 0
2397 };
2398 static const WCHAR hiragana_text[] = {
2399 0x3044, 0x309d, 0x3084, 0x3001, 0x3044, 0x30fc, 0x306f,
2400 0x3068, 0x30fc, 0x3094, 0x3049, 0x306e, 0x2026, 0
2401 };
2402 static const WCHAR katakana_text[] = {
2403 0x30a4, 0x30fd, 0x30e4, 0x3001, 0x30a4, 0x30fc, 0x30cf,
2404 0x30c8, 0x30fc, 0x30f4, 0x30a9, 0x30ce, 0x2026, 0
2405 };
2406 static const WCHAR halfwidth_text[] = {
2407 0x3044, 0x309d, 0x3084, 0xff64, 0xff72, 0xff70, 0xff8a,
2408 0xff84, 0xff70, 0xff73, 0xff9e, 0xff6b, 0x306e, 0x2026, 0
2409 };
2410 int ret, ret2, i;
2411 WCHAR buf[256], buf2[256];
2412 char *p_buf = (char *)buf, *p_buf2 = (char *)buf2;
2413
2414 /* LCMAP_LOWERCASE | LCMAP_UPPERCASE makes LCMAP_TITLECASE, so it's valid now. */
2416 lower_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
2418 "%s ret %d, error %d, expected value %d\n", func_name,
2421 "Expected title case string\n");
2422
2423 /* test invalid flag combinations */
2424 for (i = 0; i < sizeof(lcmap_invalid_flags)/sizeof(lcmap_invalid_flags[0]); i++) {
2425 lstrcpyW(buf, fooW);
2426 SetLastError(0xdeadbeef);
2428 lower_case, -1, buf, sizeof(buf));
2430 "%s (flag %08x) unexpected error code %d\n",
2432 ok(!ret, "%s (flag %08x) should return 0, got %d\n",
2434 }
2435
2436 /* test LCMAP_LOWERCASE */
2438 upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
2439 ok(ret == lstrlenW(upper_case) + 1, "%s ret %d, error %d, expected value %d\n", func_name,
2441 ok(!lstrcmpW(buf, lower_case), "%s string compare mismatch\n", func_name);
2442
2443 /* test LCMAP_UPPERCASE */
2445 lower_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
2446 ok(ret == lstrlenW(lower_case) + 1, "%s ret %d, error %d, expected value %d\n", func_name,
2448 ok(!lstrcmpW(buf, upper_case), "%s string compare mismatch\n", func_name);
2449
2450 /* test LCMAP_HIRAGANA */
2452 japanese_text, -1, buf, sizeof(buf)/sizeof(WCHAR));
2453 ok(ret == lstrlenW(hiragana_text) + 1, "%s ret %d, error %d, expected value %d\n", func_name,
2454 ret, GetLastError(), lstrlenW(hiragana_text) + 1);
2455 ok(!lstrcmpW(buf, hiragana_text), "%s string compare mismatch\n", func_name);
2456
2457 buf[0] = 0x30f5; /* KATAKANA LETTER SMALL KA */
2458 ret = func_ptr(LCMAP_HIRAGANA, buf, 1, buf2, 1);
2459 ok(ret == 1, "%s ret %d, error %d, expected value 1\n", func_name,
2460 ret, GetLastError());
2461 /* U+3095: HIRAGANA LETTER SMALL KA was added in Unicode 3.2 */
2462 ok(buf2[0] == 0x3095 || broken(buf2[0] == 0x30f5 /* Vista and earlier versions */),
2463 "%s expected %04x, got %04x\n", func_name, 0x3095, buf2[0]);
2464
2465 /* test LCMAP_KATAKANA | LCMAP_LOWERCASE */
2467 japanese_text, -1, buf, sizeof(buf)/sizeof(WCHAR));
2468 ok(ret == lstrlenW(katakana_text) + 1, "%s ret %d, error %d, expected value %d\n", func_name,
2469 ret, GetLastError(), lstrlenW(katakana_text) + 1);
2470 ok(!lstrcmpW(buf, katakana_text), "%s string compare mismatch\n", func_name);
2471
2472 /* test LCMAP_FULLWIDTH */
2474 halfwidth_text, -1, buf, sizeof(buf)/sizeof(WCHAR));
2475 ok(ret == lstrlenW(japanese_text) + 1, "%s ret %d, error %d, expected value %d\n", func_name,
2476 ret, GetLastError(), lstrlenW(japanese_text) + 1);
2477 ok(!lstrcmpW(buf, japanese_text), "%s string compare mismatch\n", func_name);
2478
2479 ret2 = func_ptr(LCMAP_FULLWIDTH, halfwidth_text, -1, NULL, 0);
2480 ok(ret == ret2, "%s ret %d, expected value %d\n", func_name, ret2, ret);
2481
2482 /* test LCMAP_FULLWIDTH | LCMAP_HIRAGANA
2483 (half-width katakana is converted into full-width hiragana) */
2485 halfwidth_text, -1, buf, sizeof(buf)/sizeof(WCHAR));
2486 ok(ret == lstrlenW(hiragana_text) + 1, "%s ret %d, error %d, expected value %d\n", func_name,
2487 ret, GetLastError(), lstrlenW(hiragana_text) + 1);
2488 ok(!lstrcmpW(buf, hiragana_text), "%s string compare mismatch\n", func_name);
2489
2490 ret2 = func_ptr(LCMAP_FULLWIDTH | LCMAP_HIRAGANA, halfwidth_text, -1, NULL, 0);
2491 ok(ret == ret2, "%s ret %d, expected value %d\n", func_name, ret, ret2);
2492
2493 /* test LCMAP_HALFWIDTH */
2495 japanese_text, -1, buf, sizeof(buf)/sizeof(WCHAR));
2496 ok(ret == lstrlenW(halfwidth_text) + 1, "%s ret %d, error %d, expected value %d\n", func_name,
2497 ret, GetLastError(), lstrlenW(halfwidth_text) + 1);
2498 ok(!lstrcmpW(buf, halfwidth_text), "%s string compare mismatch\n", func_name);
2499
2500 ret2 = func_ptr(LCMAP_HALFWIDTH, japanese_text, -1, NULL, 0);
2501 ok(ret == ret2, "%s ret %d, expected value %d\n", func_name, ret, ret2);
2502
2503 /* test buffer overflow */
2504 SetLastError(0xdeadbeef);
2506 lower_case, -1, buf, 4);
2508 "%s should return 0 and ERROR_INSUFFICIENT_BUFFER, got %d\n", func_name, ret);
2509
2510 /* KATAKANA LETTER GA (U+30AC) is converted into two half-width characters.
2511 Thus, it requires two WCHARs. */
2512 buf[0] = 0x30ac;
2513 SetLastError(0xdeadbeef);
2514 ret = func_ptr(LCMAP_HALFWIDTH, buf, 1, buf2, 1);
2516 "%s should return 0 and ERROR_INSUFFICIENT_BUFFER, got %d\n", func_name, ret);
2517
2518 /* LCMAP_UPPERCASE or LCMAP_LOWERCASE should accept src == dst */
2521 buf, -1, buf, sizeof(buf)/sizeof(WCHAR));
2522 ok(ret == lstrlenW(lower_case) + 1, "%s ret %d, error %d, expected value %d\n", func_name,
2524 ok(!lstrcmpW(buf, upper_case), "%s string compare mismatch\n", func_name);
2525
2528 buf, -1, buf, sizeof(buf)/sizeof(WCHAR));
2529 ok(ret == lstrlenW(upper_case) + 1, "%s ret %d, error %d, expected value %d\n", func_name,
2531 ok(!lstrcmpW(buf, lower_case), "%s string compare mismatch\n", func_name);
2532
2533 /* otherwise src == dst should fail */
2534 SetLastError(0xdeadbeef);
2536 buf, 10, buf, sizeof(buf));
2537 ok(GetLastError() == ERROR_INVALID_FLAGS /* NT */ ||
2538 GetLastError() == ERROR_INVALID_PARAMETER /* Win7+ */,
2539 "%s unexpected error code %d\n", func_name, GetLastError());
2540 ok(!ret, "%s src == dst without LCMAP_UPPERCASE or LCMAP_LOWERCASE must fail\n", func_name);
2541
2542 /* test whether '\0' is always appended */
2544 upper_case, -1, buf, sizeof(buf));
2545 ok(ret, "%s func_ptr must succeed\n", func_name);
2546 ret2 = func_ptr(LCMAP_SORTKEY,
2547 upper_case, lstrlenW(upper_case), buf2, sizeof(buf2));
2548 ok(ret, "%s func_ptr must succeed\n", func_name);
2549 ok(ret == ret2, "%s lengths of sort keys must be equal\n", func_name);
2550 ok(!lstrcmpA(p_buf, p_buf2), "%s sort keys must be equal\n", func_name);
2551
2552 /* test LCMAP_SORTKEY | NORM_IGNORECASE */
2554 upper_case, -1, buf, sizeof(buf));
2555 ok(ret, "%s func_ptr must succeed\n", func_name);
2556 ret2 = func_ptr(LCMAP_SORTKEY,
2557 lower_case, -1, buf2, sizeof(buf2));
2558 ok(ret2, "%s func_ptr must succeed\n", func_name);
2559 ok(ret == ret2, "%s lengths of sort keys must be equal\n", func_name);
2560 ok(!lstrcmpA(p_buf, p_buf2), "%s sort keys must be equal\n", func_name);
2561
2562 /* Don't test LCMAP_SORTKEY | NORM_IGNORENONSPACE, produces different
2563 results from plain LCMAP_SORTKEY on Vista */
2564
2565 /* test LCMAP_SORTKEY | NORM_IGNORESYMBOLS */
2567 lower_case, -1, buf, sizeof(buf));
2568 ok(ret, "%s func_ptr must succeed\n", func_name);
2569 ret2 = func_ptr(LCMAP_SORTKEY,
2570 symbols_stripped, -1, buf2, sizeof(buf2));
2571 ok(ret2, "%s func_ptr must succeed\n", func_name);
2572 ok(ret == ret2, "%s lengths of sort keys must be equal\n", func_name);
2573 ok(!lstrcmpA(p_buf, p_buf2), "%s sort keys must be equal\n", func_name);
2574
2575 /* test NORM_IGNORENONSPACE */
2576 lstrcpyW(buf, fooW);
2578 lower_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
2579 ok(ret == lstrlenW(lower_case) + 1, "%s func_ptr should return %d, ret = %d\n", func_name,
2580 lstrlenW(lower_case) + 1, ret);
2581 ok(!lstrcmpW(buf, lower_case), "%s string comparison mismatch\n", func_name);
2582
2583 /* test NORM_IGNORESYMBOLS */
2584 lstrcpyW(buf, fooW);
2586 lower_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
2587 ok(ret == lstrlenW(symbols_stripped) + 1, "%s func_ptr should return %d, ret = %d\n", func_name,
2589 ok(!lstrcmpW(buf, symbols_stripped), "%s string comparison mismatch\n", func_name);
2590
2591 /* test NORM_IGNORESYMBOLS | NORM_IGNORENONSPACE */
2592 lstrcpyW(buf, fooW);
2594 lower_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
2595 ok(ret == lstrlenW(symbols_stripped) + 1, "%s func_ptr should return %d, ret = %d\n", func_name,
2597 ok(!lstrcmpW(buf, symbols_stripped), "%s string comparison mismatch\n", func_name);
2598
2599 /* test srclen = 0 */
2600 SetLastError(0xdeadbeef);
2601 ret = func_ptr(0, upper_case, 0, buf, sizeof(buf)/sizeof(WCHAR));
2602 ok(!ret, "%s func_ptr should fail with srclen = 0\n", func_name);
2604 "%s unexpected error code %d\n", func_name, GetLastError());
2605}
void(* func_ptr)(void)
Definition: gccmain.c:11
static const WCHAR title_case[]
Definition: locale.c:41
static const WCHAR lower_case[]
Definition: locale.c:40
static const DWORD lcmap_invalid_flags[]
Definition: locale.c:2202
static const WCHAR upper_case[]
Definition: locale.c:39
static const WCHAR fooW[]
Definition: locale.c:44
static const WCHAR symbols_stripped[]
Definition: locale.c:42
void func_name(void)
#define LCMAP_HALFWIDTH
Definition: winnls.h:190
#define LCMAP_HIRAGANA
Definition: winnls.h:188
#define LCMAP_UPPERCASE
Definition: winnls.h:185
#define NORM_IGNORENONSPACE
Definition: winnls.h:178
#define NORM_IGNORESYMBOLS
Definition: winnls.h:179
#define LCMAP_LOWERCASE
Definition: winnls.h:184
#define LCMAP_KATAKANA
Definition: winnls.h:189
#define LCMAP_FULLWIDTH
Definition: winnls.h:191

Referenced by test_LCMapStringEx(), and test_LCMapStringW().

◆ test_LCMapStringA()

static void test_LCMapStringA ( void  )
static

Definition at line 2230 of file locale.c.

2231{
2232 int ret, ret2, i;
2233 char buf[256], buf2[256];
2234 static const char upper_case[] = "\tJUST! A, TEST; STRING 1/*+-.\r\n";
2235 static const char lower_case[] = "\tjust! a, test; string 1/*+-.\r\n";
2236 static const char symbols_stripped[] = "justateststring1";
2237
2238 SetLastError(0xdeadbeef);
2240 lower_case, -1, buf, sizeof(buf));
2241 ok(ret == lstrlenA(lower_case) + 1,
2242 "ret %d, error %d, expected value %d\n",
2244 ok(!memcmp(buf, lower_case, ret), "LCMapStringA should return %s, but not %s\n", lower_case, buf);
2245
2247 upper_case, -1, buf, sizeof(buf));
2248 ok(!ret, "LCMAP_LOWERCASE and LCMAP_UPPERCASE are mutually exclusive\n");
2250 "unexpected error code %d\n", GetLastError());
2251
2252 /* test invalid flag combinations */
2253 for (i = 0; i < sizeof(lcmap_invalid_flags)/sizeof(lcmap_invalid_flags[0]); i++) {
2254 lstrcpyA(buf, "foo");
2255 SetLastError(0xdeadbeef);
2257 lower_case, -1, buf, sizeof(buf));
2259 "LCMapStringA (flag %08x) unexpected error code %d\n",
2261 ok(!ret, "LCMapStringA (flag %08x) should return 0, got %d\n",
2263 }
2264
2265 /* test LCMAP_LOWERCASE */
2267 upper_case, -1, buf, sizeof(buf));
2268 ok(ret == lstrlenA(upper_case) + 1,
2269 "ret %d, error %d, expected value %d\n",
2271 ok(!lstrcmpA(buf, lower_case), "LCMapStringA should return %s, but not %s\n", lower_case, buf);
2272
2273 /* test LCMAP_UPPERCASE */
2275 lower_case, -1, buf, sizeof(buf));
2276 ok(ret == lstrlenA(lower_case) + 1,
2277 "ret %d, error %d, expected value %d\n",
2279 ok(!lstrcmpA(buf, upper_case), "LCMapStringA should return %s, but not %s\n", upper_case, buf);
2280
2281 /* test buffer overflow */
2282 SetLastError(0xdeadbeef);
2284 lower_case, -1, buf, 4);
2286 "should return 0 and ERROR_INSUFFICIENT_BUFFER, got %d\n", ret);
2287
2288 /* LCMAP_UPPERCASE or LCMAP_LOWERCASE should accept src == dst */
2291 buf, -1, buf, sizeof(buf));
2292 if (!ret) /* Win9x */
2293 trace("Ignoring LCMapStringA(LCMAP_UPPERCASE, buf, buf) error on Win9x\n");
2294 else
2295 {
2296 ok(ret == lstrlenA(lower_case) + 1,
2297 "ret %d, error %d, expected value %d\n",
2299 ok(!lstrcmpA(buf, upper_case), "LCMapStringA should return %s, but not %s\n", upper_case, buf);
2300 }
2303 buf, -1, buf, sizeof(buf));
2304 if (!ret) /* Win9x */
2305 trace("Ignoring LCMapStringA(LCMAP_LOWERCASE, buf, buf) error on Win9x\n");
2306 else
2307 {
2308 ok(ret == lstrlenA(upper_case) + 1,
2309 "ret %d, error %d, expected value %d\n",
2311 ok(!lstrcmpA(buf, lower_case), "LCMapStringA should return %s, but not %s\n", lower_case, buf);
2312 }
2313
2314 /* otherwise src == dst should fail */
2315 SetLastError(0xdeadbeef);
2317 buf, 10, buf, sizeof(buf));
2318 ok(GetLastError() == ERROR_INVALID_FLAGS /* NT */ ||
2319 GetLastError() == ERROR_INVALID_PARAMETER /* Win9x */,
2320 "unexpected error code %d\n", GetLastError());
2321 ok(!ret, "src == dst without LCMAP_UPPERCASE or LCMAP_LOWERCASE must fail\n");
2322
2323 /* test whether '\0' is always appended */
2325 upper_case, -1, buf, sizeof(buf));
2326 ok(ret, "LCMapStringA must succeed\n");
2327 ok(buf[ret-1] == 0, "LCMapStringA not null-terminated\n");
2329 upper_case, lstrlenA(upper_case), buf2, sizeof(buf2));
2330 ok(ret2, "LCMapStringA must succeed\n");
2331 ok(buf2[ret2-1] == 0, "LCMapStringA not null-terminated\n" );
2332 ok(ret == ret2, "lengths of sort keys must be equal\n");
2333 ok(!lstrcmpA(buf, buf2), "sort keys must be equal\n");
2334
2335 /* test LCMAP_SORTKEY | NORM_IGNORECASE */
2337 upper_case, -1, buf, sizeof(buf));
2338 ok(ret, "LCMapStringA must succeed\n");
2340 lower_case, -1, buf2, sizeof(buf2));
2341 ok(ret2, "LCMapStringA must succeed\n");
2342 ok(ret == ret2, "lengths of sort keys must be equal\n");
2343 ok(!lstrcmpA(buf, buf2), "sort keys must be equal\n");
2344
2345 /* Don't test LCMAP_SORTKEY | NORM_IGNORENONSPACE, produces different
2346 results from plain LCMAP_SORTKEY on Vista */
2347
2348 /* test LCMAP_SORTKEY | NORM_IGNORESYMBOLS */
2350 lower_case, -1, buf, sizeof(buf));
2351 ok(ret, "LCMapStringA must succeed\n");
2353 symbols_stripped, -1, buf2, sizeof(buf2));
2354 ok(ret2, "LCMapStringA must succeed\n");
2355 ok(ret == ret2, "lengths of sort keys must be equal\n");
2356 ok(!lstrcmpA(buf, buf2), "sort keys must be equal\n");
2357
2358 /* test NORM_IGNORENONSPACE */
2359 lstrcpyA(buf, "foo");
2361 lower_case, -1, buf, sizeof(buf));
2362 ok(ret == lstrlenA(lower_case) + 1, "LCMapStringA should return %d, ret = %d\n",
2363 lstrlenA(lower_case) + 1, ret);
2364 ok(!lstrcmpA(buf, lower_case), "LCMapStringA should return %s, but not %s\n", lower_case, buf);
2365
2366 /* test NORM_IGNORESYMBOLS */
2367 lstrcpyA(buf, "foo");
2369 lower_case, -1, buf, sizeof(buf));
2370 ok(ret == lstrlenA(symbols_stripped) + 1, "LCMapStringA should return %d, ret = %d\n",
2372 ok(!lstrcmpA(buf, symbols_stripped), "LCMapStringA should return %s, but not %s\n", lower_case, buf);
2373
2374 /* test NORM_IGNORESYMBOLS | NORM_IGNORENONSPACE */
2375 lstrcpyA(buf, "foo");
2377 lower_case, -1, buf, sizeof(buf));
2378 ok(ret == lstrlenA(symbols_stripped) + 1, "LCMapStringA should return %d, ret = %d\n",
2380 ok(!lstrcmpA(buf, symbols_stripped), "LCMapStringA should return %s, but not %s\n", lower_case, buf);
2381
2382 /* test srclen = 0 */
2383 SetLastError(0xdeadbeef);
2385 ok(!ret, "LCMapStringA should fail with srclen = 0\n");
2387 "unexpected error code %d\n", GetLastError());
2388}
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100

Referenced by START_TEST().

◆ test_LCMapStringEx()

static void test_LCMapStringEx ( void  )
static

Definition at line 2634 of file locale.c.

2635{
2636 int ret;
2637 WCHAR buf[256];
2638
2639 if (!pLCMapStringEx)
2640 {
2641 win_skip( "LCMapStringEx not available\n" );
2642 return;
2643 }
2644
2645 trace("testing LCMapStringEx\n");
2646
2647 SetLastError(0xdeadbeef);
2648 ret = pLCMapStringEx(invalidW, LCMAP_LOWERCASE,
2649 upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR), NULL, NULL, 0);
2650 todo_wine {
2651 ok(!ret, "LCMapStringEx should fail with bad locale name\n");
2652 ok(GetLastError() == ERROR_INVALID_PARAMETER, "unexpected error code %d\n", GetLastError());
2653 }
2654
2655 /* test reserved parameters */
2657 upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR), NULL, NULL, 1);
2658 ok(ret == lstrlenW(upper_case) + 1, "ret %d, error %d, expected value %d\n",
2660 ok(!lstrcmpW(buf, lower_case), "string compare mismatch\n");
2661
2663 upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR), NULL, (void*)1, 0);
2664 ok(ret == lstrlenW(upper_case) + 1, "ret %d, error %d, expected value %d\n",
2666 ok(!lstrcmpW(buf, lower_case), "string compare mismatch\n");
2667
2668 /* crashes on native */
2669 if(0)
2671 upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR), (void*)1, NULL, 0);
2672
2674}
static const WCHAR invalidW[]
Definition: locale.c:46
static void test_lcmapstring_unicode(lcmapstring_wrapper func_ptr, const char *func_name)
Definition: locale.c:2392
static INT LCMapStringEx_wrapper(DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
Definition: locale.c:2629

Referenced by START_TEST().

◆ test_LCMapStringW()

static void test_LCMapStringW ( void  )
static

Definition at line 2612 of file locale.c.

2613{
2614 int ret;
2615 WCHAR buf[256];
2616
2617 trace("testing LCMapStringW\n");
2618
2619 SetLastError(0xdeadbeef);
2620 ret = LCMapStringW((LCID)-1, LCMAP_LOWERCASE, upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR));
2621 todo_wine {
2622 ok(!ret, "LCMapStringW should fail with bad lcid\n");
2623 ok(GetLastError() == ERROR_INVALID_PARAMETER, "unexpected error code %d\n", GetLastError());
2624 }
2625
2627}
static INT LCMapStringW_wrapper(DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
Definition: locale.c:2607

Referenced by START_TEST().

◆ test_LocaleNameToLCID()

static void test_LocaleNameToLCID ( void  )
static

Definition at line 2701 of file locale.c.

2702{
2703 LCID lcid;
2704 INT ret;
2706 static const WCHAR enW[] = {'e','n',0};
2707 static const WCHAR esesW[] = {'e','s','-','e','s',0};
2708 static const WCHAR zhHansW[] = {'z','h','-','H','a','n','s',0};
2709 static const WCHAR zhhansW[] = {'z','h','-','h','a','n','s',0};
2710 static const WCHAR zhHantW[] = {'z','h','-','H','a','n','t',0};
2711 static const WCHAR zhhantW[] = {'z','h','-','h','a','n','t',0};
2712 static const WCHAR zhcnW[] = {'z','h','-','C','N',0};
2713 static const WCHAR zhhkW[] = {'z','h','-','H','K',0};
2714
2715 if (!pLocaleNameToLCID)
2716 {
2717 win_skip( "LocaleNameToLCID not available\n" );
2718 return;
2719 }
2720
2721 /* special cases */
2722 buffer[0] = 0;
2723 SetLastError(0xdeadbeef);
2724 lcid = pLocaleNameToLCID(LOCALE_NAME_USER_DEFAULT, 0);
2725 ok(lcid == GetUserDefaultLCID() || broken(GetLastError() == ERROR_INVALID_PARAMETER /* Vista */),
2726 "Expected lcid == %08x, got %08x, error %d\n", GetUserDefaultLCID(), lcid, GetLastError());
2727 ret = pLCIDToLocaleName(lcid, buffer, LOCALE_NAME_MAX_LENGTH, 0);
2728 ok(ret > 0, "Expected ret > 0, got %d, error %d\n", ret, GetLastError());
2729 trace("%08x, %s\n", lcid, wine_dbgstr_w(buffer));
2730
2731 buffer[0] = 0;
2732 SetLastError(0xdeadbeef);
2733 lcid = pLocaleNameToLCID(LOCALE_NAME_SYSTEM_DEFAULT, 0);
2735 "Expected lcid == 0, got %08x, error %d\n", lcid, GetLastError());
2736 ret = pLCIDToLocaleName(lcid, buffer, LOCALE_NAME_MAX_LENGTH, 0);
2737 ok(ret > 0, "Expected ret > 0, got %d, error %d\n", ret, GetLastError());
2738 trace("%08x, %s\n", lcid, wine_dbgstr_w(buffer));
2739
2740 buffer[0] = 0;
2741 SetLastError(0xdeadbeef);
2742 lcid = pLocaleNameToLCID(LOCALE_NAME_INVARIANT, 0);
2743 ok(lcid == 0x7F, "Expected lcid = 0x7F, got %08x, error %d\n", lcid, GetLastError());
2744 ret = pLCIDToLocaleName(lcid, buffer, LOCALE_NAME_MAX_LENGTH, 0);
2745 ok(ret > 0, "Expected ret > 0, got %d, error %d\n", ret, GetLastError());
2746 trace("%08x, %s\n", lcid, wine_dbgstr_w(buffer));
2747
2748 /* bad name */
2749 SetLastError(0xdeadbeef);
2750 lcid = pLocaleNameToLCID(invalidW, 0);
2752 "Expected lcid == 0, got %08x, error %d\n", lcid, GetLastError());
2753
2754 /* lower-case */
2755 lcid = pLocaleNameToLCID(esesW, 0);
2756 ok(lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), SORT_DEFAULT), "Got wrong lcid for es-es: 0x%x\n", lcid);
2757
2758 /* english neutral name */
2759 lcid = pLocaleNameToLCID(enW, 0);
2761 broken(lcid == 0) /* Vista */, "got 0x%04x\n", lcid);
2762 if (lcid)
2763 {
2765
2766 while (*ptr->name)
2767 {
2768 lcid = pLocaleNameToLCID(ptr->name, 0);
2769 todo_wine_if (ptr->todo)
2770 ok(lcid == ptr->lcid, "%s: got wrong lcid 0x%04x, expected 0x%04x\n",
2772
2773 *buffer = 0;
2774 ret = pLCIDToLocaleName(lcid, buffer, sizeof(buffer)/sizeof(WCHAR), 0);
2775 ok(ret > 0, "%s: got %d\n", wine_dbgstr_w(ptr->name), ret);
2776 ok(!lstrcmpW(ptr->sname, buffer), "%s: got wrong locale name %s\n",
2778
2779 ptr++;
2780 }
2781
2782 /* zh-Hant has LCID 0x7c04, but LocaleNameToLCID actually returns 0x0c04, which is the LCID of zh-HK */
2783 lcid = pLocaleNameToLCID(zhHantW, 0);
2785 "%s: got wrong lcid 0x%04x\n", wine_dbgstr_w(zhHantW), lcid);
2786 ret = pLCIDToLocaleName(lcid, buffer, sizeof(buffer)/sizeof(WCHAR), 0);
2787 ok(ret > 0, "%s: got %d\n", wine_dbgstr_w(zhHantW), ret);
2788 ok(!lstrcmpW(zhhkW, buffer), "%s: got wrong locale name %s\n",
2790 /* check that 0x7c04 also works and is mapped to zh-HK */
2792 todo_wine ok(ret > 0, "%s: got %d\n", wine_dbgstr_w(zhHantW), ret);
2793 ok(!lstrcmpW(zhhkW, buffer), "%s: got wrong locale name %s\n",
2795
2796 /* zh-hant */
2797 lcid = pLocaleNameToLCID(zhhantW, 0);
2799 "%s: got wrong lcid 0x%04x\n", wine_dbgstr_w(zhhantW), lcid);
2800 ret = pLCIDToLocaleName(lcid, buffer, sizeof(buffer)/sizeof(WCHAR), 0);
2801 ok(ret > 0, "%s: got %d\n", wine_dbgstr_w(zhhantW), ret);
2802 ok(!lstrcmpW(zhhkW, buffer), "%s: got wrong locale name %s\n",
2804
2805 /* zh-Hans has LCID 0x0004, but LocaleNameToLCID actually returns 0x0804, which is the LCID of zh-CN */
2806 lcid = pLocaleNameToLCID(zhHansW, 0);
2807 /* check that LocaleNameToLCID actually returns 0x0804 */
2809 "%s: got wrong lcid 0x%04x\n", wine_dbgstr_w(zhHansW), lcid);
2810 ret = pLCIDToLocaleName(lcid, buffer, sizeof(buffer)/sizeof(WCHAR), 0);
2811 ok(ret > 0, "%s: got %d\n", wine_dbgstr_w(zhHansW), ret);
2812 ok(!lstrcmpW(zhcnW, buffer), "%s: got wrong locale name %s\n",
2814 /* check that 0x0004 also works and is mapped to zh-CN */
2816 ok(ret > 0, "%s: got %d\n", wine_dbgstr_w(zhHansW), ret);
2817 ok(!lstrcmpW(zhcnW, buffer), "%s: got wrong locale name %s\n",
2819
2820 /* zh-hans */
2821 lcid = pLocaleNameToLCID(zhhansW, 0);
2823 "%s: got wrong lcid 0x%04x\n", wine_dbgstr_w(zhhansW), lcid);
2824 ret = pLCIDToLocaleName(lcid, buffer, sizeof(buffer)/sizeof(WCHAR), 0);
2825 ok(ret > 0, "%s: got %d\n", wine_dbgstr_w(zhhansW), ret);
2826 ok(!lstrcmpW(zhcnW, buffer), "%s: got wrong locale name %s\n",
2828 }
2829}
#define LOCALE_NAME_MAX_LENGTH
#define LANG_CHINESE_SIMPLIFIED
Definition: nls.h:43
#define LANG_SPANISH
Definition: nls.h:123
#define LANG_CHINESE_TRADITIONAL
Definition: nls.h:44
#define SUBLANG_CHINESE_TRADITIONAL
Definition: nls.h:208
#define SUBLANG_CHINESE_SIMPLIFIED
Definition: nls.h:209
#define SUBLANG_CHINESE_HONGKONG
Definition: nls.h:210
#define LANG_CHINESE
Definition: nls.h:42
#define SUBLANG_SPANISH_MODERN
Definition: nls.h:338

Referenced by START_TEST().

◆ test_SetLocaleInfoA()

static void test_SetLocaleInfoA ( void  )
static

Definition at line 3645 of file locale.c.

3646{
3647 BOOL bRet;
3648 LCID lcid = GetUserDefaultLCID();
3649
3650 /* Null data */
3651 SetLastError(0);
3652 bRet = SetLocaleInfoA(lcid, LOCALE_SDATE, 0);
3654 "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3655
3656 /* IDATE */
3657 SetLastError(0);
3658 bRet = SetLocaleInfoA(lcid, LOCALE_IDATE, "test_SetLocaleInfoA");
3659 ok(!bRet && GetLastError() == ERROR_INVALID_FLAGS,
3660 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
3661
3662 /* ILDATE */
3663 SetLastError(0);
3664 bRet = SetLocaleInfoA(lcid, LOCALE_ILDATE, "test_SetLocaleInfoA");
3665 ok(!bRet && GetLastError() == ERROR_INVALID_FLAGS,
3666 "Expected ERROR_INVALID_FLAGS, got %d\n", GetLastError());
3667}
BOOL WINAPI SetLocaleInfoA(LCID lcid, LCTYPE lctype, LPCSTR data)
Definition: lang.c:1329
#define LOCALE_SDATE
Definition: winnls.h:58
#define LOCALE_IDATE
Definition: winnls.h:63
#define LOCALE_ILDATE
Definition: winnls.h:64

Referenced by START_TEST().

◆ test_sorting()

static void test_sorting ( void  )
static

Definition at line 2923 of file locale.c.

2924{
2925 char buf[256];
2926 char **str_buf = (char **)buf;
2927 int i;
2928
2929 assert(sizeof(buf) >= sizeof(strings));
2930
2931 /* 1. sort using lstrcmpA */
2932 memcpy(buf, strings, sizeof(strings));
2933 qsort(buf, sizeof(strings)/sizeof(strings[0]), sizeof(strings[0]), compare_string1);
2934 for (i = 0; i < sizeof(strings)/sizeof(strings[0]); i++)
2935 {
2937 "qsort using lstrcmpA failed for element %d\n", i);
2938 }
2939 /* 2. sort using CompareStringA */
2940 memcpy(buf, strings, sizeof(strings));
2941 qsort(buf, sizeof(strings)/sizeof(strings[0]), sizeof(strings[0]), compare_string2);
2942 for (i = 0; i < sizeof(strings)/sizeof(strings[0]); i++)
2943 {
2945 "qsort using CompareStringA failed for element %d\n", i);
2946 }
2947 /* 3. sort using sort keys */
2948 memcpy(buf, strings, sizeof(strings));
2949 qsort(buf, sizeof(strings)/sizeof(strings[0]), sizeof(strings[0]), compare_string3);
2950 for (i = 0; i < sizeof(strings)/sizeof(strings[0]); i++)
2951 {
2953 "qsort using sort keys failed for element %d\n", i);
2954 }
2955}
#define assert(x)
Definition: debug.h:53
GLsizei const GLchar *const * strings
Definition: glext.h:7622
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static int compare_string1(const void *e1, const void *e2)
Definition: locale.c:2896
static const char *const strings[]
Definition: locale.c:2864
static int compare_string2(const void *e1, const void *e2)
Definition: locale.c:2904
static const char *const strings_sorted[]
Definition: locale.c:2832
static int compare_string3(const void *e1, const void *e2)
Definition: locale.c:2912
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
TCHAR str_buf[MAX_LOADSTRING]
Definition: sndrec32.cpp:60

Referenced by START_TEST().

◆ WCHAR()

static ULONG WCHAR ULONG *static ULONG WCHAR ULONG *static ULONG WCHAR ULONG *static WCHAR ( WINAPI pRtlUpcaseUnicodeChar)
static

Variable Documentation

◆ BOOL

Definition at line 95 of file locale.c.

◆ comparestringa_data

const struct comparestringa_entry comparestringa_data[]
static

Definition at line 1791 of file locale.c.

Referenced by test_CompareStringA().

◆ comparestringex_tests

const struct comparestringex_test comparestringex_tests[]
static

Definition at line 2023 of file locale.c.

Referenced by test_CompareStringEx().

◆ date_fmt_buf

char date_fmt_buf[1024]
static

Definition at line 3729 of file locale.c.

Referenced by enum_datetime_procA(), test_EnumDateFormatsA(), and test_EnumTimeFormatsA().

◆ date_fmt_bufW

WCHAR date_fmt_bufW[1024]
static

Definition at line 3730 of file locale.c.

Referenced by enum_datetime_procW(), and test_EnumTimeFormatsW().

◆ DWORD

Definition at line 78 of file locale.c.

◆ emptyW

const WCHAR emptyW[] = {0}
static

Definition at line 45 of file locale.c.

Referenced by test_GetDateFormatEx().

◆ enumCount

WORD enumCount
static

Definition at line 76 of file locale.c.

Referenced by luilocale_proc2A(), and test_EnumUILanguageA().

◆ fooW

◆ GEO_ENUMPROC

GEO_ENUMPROC

Definition at line 100 of file locale.c.

◆ GEOID

Definition at line 100 of file locale.c.

◆ geoidenum_count

int geoidenum_count
static

Definition at line 4726 of file locale.c.

Referenced by test_EnumSystemGeoID(), test_geoid_enumproc(), and test_geoid_enumproc2().

◆ GEOTYPE

Definition at line 98 of file locale.c.

◆ INT

INT

Definition at line 78 of file locale.c.

◆ int

Definition at line 105 of file locale.c.

◆ invalidW

const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0}
static

◆ invariant_list

const struct invariant_entry invariant_list[]
static

Definition at line 4800 of file locale.c.

Referenced by test_invariant().

◆ LANGID

Definition at line 98 of file locale.c.

◆ lcmap_invalid_flags

◆ LCTYPE

Definition at line 93 of file locale.c.

◆ LGRPID

Definition at line 81 of file locale.c.

◆ localeW

const WCHAR localeW[] = {'e','n','-','U','S',0}
static

Definition at line 43 of file locale.c.

Referenced by test_GetDateFormatEx(), and test_GetTimeFormatEx().

◆ LONG_PTR

Definition at line 80 of file locale.c.

◆ lower_case

const WCHAR lower_case[] = {'\t','j','u','s','t','!',' ','a',',',' ','t','e','s','t',';',' ','s','t','r','i','n','g',' ','1','/','*','+','-','.','\r','\n',0}
static

Definition at line 40 of file locale.c.

Referenced by test_lcmapstring_unicode(), test_LCMapStringA(), and test_LCMapStringEx().

◆ LPARAM

Definition at line 83 of file locale.c.

◆ LPCSTR

Definition at line 87 of file locale.c.

◆ LPCWSTR

Definition at line 78 of file locale.c.

◆ LPNLSVERSIONINFO

Definition at line 84 of file locale.c.

◆ LPSTR

Definition at line 87 of file locale.c.

◆ LPVOID

Definition at line 83 of file locale.c.

◆ LPWSTR

Definition at line 78 of file locale.c.

◆ neutralsublang_names

const struct neutralsublang_name_t neutralsublang_names[]
static
Initial value:
= {
{ {'a','r',0}, {'a','r','-','S','A',0}, MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_ARABIC_SAUDI_ARABIA), SORT_DEFAULT) },
{ {'a','z',0}, {'a','z','-','L','a','t','n','-','A','Z',0}, MAKELCID(MAKELANGID(LANG_AZERI, SUBLANG_AZERI_LATIN), SORT_DEFAULT) },
{ {'d','e',0}, {'d','e','-','D','E',0}, MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) },
{ {'e','n',0}, {'e','n','-','U','S',0}, MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) },
{ {'e','s',0}, {'e','s','-','E','S',0}, MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), SORT_DEFAULT) },
{ {'g','a',0}, {'g','a','-','I','E',0}, MAKELCID(MAKELANGID(LANG_IRISH, SUBLANG_IRISH_IRELAND), SORT_DEFAULT) },
{ {'i','t',0}, {'i','t','-','I','T',0}, MAKELCID(MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN), SORT_DEFAULT) },
{ {'m','s',0}, {'m','s','-','M','Y',0}, MAKELCID(MAKELANGID(LANG_MALAY, SUBLANG_MALAY_MALAYSIA), SORT_DEFAULT) },
{ {'n','l',0}, {'n','l','-','N','L',0}, MAKELCID(MAKELANGID(LANG_DUTCH, SUBLANG_DUTCH), SORT_DEFAULT) },
{ {'p','t',0}, {'p','t','-','B','R',0}, MAKELCID(MAKELANGID(LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN), SORT_DEFAULT) },
{ {'s','r',0}, {'s','r','-','L','a','t','n','-','R','S',0}, MAKELCID(MAKELANGID(LANG_SERBIAN, SUBLANG_SERBIAN_SERBIA_LATIN), SORT_DEFAULT), 1 },
{ {'s','v',0}, {'s','v','-','S','E',0}, MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) },
{ {'u','z',0}, {'u','z','-','L','a','t','n','-','U','Z',0}, MAKELCID(MAKELANGID(LANG_UZBEK, SUBLANG_UZBEK_LATIN), SORT_DEFAULT) },
{ {'z','h',0}, {'z','h','-','C','N',0}, MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT) },
{ {0} }
}
#define SUBLANG_SERBIAN_SERBIA_LATIN
#define SUBLANG_ITALIAN
Definition: nls.h:269
#define SUBLANG_DUTCH
Definition: nls.h:220
#define LANG_AZERI
Definition: nls.h:32
#define SUBLANG_PORTUGUESE_BRAZILIAN
Definition: nls.h:308
#define SUBLANG_ARABIC_SAUDI_ARABIA
Definition: nls.h:178
#define SUBLANG_SWEDISH
Definition: nls.h:358
#define SUBLANG_MALAY_MALAYSIA
Definition: nls.h:288
#define SUBLANG_GERMAN
Definition: nls.h:251
#define LANG_MALAY
Definition: nls.h:92
#define LANG_DUTCH
Definition: nls.h:51
#define LANG_SWEDISH
Definition: nls.h:125
#define LANG_SERBIAN
Definition: nls.h:116
#define LANG_UZBEK
Definition: nls.h:142
#define LANG_ITALIAN
Definition: nls.h:75
#define LANG_PORTUGUESE
Definition: nls.h:108
#define SUBLANG_IRISH_IRELAND
Definition: nls.h:268
#define SUBLANG_UZBEK_LATIN
Definition: nls.h:378
#define LANG_IRISH
Definition: nls.h:74
#define SUBLANG_AZERI_LATIN
Definition: nls.h:196

Definition at line 2683 of file locale.c.

Referenced by test_GetLocaleInfoEx(), and test_LocaleNameToLCID().

◆ neutralsublang_names2

const struct neutralsublang_name2_t neutralsublang_names2[]
static

Definition at line 246 of file locale.c.

Referenced by test_GetLocaleInfoW().

◆ strings

const char* const strings[]
static

Definition at line 2864 of file locale.c.

Referenced by test_sorting().

◆ strings_sorted

const char* const strings_sorted[]
static

Definition at line 2832 of file locale.c.

Referenced by test_sorting().

◆ symbols_stripped

const WCHAR symbols_stripped[] = {'j','u','s','t','a','t','e','s','t','s','t','r','i','n','g','1',0}
static

Definition at line 42 of file locale.c.

Referenced by test_lcmapstring_unicode(), and test_LCMapStringA().

◆ title_case

const WCHAR title_case[] = {'\t','J','u','s','t','!',' ','A',',',' ','T','e','s','t',';',' ','S','t','r','i','n','g',' ','1','/','*','+','-','.','\r','\n',0}
static

Definition at line 41 of file locale.c.

Referenced by test_lcmapstring_unicode().

◆ upper_case

const WCHAR upper_case[] = {'\t','J','U','S','T','!',' ','A',',',' ','T','E','S','T',';',' ','S','T','R','I','N','G',' ','1','/','*','+','-','.','\r','\n',0}
static