2 * Japanese Calendar Testcase
4 * Copyright 2019 Katayama Hirofumi MZ
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #ifndef CAL_SABBREVERASTRING
24 #define CAL_SABBREVERASTRING 0x00000039
27 START_TEST(JapaneseCalendar
)
32 DWORD langid
= MAKELANGID(LANG_JAPANESE
, SUBLANG_DEFAULT
);
33 LCID lcid
= MAKELCID(langid
, SORT_DEFAULT
);
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"
49 trace("lcid: 0x%08lX\n", lcid
);
50 trace("langid: 0x%04lX\n", langid
);
52 ZeroMemory(&st
, sizeof(st
));
58 /* Standard Date Formatting */
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
);
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
);
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]);
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]);
93 /* Alternative Date Formatting (Wareki) */
95 DWORD dwFlags
= DATE_USE_ALT_CALENDAR
;
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
);
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
);
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]);
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]);
124 /* Japanese calendar-related locale info (MBCS) */
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
);
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);
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
);
143 type
= CAL_SABBREVERASTRING
;
144 ret
= GetCalendarInfoA(lcid
, CAL_JAPAN
, type
, szTextA
, ARRAYSIZE(szTextA
), NULL
);
146 ok(lstrcmpiA(szTextA
, "\x7F") == 0, "szTextA: %s\n", szTextA
);
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
);
157 type
= CAL_SERASTRING
;
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
);
164 type
= CAL_SLONGDATE
;
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
);
171 type
= CAL_SSHORTDATE
;
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
);
177 /* Japanese calendar-related locale info (Unicode) */
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
);
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);
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
);
196 type
= CAL_SABBREVERASTRING
;
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]);
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]);
216 type
= CAL_SERASTRING
;
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]);
224 type
= CAL_SLONGDATE
;
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");
231 type
= CAL_SSHORTDATE
;
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");