summaryrefslogtreecommitdiff
path: root/Source/WebKit/chromium/tests/LocaleMacTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/chromium/tests/LocaleMacTest.cpp')
-rw-r--r--Source/WebKit/chromium/tests/LocaleMacTest.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/Source/WebKit/chromium/tests/LocaleMacTest.cpp b/Source/WebKit/chromium/tests/LocaleMacTest.cpp
index 449776195..91482d94d 100644
--- a/Source/WebKit/chromium/tests/LocaleMacTest.cpp
+++ b/Source/WebKit/chromium/tests/LocaleMacTest.cpp
@@ -120,6 +120,12 @@ protected:
#endif
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
+ String monthFormat(const String& localeString)
+ {
+ OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
+ return locale->monthFormat();
+ }
+
String timeFormat(const String& localeString)
{
OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
@@ -132,6 +138,18 @@ protected:
return locale->shortTimeFormat();
}
+ String shortMonthLabel(const String& localeString, unsigned index)
+ {
+ OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
+ return locale->shortMonthLabels()[index];
+ }
+
+ String shortStandAloneMonthLabel(const String& localeString, unsigned index)
+ {
+ OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
+ return locale->shortStandAloneMonthLabels()[index];
+ }
+
String timeAMPMLabel(const String& localeString, unsigned index)
{
OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
@@ -236,6 +254,16 @@ TEST_F(LocaleMacTest, isRTL)
#endif
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
+TEST_F(LocaleMacTest, monthFormat)
+{
+ EXPECT_STREQ("MMM yyyy", monthFormat("en_US").utf8().data());
+ EXPECT_STREQ("yyyy\xE5\xB9\xB4M\xE6\x9C\x88", monthFormat("ja_JP").utf8().data());
+
+ // fr_FR and ru return different results on OS versions.
+ // "MMM yyyy" "LLL yyyy" on 10.6 and 10.7
+ // "MMM y" "LLL y" on 10.8
+}
+
TEST_F(LocaleMacTest, timeFormat)
{
EXPECT_STREQ("h:mm:ss a", timeFormat("en_US").utf8().data());
@@ -250,6 +278,30 @@ TEST_F(LocaleMacTest, shortTimeFormat)
EXPECT_STREQ("H:mm", shortTimeFormat("ja_JP").utf8().data());
}
+TEST_F(LocaleMacTest, shortMonthLabels)
+{
+ EXPECT_STREQ("Jan", shortMonthLabel("en_US", 0).utf8().data());
+ EXPECT_STREQ("Jan", shortStandAloneMonthLabel("en_US", 0).utf8().data());
+ EXPECT_STREQ("Dec", shortMonthLabel("en_US", 11).utf8().data());
+ EXPECT_STREQ("Dec", shortStandAloneMonthLabel("en_US", 11).utf8().data());
+
+ EXPECT_STREQ("janv.", shortMonthLabel("fr_FR", 0).utf8().data());
+ EXPECT_STREQ("janv.", shortStandAloneMonthLabel("fr_FR", 0).utf8().data());
+ EXPECT_STREQ("d\xC3\xA9" "c.", shortMonthLabel("fr_FR", 11).utf8().data());
+ EXPECT_STREQ("d\xC3\xA9" "c.", shortStandAloneMonthLabel("fr_FR", 11).utf8().data());
+
+ EXPECT_STREQ("1\xE6\x9C\x88", shortMonthLabel("ja_JP", 0).utf8().data());
+ EXPECT_STREQ("1\xE6\x9C\x88", shortStandAloneMonthLabel("ja_JP", 0).utf8().data());
+ EXPECT_STREQ("12\xE6\x9C\x88", shortMonthLabel("ja_JP", 11).utf8().data());
+ EXPECT_STREQ("12\xE6\x9C\x88", shortStandAloneMonthLabel("ja_JP", 11).utf8().data());
+
+ EXPECT_STREQ("\xD0\xBC\xD0\xB0\xD1\x80\xD1\x82\xD0\xB0", shortMonthLabel("ru_RU", 2).utf8().data());
+ EXPECT_STREQ("\xD0\xBC\xD0\xB0\xD1\x8F", shortMonthLabel("ru_RU", 4).utf8().data());
+ // The ru_RU locale returns different stand-alone month labels on OS versions.
+ // "\xD0\xBC\xD0\xB0\xD1\x80\xD1\x82" "\xD0\xBC\xD0\xB0\xD0\xB9" on 10.6 and 10.7
+ // "\xD0\x9C\xD0\xB0\xD1\x80\xD1\x82" "\xD0\x9C\xD0\xB0\xD0\xB9" on 10.8
+}
+
TEST_F(LocaleMacTest, timeAMPMLabels)
{
EXPECT_STREQ("AM", timeAMPMLabel("en_US", 0).utf8().data());