ReactOS 0.4.16-dev-91-g764881a
JapaneseCalendar.c File Reference
#include "precomp.h"
Include dependency graph for JapaneseCalendar.c:

Go to the source code of this file.

Macros

#define CAL_SABBREVERASTRING   0x00000039
 

Functions

 START_TEST (JapaneseCalendar)
 

Macro Definition Documentation

◆ CAL_SABBREVERASTRING

#define CAL_SABBREVERASTRING   0x00000039

Definition at line 24 of file JapaneseCalendar.c.

Function Documentation

◆ START_TEST()

START_TEST ( JapaneseCalendar  )

Definition at line 27 of file JapaneseCalendar.c.

28{
29 CHAR szTextA[64];
30 WCHAR szTextW[64];
31 SYSTEMTIME st;
34 DWORD dwValue;
36 int ret;
37 static const WCHAR s_szSeireki19[] = {0x897F, 0x66A6, '1', '9', 0}; // L"\u897F\u66A6" L"19"
38 static const WCHAR s_szHeisei[] = {0x5E73, 0x6210, 0}; // L"\u5E73\u6210"
39 static const WCHAR s_szHeisei31[] = {0x5E73, 0x6210, '3', '1', 0}; // L"\u5E73\u6210" L"31"
40 static const WCHAR s_szReiwa[] = {0x4EE4, 0x548C, 0}; // L"\u4EE4\u548C"
41 static const WCHAR s_szOneCharHeisei1[] = {0x337B, 0}; // L"\u337B"
42 static const WCHAR s_szOneCharHeisei2[] = {0x5E73, 0}; // L"\u5E73"
43 static const WCHAR s_szOneCharReiwa1[] = {0x32FF, 0}; // L"\u32FF"
44 static const WCHAR s_szOneCharReiwa2[] = {0x4EE4, 0}; // L"\u4EE4"
45 static const WCHAR s_szOneCharReiwa3[] = {0xF9A8, 0}; // L"\uF9A8"
46 static const WCHAR s_szWareki[] = {0x548C, 0x66A6, 0}; // L"\u548C\u66A6"
47 static const WCHAR s_szNen[] = {0x5E74, 0}; // L"\u5E74"
48
49 trace("lcid: 0x%08lX\n", lcid);
50 trace("langid: 0x%04lX\n", langid);
51
52 ZeroMemory(&st, sizeof(st));
53 st.wYear = 2019;
54 st.wMonth = 4;
55 st.wDayOfWeek = 4;
56 st.wDay = 4;
57
58 /* Standard Date Formatting */
59 {
60 DWORD dwFlags = 0;
61
62 szTextA[0] = 0x7F;
63 szTextA[1] = 0;
64 ret = GetDateFormatA(lcid, dwFlags, &st, "gyy", szTextA, ARRAYSIZE(szTextA));
65 ok(ret != 0, "ret: %d\n", ret);
66 ok(/* WinXP */ lstrcmpiA(szTextA, "19") == 0 ||
67 /* Win10 */ lstrcmpiA(szTextA, "\x90\xBC\x97\xEF" "19") == 0, "szTextA: %s\n", szTextA);
68
69 szTextA[0] = 0x7F;
70 szTextA[1] = 0;
71 ret = GetDateFormatA(lcid, dwFlags, &st, "ggyy", szTextA, ARRAYSIZE(szTextA));
72 ok(ret != 0, "ret: %d\n", ret);
73 ok(/* WinXP */ lstrcmpiA(szTextA, "19") == 0 ||
74 /* Win10 */ lstrcmpiA(szTextA, "\x90\xBC\x97\xEF" "19") == 0, "szTextA: %s\n", szTextA);
75
76 szTextW[0] = 0x7F;
77 szTextW[1] = 0;
78 ret = GetDateFormatW(lcid, dwFlags, &st, L"gyy", szTextW, ARRAYSIZE(szTextW));
79 ok(ret != 0, "ret: %d\n", ret);
80 ok(/* WinXP */ lstrcmpiW(szTextW, L"19") == 0 ||
81 /* Win10 */ lstrcmpiW(szTextW, s_szSeireki19) == 0,
82 "szTextW: %04X %04X %04X\n", szTextW[0], szTextW[1], szTextW[2]);
83
84 szTextW[0] = 0x7F;
85 szTextW[1] = 0;
86 ret = GetDateFormatW(lcid, dwFlags, &st, L"ggyy", szTextW, ARRAYSIZE(szTextW));
87 ok(ret != 0, "ret: %d\n", ret);
88 ok(/* WinXP */ lstrcmpiW(szTextW, L"19") == 0 ||
89 /* Win10 */ lstrcmpiW(szTextW, s_szSeireki19) == 0,
90 "szTextW: %04X %04X %04X\n", szTextW[0], szTextW[1], szTextW[2]);
91 }
92
93 /* Alternative Date Formatting (Wareki) */
94 {
96
97 szTextA[0] = 0x7F;
98 szTextA[1] = 0;
99 ret = GetDateFormatA(lcid, dwFlags, &st, "gyy", szTextA, ARRAYSIZE(szTextA));
100 ok(ret != 0, "ret: %d\n", ret);
101 ok(lstrcmpiA(szTextA, "\x95\xBD\x90\xAC" "31") == 0, "szTextA: %s\n", szTextA);
102
103 szTextA[0] = 0x7F;
104 szTextA[1] = 0;
105 ret = GetDateFormatA(lcid, dwFlags, &st, "ggyy", szTextA, ARRAYSIZE(szTextA));
106 ok(ret != 0, "ret: %d\n", ret);
107 ok(lstrcmpiA(szTextA, "\x95\xBD\x90\xAC" "31") == 0, "szTextA: %s\n", szTextA);
108
109 szTextW[0] = 0x7F;
110 szTextW[1] = 0;
111 ret = GetDateFormatW(lcid, dwFlags, &st, L"gyy", szTextW, ARRAYSIZE(szTextW));
112 ok(ret != 0, "ret: %d\n", ret);
113 ok(lstrcmpiW(szTextW, s_szHeisei31) == 0,
114 "szTextW: %04X %04X %04X\n", szTextW[0], szTextW[1], szTextW[2]);
115
116 szTextW[0] = 0x7F;
117 szTextW[1] = 0;
118 ret = GetDateFormatW(lcid, dwFlags, &st, L"ggyy", szTextW, ARRAYSIZE(szTextW));
119 ok(ret != 0, "ret: %d\n", ret);
120 ok(lstrcmpiW(szTextW, s_szHeisei31) == 0,
121 "szTextW: %04X %04X %04X\n", szTextW[0], szTextW[1], szTextW[2]);
122 }
123
124 /* Japanese calendar-related locale info (MBCS) */
125 {
126 type = CAL_ICALINTVALUE | CAL_RETURN_NUMBER;
127 ret = GetCalendarInfoA(lcid, CAL_JAPAN, type, NULL, 0, &dwValue);
128 ok(ret != 0, "ret: %d\n", ret);
129 ok_long(dwValue, 3);
130
131 type = CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER;
132 ret = GetCalendarInfoA(lcid, CAL_JAPAN, type, NULL, 0, &dwValue);
133 ok(ret != 0, "ret: %d\n", ret);
134 ok_long(dwValue, 99);
135
136 type = CAL_IYEAROFFSETRANGE | CAL_RETURN_NUMBER;
137 ret = GetCalendarInfoA(lcid, CAL_JAPAN, type, NULL, 0, &dwValue);
138 ok(ret != 0, "ret: %d\n", ret);
139 ok(dwValue == 1989 || dwValue == 2019, "dwValue was %ld\n", dwValue);
140
141 szTextA[0] = 0x7F;
142 szTextA[1] = 0;
144 ret = GetCalendarInfoA(lcid, CAL_JAPAN, type, szTextA, ARRAYSIZE(szTextA), NULL);
145 ok_int(ret, FALSE);
146 ok(lstrcmpiA(szTextA, "\x7F") == 0, "szTextA: %s\n", szTextA);
147
148 szTextA[0] = 0x7F;
149 szTextA[1] = 0;
151 ret = GetCalendarInfoA(lcid, CAL_JAPAN, type, szTextA, ARRAYSIZE(szTextA), NULL);
152 ok(ret != 0, "ret: %d\n", ret);
153 ok(lstrcmpiA(szTextA, "\x98\x61\x97\xEF") == 0, "szTextA: %s\n", szTextA);
154
155 szTextA[0] = 0x7F;
156 szTextA[1] = 0;
158 ret = GetCalendarInfoA(lcid, CAL_JAPAN, type, szTextA, ARRAYSIZE(szTextA), NULL);
159 ok(ret != 0, "ret: %d\n", ret);
160 ok(lstrcmpiA(szTextA, "\x95\xBD\x90\xAC") == 0, "szTextA: %s\n", szTextA);
161
162 szTextA[0] = 0x7F;
163 szTextA[1] = 0;
165 ret = GetCalendarInfoA(lcid, CAL_JAPAN, type, szTextA, ARRAYSIZE(szTextA), NULL);
166 ok(ret != 0, "ret: %d\n", ret);
167 ok(strstr(szTextA, "\x94\x4E") != NULL, "szTextA: %s\n", szTextA);
168
169 szTextA[0] = 0x7F;
170 szTextA[1] = 0;
172 ret = GetCalendarInfoA(lcid, CAL_JAPAN, type, szTextA, ARRAYSIZE(szTextA), NULL);
173 ok(ret != 0, "ret: %d\n", ret);
174 ok(strstr(szTextA, "/") != NULL, "szTextA: %s\n", szTextA);
175 }
176
177 /* Japanese calendar-related locale info (Unicode) */
178 {
179 type = CAL_ICALINTVALUE | CAL_RETURN_NUMBER;
180 ret = GetCalendarInfoW(lcid, CAL_JAPAN, type, NULL, 0, &dwValue);
181 ok(ret != 0, "ret: %d\n", ret);
182 ok_long(dwValue, 3);
183
184 type = CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER;
185 ret = GetCalendarInfoW(lcid, CAL_JAPAN, type, NULL, 0, &dwValue);
186 ok(ret != 0, "ret: %d\n", ret);
187 ok_long(dwValue, 99);
188
189 type = CAL_IYEAROFFSETRANGE | CAL_RETURN_NUMBER;
190 ret = GetCalendarInfoW(lcid, CAL_JAPAN, type, NULL, 0, &dwValue);
191 ok(ret != 0, "ret: %d\n", ret);
192 ok(dwValue == 1989 || dwValue == 2019, "dwValue was %ld\n", dwValue);
193
194 szTextW[0] = 0x7F;
195 szTextW[1] = 0;
197 ret = GetCalendarInfoW(lcid, CAL_JAPAN, type, szTextW, ARRAYSIZE(szTextW), NULL);
198 ok(/* WinXP */ ret == 0 || /* Win10 */ ret != 0, "ret: %d\n", ret);
199 ok(/* WinXP */ (szTextW[0] == 0x7F && szTextW[1] == 0) ||
200 /* Win10? */ lstrcmpiW(szTextW, s_szOneCharHeisei1) == 0 ||
201 /* Win10? */ lstrcmpiW(szTextW, s_szOneCharHeisei2) == 0 ||
202 /* Win10? */ lstrcmpiW(szTextW, s_szOneCharReiwa1) == 0 ||
203 /* Win10? */ lstrcmpiW(szTextW, s_szOneCharReiwa2) == 0 ||
204 /* Win10? */ lstrcmpiW(szTextW, s_szOneCharReiwa3) == 0,
205 "szTextW: %04X %04X %04X\n", szTextW[0], szTextW[1], szTextW[2]);
206
207 szTextW[0] = 0x7F;
208 szTextW[1] = 0;
210 ret = GetCalendarInfoW(lcid, CAL_JAPAN, type, szTextW, ARRAYSIZE(szTextW), NULL);
211 ok(ret != 0, "ret: %d\n", ret);
212 ok(lstrcmpiW(szTextW, s_szWareki) == 0, "szTextW: %04X %04X %04X\n", szTextW[0], szTextW[1], szTextW[2]);
213
214 szTextW[0] = 0x7F;
215 szTextW[1] = 0;
217 ret = GetCalendarInfoW(lcid, CAL_JAPAN, type, szTextW, ARRAYSIZE(szTextW), NULL);
218 ok(ret != 0, "ret: %d\n", ret);
219 ok(wcsstr(szTextW, s_szHeisei) != NULL ||
220 wcsstr(szTextW, s_szReiwa) != NULL, "szTextW: %04X %04X %04X\n", szTextW[0], szTextW[1], szTextW[2]);
221
222 szTextW[0] = 0x7F;
223 szTextW[1] = 0;
225 ret = GetCalendarInfoW(lcid, CAL_JAPAN, type, szTextW, ARRAYSIZE(szTextW), NULL);
226 ok(ret != 0, "ret: %d\n", ret);
227 ok(wcsstr(szTextW, s_szNen) != NULL, "\n");
228
229 szTextW[0] = 0x7F;
230 szTextW[1] = 0;
232 ret = GetCalendarInfoW(lcid, CAL_JAPAN, type, szTextW, ARRAYSIZE(szTextW), NULL);
233 ok(ret != 0, "ret: %d\n", ret);
234 ok(wcsstr(szTextW, L"/") != NULL, "\n");
235 }
236}
#define CAL_SABBREVERASTRING
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define ok_long(expression, result)
Definition: atltest.h:133
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define ok_int(expression, result)
Definition: atltest.h:134
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4261
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4223
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
int WINAPI GetCalendarInfoA(LCID lcid, CALID Calendar, CALTYPE CalType, LPSTR lpCalData, int cchData, LPDWORD lpValue)
Definition: lcformat.c:2444
INT WINAPI GetDateFormatA(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCSTR lpFormat, LPSTR lpDateStr, INT cchOut)
Definition: lcformat.c:936
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:993
int WINAPI GetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType, LPWSTR lpCalData, int cchData, LPDWORD lpValue)
Definition: lcformat.c:2499
LANGID langid
Definition: msctf.idl:644
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
#define L(x)
Definition: ntvdm.h:50
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_DEFAULT
Definition: nls.h:168
DWORD LCID
Definition: nls.h:13
#define LANG_JAPANESE
Definition: nls.h:76
WORD wYear
Definition: winbase.h:905
WORD wMonth
Definition: winbase.h:906
WORD wDay
Definition: winbase.h:908
WORD wDayOfWeek
Definition: winbase.h:907
int ret
#define ZeroMemory
Definition: winbase.h:1712
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define CAL_SCALNAME
Definition: winnls.h:398
#define CAL_SERASTRING
Definition: winnls.h:400
#define CAL_ICALINTVALUE
Definition: winnls.h:397
DWORD CALTYPE
Definition: winnls.h:518
#define CAL_JAPAN
Definition: winnls.h:445
#define CAL_SSHORTDATE
Definition: winnls.h:401
#define CAL_SLONGDATE
Definition: winnls.h:402
#define DATE_USE_ALT_CALENDAR
Definition: winnls.h:198
#define CAL_IYEAROFFSETRANGE
Definition: winnls.h:399
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175