ReactOS 0.4.15-dev-5672-gf73ac17
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:2303

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:2051
#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:1289
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:2651
INT WINAPI FoldStringA(DWORD dwFlags, LPCSTR src, INT srclen, LPSTR dst, INT dstlen)
Definition: lang.c:2141
INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len, LANGID lang)
Definition: lang.c:3565
INT WINAPI FoldStringW(DWORD dwFlags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
Definition: lang.c:2199
INT WINAPI CompareStringEx(LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lParam)
Definition: lang.c:2232
BOOL WINAPI EnumUILanguagesA(UILANGUAGE_ENUMPROCA pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam)
Definition: lang.c:3455
BOOL WINAPI EnumSystemGeoID(GEOCLASS geoclass, GEOID parent, GEO_ENUMPROC enumproc)
Definition: lang.c:3287
BOOL WINAPI EnumLanguageGroupLocalesA(LANGGROUPLOCALE_ENUMPROCA pLangGrpLcEnumProc, LGRPID lgrpid, DWORD dwFlags, LONG_PTR lParam)
Definition: lang.c:3119
BOOL WINAPI EnumSystemLanguageGroupsA(LANGUAGEGROUP_ENUMPROCA pLangGrpEnumProc, DWORD dwFlags, LONG_PTR lParam)
Definition: lang.c:2603
INT WINAPI GetGeoInfoA(GEOID geoid, GEOTYPE geotype, LPSTR data, int data_len, LANGID lang)
Definition: lang.c:3639
BOOL WINAPI EnumSystemLocalesEx(LOCALE_ENUMPROCEX proc, DWORD flags, LPARAM lparam, LPVOID reserved)
Definition: lang.c:1648
INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lparam)
Definition: lang.c:1889
#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:1703
#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
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:2025
#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:1552
#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:1040
#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:142
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:2279
#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:1161
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:74
BOOL NTAPI VirtualProtect(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flNewProtect, OUT PDWORD lpflOldProtect)
Definition: virtmem.c:144
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:128
#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:772
LCID WINAPI GetSystemDefaultLCID(void)
Definition: lang.c:791
LCID WINAPI ConvertDefaultLocale(LCID lcid)
Definition: lang.c:1506
#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:1022
BOOL WINAPI EnumDateFormatsA(DATEFMT_ENUMPROCA proc, LCID lcid, DWORD flags)
Definition: lcformat.c:2003
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:2120
#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:1102
BOOL WINAPI EnumTimeFormatsW(TIMEFMT_ENUMPROCW proc, LCID lcid, DWORD flags)
Definition: lcformat.c:2143
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:1482
#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:922
#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:979

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:1453
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