- Revision
- 125141
- Author
- [email protected]
- Date
- 2012-08-08 19:26:01 -0700 (Wed, 08 Aug 2012)
Log Message
[Chromium-mac] Switch to LocalizedNumberMac from LocalizedNumberICU
https://bugs.webkit.org/show_bug.cgi?id=93432
Reviewed by Hajime Morita.
Source/WebCore:
No new tests. Covered by fast/forms/number/number-lossless-localization.html,
and WebKit/chromium/tests/LocaleMacTest.cpp.
* WebCore.gyp/WebCore.gyp:
Exclude locale-relatef files for ICU, and include files for Mac.
Source/WebKit/chromium:
* tests/LocaleMacTest.cpp:
Add some tests for number localization. They are similar to tests in
LocaleWinTest and LocalizedNumberICUTest.cpp
(LocaleMacTest):
(LocaleMacTest::decimalSeparator):
(TEST_F):
(testNumberIsReversible):
(testNumbers):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (125140 => 125141)
--- trunk/Source/WebCore/ChangeLog 2012-08-09 02:22:52 UTC (rev 125140)
+++ trunk/Source/WebCore/ChangeLog 2012-08-09 02:26:01 UTC (rev 125141)
@@ -1,3 +1,16 @@
+2012-08-08 Kent Tamura <[email protected]>
+
+ [Chromium-mac] Switch to LocalizedNumberMac from LocalizedNumberICU
+ https://bugs.webkit.org/show_bug.cgi?id=93432
+
+ Reviewed by Hajime Morita.
+
+ No new tests. Covered by fast/forms/number/number-lossless-localization.html,
+ and WebKit/chromium/tests/LocaleMacTest.cpp.
+
+ * WebCore.gyp/WebCore.gyp:
+ Exclude locale-relatef files for ICU, and include files for Mac.
+
2012-08-08 Hayato Ito <[email protected]>
EventDispatcher::dispatchSimulatedClick should not reuse the same EventDispatcher instance.
Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (125140 => 125141)
--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2012-08-09 02:22:52 UTC (rev 125140)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2012-08-09 02:26:01 UTC (rev 125141)
@@ -1724,10 +1724,16 @@
['include', 'WebKit/mac/WebCoreSupport/WebSystemInterface\\.mm$'],
- # We use LocalizedDateMac.cpp with LocaleMac.mm instead of LocalizedDateICU.cpp.
+ # We use LocalizedDateMac.cpp and LocalizedNumberMac.mm with
+ # LocaleMac.mm instead of LocalizedDateICU.cpp in order to apply
+ # system locales.
+ ['exclude', 'platform/text/LocaleICU\\.cpp$'],
+ ['exclude', 'platform/text/LocaleICU\\.h$'],
['exclude', 'platform/text/LocalizedDateICU\\.cpp$'],
+ ['exclude', 'platform/text/LocalizedNumberICU\\.cpp$'],
['include', 'platform/text/mac/LocaleMac\\.mm$'],
['include', 'platform/text/mac/LocalizedDateMac\\.cpp$'],
+ ['include', 'platform/text/mac/LocalizedNumberMac\\.mm$'],
# The Mac uses platform/mac/KillRingMac.mm instead of the dummy
# implementation.
Modified: trunk/Source/WebKit/chromium/ChangeLog (125140 => 125141)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-08-09 02:22:52 UTC (rev 125140)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-08-09 02:26:01 UTC (rev 125141)
@@ -1,3 +1,19 @@
+2012-08-08 Kent Tamura <[email protected]>
+
+ [Chromium-mac] Switch to LocalizedNumberMac from LocalizedNumberICU
+ https://bugs.webkit.org/show_bug.cgi?id=93432
+
+ Reviewed by Hajime Morita.
+
+ * tests/LocaleMacTest.cpp:
+ Add some tests for number localization. They are similar to tests in
+ LocaleWinTest and LocalizedNumberICUTest.cpp
+ (LocaleMacTest):
+ (LocaleMacTest::decimalSeparator):
+ (TEST_F):
+ (testNumberIsReversible):
+ (testNumbers):
+
2012-08-08 Adrienne Walker <[email protected]>
[chromium] Move scrollbar pointer into WebScrollbarThemePainter
Modified: trunk/Source/WebKit/chromium/tests/LocaleMacTest.cpp (125140 => 125141)
--- trunk/Source/WebKit/chromium/tests/LocaleMacTest.cpp 2012-08-09 02:22:52 UTC (rev 125140)
+++ trunk/Source/WebKit/chromium/tests/LocaleMacTest.cpp 2012-08-09 02:26:01 UTC (rev 125141)
@@ -118,6 +118,12 @@
OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
return locale->timeAMPMLabels()[index];
}
+
+ String decimalSeparator(const String& localeString)
+ {
+ OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
+ return locale->localizedDecimalSeparator();
+ }
#endif
};
@@ -207,4 +213,44 @@
EXPECT_STREQ("\xE5\x8D\x88\xE5\x89\x8D", timeAMPMLabel("ja_JP", 0).utf8().data());
EXPECT_STREQ("\xE5\x8D\x88\xE5\xBE\x8C", timeAMPMLabel("ja_JP", 1).utf8().data());
}
+
+TEST_F(LocaleMacTest, decimalSeparator)
+{
+ EXPECT_STREQ(".", decimalSeparator("en_US").utf8().data());
+ EXPECT_STREQ(",", decimalSeparator("fr_FR").utf8().data());
+}
#endif
+
+static void testNumberIsReversible(const String& localeString, const char* original, const char* shouldHave = 0)
+{
+ OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
+ String localized = locale->convertToLocalizedNumber(original);
+ if (shouldHave)
+ EXPECT_TRUE(localized.contains(shouldHave));
+ String converted = locale->convertFromLocalizedNumber(localized);
+ EXPECT_STREQ(original, converted.utf8().data());
+}
+
+void testNumbers(const String& localeString, const char* decimalSeparatorShouldBe = 0)
+{
+ testNumberIsReversible(localeString, "123456789012345678901234567890");
+ testNumberIsReversible(localeString, "-123.456", decimalSeparatorShouldBe);
+ testNumberIsReversible(localeString, ".456", decimalSeparatorShouldBe);
+ testNumberIsReversible(localeString, "-0.456", decimalSeparatorShouldBe);
+}
+
+TEST_F(LocaleMacTest, localizedNumberRoundTrip)
+{
+ // Test some of major locales.
+ testNumbers("en_US", ".");
+ testNumbers("fr_FR", ",");
+ testNumbers("ar");
+ testNumbers("de_DE");
+ testNumbers("es_ES");
+ testNumbers("fa");
+ testNumbers("ja_JP");
+ testNumbers("ko_KR");
+ testNumbers("zh_CN");
+ testNumbers("zh_HK");
+ testNumbers("zh_TW");
+}