| 220 | |
| 221 | buffer.Truncate(0); |
| 222 | result = format.GetMonthName(1, buffer, B_LONG_DATE_FORMAT); |
| 223 | |
| 224 | CPPUNIT_ASSERT_EQUAL(BString("Jan"), buffer); |
| 225 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 226 | |
| 227 | buffer.Truncate(0); |
| 228 | result = format.GetMonthName(12, buffer, B_LONG_DATE_FORMAT); |
| 229 | |
| 230 | CPPUNIT_ASSERT_EQUAL(BString("Dec"), buffer); |
| 231 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 232 | |
| 233 | buffer.Truncate(0); |
| 234 | result = format.GetMonthName(1, buffer, B_SHORT_DATE_FORMAT); |
| 235 | |
| 236 | CPPUNIT_ASSERT_EQUAL(BString("J"), buffer); |
| 237 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 238 | |
| 239 | buffer.Truncate(0); |
| 240 | result = format.GetMonthName(12, buffer, B_SHORT_DATE_FORMAT); |
| 241 | |
| 242 | CPPUNIT_ASSERT_EQUAL(BString("D"), buffer); |
| 243 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 244 | |
| 248 | void |
| 249 | DateFormatTest::TestDayNames() |
| 250 | { |
| 251 | BLanguage language("en"); |
| 252 | BFormattingConventions formatting("en_US"); |
| 253 | BDateFormat format(language, formatting); |
| 254 | |
| 255 | BString buffer; |
| 256 | status_t result = format.GetDayName(1, buffer); |
| 257 | |
| 258 | CPPUNIT_ASSERT_EQUAL(BString("Sunday"), buffer); |
| 259 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 260 | |
| 261 | buffer.Truncate(0); |
| 262 | result = format.GetDayName(2, buffer); |
| 263 | |
| 264 | CPPUNIT_ASSERT_EQUAL(BString("Monday"), buffer); |
| 265 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 266 | |
| 267 | buffer.Truncate(0); |
| 268 | result = format.GetDayName(1, buffer, B_LONG_DATE_FORMAT); |
| 269 | |
| 270 | CPPUNIT_ASSERT_EQUAL(BString("Sun"), buffer); |
| 271 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 272 | |
| 273 | buffer.Truncate(0); |
| 274 | result = format.GetDayName(2, buffer, B_LONG_DATE_FORMAT); |
| 275 | |
| 276 | CPPUNIT_ASSERT_EQUAL(BString("Mon"), buffer); |
| 277 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 278 | |
| 279 | buffer.Truncate(0); |
| 280 | result = format.GetDayName(1, buffer, B_MEDIUM_DATE_FORMAT); |
| 281 | |
| 282 | CPPUNIT_ASSERT_EQUAL(BString("Su"), buffer); |
| 283 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 284 | |
| 285 | buffer.Truncate(0); |
| 286 | result = format.GetDayName(2, buffer, B_MEDIUM_DATE_FORMAT); |
| 287 | |
| 288 | CPPUNIT_ASSERT_EQUAL(BString("Mo"), buffer); |
| 289 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 290 | |
| 291 | buffer.Truncate(0); |
| 292 | result = format.GetDayName(1, buffer, B_SHORT_DATE_FORMAT); |
| 293 | |
| 294 | CPPUNIT_ASSERT_EQUAL(BString("S"), buffer); |
| 295 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 296 | |
| 297 | buffer.Truncate(0); |
| 298 | result = format.GetDayName(2, buffer, B_SHORT_DATE_FORMAT); |
| 299 | |
| 300 | CPPUNIT_ASSERT_EQUAL(BString("M"), buffer); |
| 301 | CPPUNIT_ASSERT_EQUAL(B_OK, result); |
| 302 | } |
| 303 | |
| 304 | |
| 305 | |