summaryrefslogtreecommitdiff
path: root/Source/WebKit/chromium/tests/LocaleMacTest.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:09:45 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:10:13 +0100
commit470286ecfe79d59df14944e5b5d34630fc739391 (patch)
tree43983212872e06cebefd2ae474418fa2908ca54c /Source/WebKit/chromium/tests/LocaleMacTest.cpp
parent23037105e948c2065da5a937d3a2396b0ff45c1e (diff)
downloadqtwebkit-470286ecfe79d59df14944e5b5d34630fc739391.tar.gz
Imported WebKit commit e89504fa9195b2063b2530961d4b73dd08de3242 (http://svn.webkit.org/repository/webkit/trunk@135485)
Change-Id: I03774e5ac79721c13ffa30d152537a74d0b12e66 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebKit/chromium/tests/LocaleMacTest.cpp')
-rw-r--r--Source/WebKit/chromium/tests/LocaleMacTest.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/WebKit/chromium/tests/LocaleMacTest.cpp b/Source/WebKit/chromium/tests/LocaleMacTest.cpp
index 0d2fed154..cb00138b6 100644
--- a/Source/WebKit/chromium/tests/LocaleMacTest.cpp
+++ b/Source/WebKit/chromium/tests/LocaleMacTest.cpp
@@ -69,6 +69,24 @@ protected:
return dateToDaysFrom1970(year, month, day) * msPerDay;
}
+ String formatWeek(const String& localeString, const String& isoString)
+ {
+ OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
+ DateComponents date;
+ unsigned end;
+ date.parseWeek(isoString.characters(), isoString.length(), 0, end);
+ return locale->formatDateTime(date);
+ }
+
+ String formatMonth(const String& localeString, const String& isoString)
+ {
+ OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
+ DateComponents date;
+ unsigned end;
+ date.parseMonth(isoString.characters(), isoString.length(), 0, end);
+ return locale->formatDateTime(date);
+ }
+
String formatDate(const String& localeString, int year, int month, int day)
{
OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
@@ -158,6 +176,19 @@ protected:
#endif
};
+TEST_F(LocaleMacTest, formatWeek)
+{
+ EXPECT_STREQ("Week 04, 2005", formatWeek("en_US", "2005-W04").utf8().data());
+ EXPECT_STREQ("Week 52, 2005", formatWeek("en_US", "2005-W52").utf8().data());
+}
+
+TEST_F(LocaleMacTest, formatMonth)
+{
+ EXPECT_STREQ("April 2005", formatMonth("en_US", "2005-04").utf8().data());
+ EXPECT_STREQ("avril 2005", formatMonth("fr_FR", "2005-04").utf8().data());
+ EXPECT_STREQ("2005\xE5\xB9\xB4" "04\xE6\x9C\x88", formatMonth("ja_JP", "2005-04").utf8().data());
+}
+
TEST_F(LocaleMacTest, formatDate)
{
EXPECT_STREQ("04/27/2005", formatDate("en_US", 2005, April, 27).utf8().data());