| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); | 125 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); |
| 126 return locale->weekDayShortLabels()[index]; | 126 return locale->weekDayShortLabels()[index]; |
| 127 } | 127 } |
| 128 | 128 |
| 129 bool isRTL(const String& localeString) | 129 bool isRTL(const String& localeString) |
| 130 { | 130 { |
| 131 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); | 131 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); |
| 132 return locale->isRTL(); | 132 return locale->isRTL(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | |
| 136 String monthFormat(const String& localeString) | 135 String monthFormat(const String& localeString) |
| 137 { | 136 { |
| 138 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); | 137 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); |
| 139 return locale->monthFormat(); | 138 return locale->monthFormat(); |
| 140 } | 139 } |
| 141 | 140 |
| 142 String timeFormat(const String& localeString) | 141 String timeFormat(const String& localeString) |
| 143 { | 142 { |
| 144 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); | 143 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); |
| 145 return locale->timeFormat(); | 144 return locale->timeFormat(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 173 { | 172 { |
| 174 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); | 173 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); |
| 175 return locale->timeAMPMLabels()[index]; | 174 return locale->timeAMPMLabels()[index]; |
| 176 } | 175 } |
| 177 | 176 |
| 178 String decimalSeparator(const String& localeString) | 177 String decimalSeparator(const String& localeString) |
| 179 { | 178 { |
| 180 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); | 179 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); |
| 181 return locale->localizedDecimalSeparator(); | 180 return locale->localizedDecimalSeparator(); |
| 182 } | 181 } |
| 183 #endif | |
| 184 }; | 182 }; |
| 185 | 183 |
| 186 TEST_F(LocaleMacTest, formatWeek) | 184 TEST_F(LocaleMacTest, formatWeek) |
| 187 { | 185 { |
| 188 LocalePlatformSupport support; | 186 LocalePlatformSupport support; |
| 189 EXPECT_STREQ("Week 04, 2005", formatWeek("en_US", "2005-W04").utf8().data())
; | 187 EXPECT_STREQ("Week 04, 2005", formatWeek("en_US", "2005-W04").utf8().data())
; |
| 190 EXPECT_STREQ("Week 52, 2005", formatWeek("en_US", "2005-W52").utf8().data())
; | 188 EXPECT_STREQ("Week 52, 2005", formatWeek("en_US", "2005-W52").utf8().data())
; |
| 191 } | 189 } |
| 192 | 190 |
| 193 TEST_F(LocaleMacTest, formatMonth) | 191 TEST_F(LocaleMacTest, formatMonth) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 } | 265 } |
| 268 | 266 |
| 269 TEST_F(LocaleMacTest, isRTL) | 267 TEST_F(LocaleMacTest, isRTL) |
| 270 { | 268 { |
| 271 EXPECT_TRUE(isRTL("ar-eg")); | 269 EXPECT_TRUE(isRTL("ar-eg")); |
| 272 EXPECT_FALSE(isRTL("en-us")); | 270 EXPECT_FALSE(isRTL("en-us")); |
| 273 EXPECT_FALSE(isRTL("ja-jp")); | 271 EXPECT_FALSE(isRTL("ja-jp")); |
| 274 EXPECT_FALSE(isRTL("**invalid**")); | 272 EXPECT_FALSE(isRTL("**invalid**")); |
| 275 } | 273 } |
| 276 | 274 |
| 277 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | |
| 278 TEST_F(LocaleMacTest, monthFormat) | 275 TEST_F(LocaleMacTest, monthFormat) |
| 279 { | 276 { |
| 280 EXPECT_STREQ("MMMM yyyy", monthFormat("en_US").utf8().data()); | 277 EXPECT_STREQ("MMMM yyyy", monthFormat("en_US").utf8().data()); |
| 281 EXPECT_STREQ("yyyy\xE5\xB9\xB4M\xE6\x9C\x88", monthFormat("ja_JP").utf8().da
ta()); | 278 EXPECT_STREQ("yyyy\xE5\xB9\xB4M\xE6\x9C\x88", monthFormat("ja_JP").utf8().da
ta()); |
| 282 | 279 |
| 283 // fr_FR and ru return different results on OS versions. | 280 // fr_FR and ru return different results on OS versions. |
| 284 // "MMM yyyy" "LLL yyyy" on 10.6 and 10.7 | 281 // "MMM yyyy" "LLL yyyy" on 10.6 and 10.7 |
| 285 // "MMM y" "LLL y" on 10.8 | 282 // "MMM y" "LLL y" on 10.8 |
| 286 } | 283 } |
| 287 | 284 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 345 |
| 349 EXPECT_STREQ("\xE5\x8D\x88\xE5\x89\x8D", timeAMPMLabel("ja_JP", 0).utf8().da
ta()); | 346 EXPECT_STREQ("\xE5\x8D\x88\xE5\x89\x8D", timeAMPMLabel("ja_JP", 0).utf8().da
ta()); |
| 350 EXPECT_STREQ("\xE5\x8D\x88\xE5\xBE\x8C", timeAMPMLabel("ja_JP", 1).utf8().da
ta()); | 347 EXPECT_STREQ("\xE5\x8D\x88\xE5\xBE\x8C", timeAMPMLabel("ja_JP", 1).utf8().da
ta()); |
| 351 } | 348 } |
| 352 | 349 |
| 353 TEST_F(LocaleMacTest, decimalSeparator) | 350 TEST_F(LocaleMacTest, decimalSeparator) |
| 354 { | 351 { |
| 355 EXPECT_STREQ(".", decimalSeparator("en_US").utf8().data()); | 352 EXPECT_STREQ(".", decimalSeparator("en_US").utf8().data()); |
| 356 EXPECT_STREQ(",", decimalSeparator("fr_FR").utf8().data()); | 353 EXPECT_STREQ(",", decimalSeparator("fr_FR").utf8().data()); |
| 357 } | 354 } |
| 358 #endif | |
| 359 | 355 |
| 360 TEST_F(LocaleMacTest, invalidLocale) | 356 TEST_F(LocaleMacTest, invalidLocale) |
| 361 { | 357 { |
| 362 EXPECT_STREQ(monthLabel("en_US", January).utf8().data(), monthLabel("foo", J
anuary).utf8().data()); | 358 EXPECT_STREQ(monthLabel("en_US", January).utf8().data(), monthLabel("foo", J
anuary).utf8().data()); |
| 363 EXPECT_STREQ(decimalSeparator("en_US").utf8().data(), decimalSeparator("foo"
).utf8().data()); | 359 EXPECT_STREQ(decimalSeparator("en_US").utf8().data(), decimalSeparator("foo"
).utf8().data()); |
| 364 } | 360 } |
| 365 | 361 |
| 366 static void testNumberIsReversible(const AtomicString& localeString, const char*
original, const char* shouldHave = 0) | 362 static void testNumberIsReversible(const AtomicString& localeString, const char*
original, const char* shouldHave = 0) |
| 367 { | 363 { |
| 368 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); | 364 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 391 testNumbers("es_ES"); | 387 testNumbers("es_ES"); |
| 392 testNumbers("fa"); | 388 testNumbers("fa"); |
| 393 testNumbers("ja_JP"); | 389 testNumbers("ja_JP"); |
| 394 testNumbers("ko_KR"); | 390 testNumbers("ko_KR"); |
| 395 testNumbers("zh_CN"); | 391 testNumbers("zh_CN"); |
| 396 testNumbers("zh_HK"); | 392 testNumbers("zh_HK"); |
| 397 testNumbers("zh_TW"); | 393 testNumbers("zh_TW"); |
| 398 } | 394 } |
| 399 | 395 |
| 400 } // namespace blink | 396 } // namespace blink |
| OLD | NEW |