| 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 13 matching lines...) Expand all Loading... |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "platform/text/LocaleMac.h" | 26 #include "platform/text/LocaleMac.h" |
| 27 | 27 |
| 28 #include "platform/DateComponents.h" | 28 #include "platform/DateComponents.h" |
| 29 #include "platform/testing/TestingPlatformSupport.h" | 29 #include "platform/testing/TestingPlatformSupport.h" |
| 30 #include "public/platform/Platform.h" | 30 #include "public/platform/Platform.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
| 32 #include "wtf/DateMath.h" | 32 #include "wtf/DateMath.h" |
| 33 #include "wtf/MathExtras.h" | 33 #include "wtf/MathExtras.h" |
| 34 #include "wtf/PtrUtil.h" |
| 34 #include "wtf/text/CString.h" | 35 #include "wtf/text/CString.h" |
| 35 #include <memory> | 36 #include <memory> |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 | 39 |
| 39 class LocalePlatformSupport : public TestingPlatformSupport { | 40 class LocalePlatformSupport : public TestingPlatformSupport { |
| 40 public: | 41 public: |
| 41 WebString queryLocalizedString(WebLocalizedString::Name /*name*/) override { | 42 WebString queryLocalizedString(WebLocalizedString::Name /*name*/) override { |
| 42 return WebString::fromUTF8("Week $2, $1"); | 43 return WebString::fromUTF8("Week $2, $1"); |
| 43 } | 44 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 return locale->timeAMPMLabels()[index]; | 183 return locale->timeAMPMLabels()[index]; |
| 183 } | 184 } |
| 184 | 185 |
| 185 String decimalSeparator(const String& localeString) { | 186 String decimalSeparator(const String& localeString) { |
| 186 std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); | 187 std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); |
| 187 return locale->localizedDecimalSeparator(); | 188 return locale->localizedDecimalSeparator(); |
| 188 } | 189 } |
| 189 }; | 190 }; |
| 190 | 191 |
| 191 TEST_F(LocaleMacTest, formatWeek) { | 192 TEST_F(LocaleMacTest, formatWeek) { |
| 192 LocalePlatformSupport support; | 193 ScopedTestingPlatformSupport<LocalePlatformSupport> support( |
| 194 WTFL::makeUnique<LocalePlatformSupport>()); |
| 193 EXPECT_STREQ("Week 04, 2005", formatWeek("en_US", "2005-W04").utf8().data()); | 195 EXPECT_STREQ("Week 04, 2005", formatWeek("en_US", "2005-W04").utf8().data()); |
| 194 EXPECT_STREQ("Week 52, 2005", formatWeek("en_US", "2005-W52").utf8().data()); | 196 EXPECT_STREQ("Week 52, 2005", formatWeek("en_US", "2005-W52").utf8().data()); |
| 195 } | 197 } |
| 196 | 198 |
| 197 TEST_F(LocaleMacTest, formatMonth) { | 199 TEST_F(LocaleMacTest, formatMonth) { |
| 198 EXPECT_STREQ("April 2005", | 200 EXPECT_STREQ("April 2005", |
| 199 formatMonth("en_US", "2005-04", false).utf8().data()); | 201 formatMonth("en_US", "2005-04", false).utf8().data()); |
| 200 EXPECT_STREQ("avril 2005", | 202 EXPECT_STREQ("avril 2005", |
| 201 formatMonth("fr_FR", "2005-04", false).utf8().data()); | 203 formatMonth("fr_FR", "2005-04", false).utf8().data()); |
| 202 EXPECT_STREQ( | 204 EXPECT_STREQ( |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 testNumbers("es_ES"); | 438 testNumbers("es_ES"); |
| 437 testNumbers("fa"); | 439 testNumbers("fa"); |
| 438 testNumbers("ja_JP"); | 440 testNumbers("ja_JP"); |
| 439 testNumbers("ko_KR"); | 441 testNumbers("ko_KR"); |
| 440 testNumbers("zh_CN"); | 442 testNumbers("zh_CN"); |
| 441 testNumbers("zh_HK"); | 443 testNumbers("zh_HK"); |
| 442 testNumbers("zh_TW"); | 444 testNumbers("zh_TW"); |
| 443 } | 445 } |
| 444 | 446 |
| 445 } // namespace blink | 447 } // namespace blink |
| OLD | NEW |