| 220 | |
| 221 | buffer.Truncate(0); |
| 222 | result = format.GetMonthName(1, buffer, B_FULL_DATE_FORMAT); |
| 223 | |
| 224 | CPPUNIT_ASSERT_EQUAL(BString("January"), buffer); |
| 225 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 226 | |
| 227 | buffer.Truncate(0); |
| 228 | result = format.GetMonthName(12, buffer, B_FULL_DATE_FORMAT); |
| 229 | |
| 230 | CPPUNIT_ASSERT_EQUAL(BString("December"), buffer); |
| 231 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 232 | |
| 233 | buffer.Truncate(0); |
| 234 | result = format.GetMonthName(1, buffer, B_LONG_DATE_FORMAT); |
| 235 | |
| 236 | CPPUNIT_ASSERT_EQUAL(BString("Jan"), buffer); |
| 237 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 238 | |
| 239 | buffer.Truncate(0); |
| 240 | result = format.GetMonthName(12, buffer, B_LONG_DATE_FORMAT); |
| 241 | |
| 242 | CPPUNIT_ASSERT_EQUAL(BString("Dec"), buffer); |
| 243 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 244 | |
| 245 | buffer.Truncate(0); |
| 246 | result = format.GetMonthName(1, buffer, B_MEDIUM_DATE_FORMAT); |
| 247 | |
| 248 | CPPUNIT_ASSERT_EQUAL(BString("Jan"), buffer); |
| 249 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 250 | |
| 251 | buffer.Truncate(0); |
| 252 | result = format.GetMonthName(12, buffer, B_MEDIUM_DATE_FORMAT); |
| 253 | |
| 254 | CPPUNIT_ASSERT_EQUAL(BString("Dec"), buffer); |
| 255 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 256 | |
| 257 | buffer.Truncate(0); |
| 258 | result = format.GetMonthName(1, buffer, B_SHORT_DATE_FORMAT); |
| 259 | |
| 260 | CPPUNIT_ASSERT_EQUAL(BString("J"), buffer); |
| 261 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 262 | |
| 263 | buffer.Truncate(0); |
| 264 | result = format.GetMonthName(12, buffer, B_SHORT_DATE_FORMAT); |
| 265 | |
| 266 | CPPUNIT_ASSERT_EQUAL(BString("D"), buffer); |
| 267 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 268 | |
| 269 | } |
| 270 | |
| 271 | |
| 272 | void |
| 273 | DateFormatTest::TestDayNames() |
| 274 | { |
| 275 | BLanguage language("en"); |
| 276 | BFormattingConventions formatting("en_US"); |
| 277 | BDateFormat format(language, formatting); |
| 278 | |
| 279 | BString buffer; |
| 280 | status_t result = format.GetDayName(1, buffer); |
| 281 | |
| 282 | CPPUNIT_ASSERT_EQUAL(BString("Sunday"), buffer); |
| 283 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 284 | |
| 285 | buffer.Truncate(0); |
| 286 | result = format.GetDayName(2, buffer); |
| 287 | |
| 288 | CPPUNIT_ASSERT_EQUAL(BString("Monday"), buffer); |
| 289 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 290 | |
| 291 | buffer.Truncate(0); |
| 292 | result = format.GetDayName(1, buffer, B_FULL_DATE_FORMAT); |
| 293 | |
| 294 | CPPUNIT_ASSERT_EQUAL(BString("Sunday"), buffer); |
| 295 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 296 | |
| 297 | buffer.Truncate(0); |
| 298 | result = format.GetDayName(2, buffer, B_FULL_DATE_FORMAT); |
| 299 | |
| 300 | CPPUNIT_ASSERT_EQUAL(BString("Monday"), buffer); |
| 301 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 302 | |
| 303 | buffer.Truncate(0); |
| 304 | result = format.GetDayName(1, buffer, B_LONG_DATE_FORMAT); |
| 305 | |
| 306 | CPPUNIT_ASSERT_EQUAL(BString("Sun"), buffer); |
| 307 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 308 | |
| 309 | buffer.Truncate(0); |
| 310 | result = format.GetDayName(2, buffer, B_LONG_DATE_FORMAT); |
| 311 | |
| 312 | CPPUNIT_ASSERT_EQUAL(BString("Mon"), buffer); |
| 313 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 314 | |
| 315 | buffer.Truncate(0); |
| 316 | result = format.GetDayName(1, buffer, B_MEDIUM_DATE_FORMAT); |
| 317 | |
| 318 | CPPUNIT_ASSERT_EQUAL(BString("Su"), buffer); |
| 319 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 320 | |
| 321 | buffer.Truncate(0); |
| 322 | result = format.GetDayName(2, buffer, B_MEDIUM_DATE_FORMAT); |
| 323 | |
| 324 | CPPUNIT_ASSERT_EQUAL(BString("Mo"), buffer); |
| 325 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 326 | |
| 327 | buffer.Truncate(0); |
| 328 | result = format.GetDayName(1, buffer, B_SHORT_DATE_FORMAT); |
| 329 | |
| 330 | CPPUNIT_ASSERT_EQUAL(BString("S"), buffer); |
| 331 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 332 | |
| 333 | buffer.Truncate(0); |
| 334 | result = format.GetDayName(2, buffer, B_SHORT_DATE_FORMAT); |
| 335 | |
| 336 | CPPUNIT_ASSERT_EQUAL(BString("M"), buffer); |
| 337 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |