Log Message
Localized date should be based on LDML https://bugs.webkit.org/show_bug.cgi?id=99570
Reviewed by Kent Tamura. Source/WebCore: Localized date should be based on LDML to match the format inside DateTimeEditElement. No new tests. Covered by LocaleMacTest.formatDate and LocaleWinTest.formatDate. * platform/text/LocaleICU.cpp: Removed formatDateTime. * platform/text/LocaleICU.h: (LocaleICU): * platform/text/LocaleNone.cpp: Removed formatDateTime. (LocaleNone): * platform/text/LocaleWin.cpp: Removed formatDateTime and formatDate. (WebCore): * platform/text/LocaleWin.h: (LocaleWin): * platform/text/Localizer.cpp: (WebCore::DateTimeStringBuilder::visitField): Added support for year/month/day. (WebCore::Localizer::formatDateTime): Creates the formatted string based on the format from dateFormat(). * platform/text/Localizer.h: * platform/text/mac/LocaleMac.h: (LocaleMac): * platform/text/mac/LocaleMac.mm: Removed formatDateTime. Source/WebKit/chromium: * tests/LocaleMacTest.cpp: (TEST_F): Updated expectations. * tests/LocaleWinTest.cpp: (TEST_F): Updated expectations.
Modified Paths
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/platform/text/LocaleICU.cpp
- trunk/Source/WebCore/platform/text/LocaleICU.h
- trunk/Source/WebCore/platform/text/LocaleNone.cpp
- trunk/Source/WebCore/platform/text/LocaleWin.cpp
- trunk/Source/WebCore/platform/text/LocaleWin.h
- trunk/Source/WebCore/platform/text/Localizer.cpp
- trunk/Source/WebCore/platform/text/Localizer.h
- trunk/Source/WebCore/platform/text/mac/LocaleMac.h
- trunk/Source/WebCore/platform/text/mac/LocaleMac.mm
- trunk/Source/WebKit/chromium/ChangeLog
- trunk/Source/WebKit/chromium/tests/LocaleMacTest.cpp
- trunk/Source/WebKit/chromium/tests/LocaleWinTest.cpp
Diff
Modified: trunk/Source/WebCore/ChangeLog (131584 => 131585)
--- trunk/Source/WebCore/ChangeLog 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebCore/ChangeLog 2012-10-17 11:28:39 UTC (rev 131585)
@@ -1,3 +1,31 @@
+2012-10-17 Keishi Hattori <[email protected]>
+
+ Localized date should be based on LDML
+ https://bugs.webkit.org/show_bug.cgi?id=99570
+
+ Reviewed by Kent Tamura.
+
+ Localized date should be based on LDML to match the format inside DateTimeEditElement.
+
+ No new tests. Covered by LocaleMacTest.formatDate and LocaleWinTest.formatDate.
+
+ * platform/text/LocaleICU.cpp: Removed formatDateTime.
+ * platform/text/LocaleICU.h:
+ (LocaleICU):
+ * platform/text/LocaleNone.cpp: Removed formatDateTime.
+ (LocaleNone):
+ * platform/text/LocaleWin.cpp: Removed formatDateTime and formatDate.
+ (WebCore):
+ * platform/text/LocaleWin.h:
+ (LocaleWin):
+ * platform/text/Localizer.cpp:
+ (WebCore::DateTimeStringBuilder::visitField): Added support for year/month/day.
+ (WebCore::Localizer::formatDateTime): Creates the formatted string based on the format from dateFormat().
+ * platform/text/Localizer.h:
+ * platform/text/mac/LocaleMac.h:
+ (LocaleMac):
+ * platform/text/mac/LocaleMac.mm: Removed formatDateTime.
+
2012-10-17 Harald Alvestrand <[email protected]>
Implement the Selector argument to RTCPeerConnection.getStats
Modified: trunk/Source/WebCore/platform/text/LocaleICU.cpp (131584 => 131585)
--- trunk/Source/WebCore/platform/text/LocaleICU.cpp 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebCore/platform/text/LocaleICU.cpp 2012-10-17 11:28:39 UTC (rev 131585)
@@ -172,25 +172,6 @@
return date;
}
-String LocaleICU::formatDateTime(const DateComponents& dateComponents, FormatType formatType)
-{
- if (dateComponents.type() != DateComponents::Date)
- return Localizer::formatDateTime(dateComponents, formatType);
- if (!initializeShortDateFormat())
- return String();
- double input = dateComponents.millisecondsSinceEpoch();
- UErrorCode status = U_ZERO_ERROR;
- int32_t length = udat_format(m_shortDateFormat, input, 0, 0, 0, &status);
- if (status != U_BUFFER_OVERFLOW_ERROR)
- return String();
- Vector<UChar> buffer(length);
- status = U_ZERO_ERROR;
- udat_format(m_shortDateFormat, input, buffer.data(), length, 0, &status);
- if (U_FAILURE(status))
- return String();
- return String::adopt(buffer);
-}
-
#if ENABLE(CALENDAR_PICKER) || ENABLE(INPUT_MULTIPLE_FIELDS_UI)
static String getDateFormatPattern(const UDateFormat* dateFormat)
{
Modified: trunk/Source/WebCore/platform/text/LocaleICU.h (131584 => 131585)
--- trunk/Source/WebCore/platform/text/LocaleICU.h 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebCore/platform/text/LocaleICU.h 2012-10-17 11:28:39 UTC (rev 131585)
@@ -51,7 +51,6 @@
// For LocalizedDate
virtual double parseDateTime(const String&, DateComponents::Type) OVERRIDE;
- virtual String formatDateTime(const DateComponents&, FormatType = FormatTypeUnspecified) OVERRIDE;
#if ENABLE(CALENDAR_PICKER)
virtual String dateFormatText() OVERRIDE;
Modified: trunk/Source/WebCore/platform/text/LocaleNone.cpp (131584 => 131585)
--- trunk/Source/WebCore/platform/text/LocaleNone.cpp 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebCore/platform/text/LocaleNone.cpp 2012-10-17 11:28:39 UTC (rev 131585)
@@ -36,7 +36,6 @@
private:
virtual void initializeLocalizerData() OVERRIDE FINAL;
virtual double parseDateTime(const String&, DateComponents::Type) OVERRIDE;
- virtual String formatDateTime(const DateComponents&, FormatType = FormatTypeUnspecified) OVERRIDE;
#if ENABLE(CALENDAR_PICKER)
virtual String dateFormatText() OVERRIDE;
virtual bool isRTL() OVERRIDE;
@@ -64,11 +63,6 @@
return std::numeric_limits<double>::quiet_NaN();
}
-String LocaleNone::formatDateTime(const DateComponents&, FormatType)
-{
- return String();
-}
-
#if ENABLE(CALENDAR_PICKER)
String LocaleNone::dateFormatText()
{
Modified: trunk/Source/WebCore/platform/text/LocaleWin.cpp (131584 => 131585)
--- trunk/Source/WebCore/platform/text/LocaleWin.cpp 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebCore/platform/text/LocaleWin.cpp 2012-10-17 11:28:39 UTC (rev 131585)
@@ -443,113 +443,6 @@
// -------------------------------- Formatting
-inline void LocaleWin::appendNumber(int value, StringBuilder& buffer)
-{
- buffer.append(convertToLocalizedNumber(String::number(value)));
-}
-
-void LocaleWin::appendTwoDigitsNumber(int value, StringBuilder& buffer)
-{
- String numberString = String::number(value);
- if (value < 0 || value >= 10) {
- buffer.append(convertToLocalizedNumber(numberString));
- return;
- }
- StringBuilder numberBuffer;
- numberBuffer.reserveCapacity(1 + numberString.length());
- numberBuffer.append("0");
- numberBuffer.append(numberString);
- buffer.append(convertToLocalizedNumber(numberBuffer.toString()));
-}
-
-void LocaleWin::appendFourDigitsNumber(int value, StringBuilder& buffer)
-{
- String numberString = String::number(value);
- if (value < 0) {
- buffer.append(convertToLocalizedNumber(numberString));
- return;
- }
- StringBuilder numberBuffer;
- numberBuffer.reserveCapacity(3 + numberString.length());
- if (value < 10)
- numberBuffer.append("000");
- else if (value < 100)
- numberBuffer.append("00");
- else if (value < 1000)
- numberBuffer.append("0");
- numberBuffer.append(numberString);
- buffer.append(convertToLocalizedNumber(numberBuffer.toString()));
-}
-
-String LocaleWin::formatDateTime(const DateComponents& dateComponents, FormatType formatType)
-{
- if (dateComponents.type() != DateComponents::Date)
- return Localizer::formatDateTime(dateComponents, formatType);
- ensureShortDateTokens();
- return formatDate(m_shortDateTokens, m_baseYear, dateComponents.fullYear(), dateComponents.month(), dateComponents.monthDay());
-}
-
-String LocaleWin::formatDate(const String& format, int baseYear, int year, int month, int day)
-{
- return formatDate(parseDateFormat(format), baseYear, year, month, day);
-}
-
-String LocaleWin::formatDate(const Vector<DateFormatToken>& tokens, int baseYear, int year, int month, int day)
-{
- ensureShortMonthLabels();
- ensureMonthLabels();
- StringBuilder buffer;
- for (unsigned i = 0; i < tokens.size(); ++i) {
- switch (tokens[i].type) {
- case DateFormatToken::Literal:
- buffer.append(tokens[i].data);
- break;
- case DateFormatToken::Day1:
- appendNumber(day, buffer);
- break;
- case DateFormatToken::Day2:
- appendTwoDigitsNumber(day, buffer);
- break;
- case DateFormatToken::Month1:
- appendNumber(month + 1, buffer);
- break;
- case DateFormatToken::Month2:
- appendTwoDigitsNumber(month + 1, buffer);
- break;
- case DateFormatToken::Month3:
- if (0 <= month && month < static_cast<int>(m_shortMonthLabels.size()))
- buffer.append(m_shortMonthLabels[month]);
- else
- appendNumber(month + 1, buffer);
- break;
- case DateFormatToken::Month4:
- if (0 <= month && month < static_cast<int>(m_monthLabels.size()))
- buffer.append(m_monthLabels[month]);
- else
- appendNumber(month + 1, buffer);
- break;
- case DateFormatToken::Year1: {
- if (baseYear - 4 <= year && year <= baseYear + 5)
- appendNumber(year % 10, buffer);
- else
- appendFourDigitsNumber(year, buffer);
- break;
- }
- case DateFormatToken::Year2: {
- if (baseYear - 49 <= year && year <= baseYear + 50)
- appendTwoDigitsNumber(year % 100, buffer);
- else
- appendFourDigitsNumber(year, buffer);
- break;
- }
- case DateFormatToken::Year4:
- appendFourDigitsNumber(year, buffer);
- break;
- }
- }
- return buffer.toString();
-}
-
void LocaleWin::ensureShortDateTokens()
{
if (!m_shortDateTokens.isEmpty())
Modified: trunk/Source/WebCore/platform/text/LocaleWin.h (131584 => 131585)
--- trunk/Source/WebCore/platform/text/LocaleWin.h 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebCore/platform/text/LocaleWin.h 2012-10-17 11:28:39 UTC (rev 131585)
@@ -47,7 +47,6 @@
static PassOwnPtr<LocaleWin> create(LCID);
~LocaleWin();
virtual double parseDateTime(const String&, DateComponents::Type) OVERRIDE;
- virtual String formatDateTime(const DateComponents&, FormatType = FormatTypeUnspecified) OVERRIDE;
#if ENABLE(CALENDAR_PICKER)
virtual String dateFormatText() OVERRIDE;
virtual const Vector<String>& monthLabels() OVERRIDE;
Modified: trunk/Source/WebCore/platform/text/Localizer.cpp (131584 => 131585)
--- trunk/Source/WebCore/platform/text/Localizer.cpp 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebCore/platform/text/Localizer.cpp 2012-10-17 11:28:39 UTC (rev 131585)
@@ -94,6 +94,18 @@
void DateTimeStringBuilder::visitField(DateTimeFormat::FieldType fieldType, int numberOfPatternCharacters)
{
switch (fieldType) {
+ case DateTimeFormat::FieldTypeYear:
+ // Always use padding width of 4 so it matches DateTimeEditElement.
+ appendNumber(m_date.fullYear(), 4);
+ return;
+ case DateTimeFormat::FieldTypeMonth:
+ // Always use padding width of 2 so it matches DateTimeEditElement.
+ appendNumber(m_date.month() + 1, 2);
+ return;
+ case DateTimeFormat::FieldTypeDayOfMonth:
+ // Always use padding width of 2 so it matches DateTimeEditElement.
+ appendNumber(m_date.monthDay(), 2);
+ return;
case DateTimeFormat::FieldTypePeriod:
m_builder.append(m_localizer.timeAMPMLabels()[(m_date.hour() >= 12 ? 1 : 0)]);
return;
@@ -359,10 +371,13 @@
String Localizer::formatDateTime(const DateComponents& date, FormatType formatType)
{
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
- if (date.type() != DateComponents::Time)
+ if (date.type() != DateComponents::Time && date.type() != DateComponents::Date)
return String();
DateTimeStringBuilder builder(*this, date);
- builder.build(formatType == FormatTypeShort ? shortTimeFormat() : timeFormat());
+ if (date.type() == DateComponents::Time)
+ builder.build(formatType == FormatTypeShort ? shortTimeFormat() : timeFormat());
+ else if (date.type() == DateComponents::Date)
+ builder.build(dateFormat());
return builder.toString();
#else
UNUSED_PARAM(date);
Modified: trunk/Source/WebCore/platform/text/Localizer.h (131584 => 131585)
--- trunk/Source/WebCore/platform/text/Localizer.h 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebCore/platform/text/Localizer.h 2012-10-17 11:28:39 UTC (rev 131585)
@@ -118,7 +118,7 @@
// Serializes the specified date into a formatted date string to
// display to the user. If an implementation doesn't support
// localized dates the function should return an empty string.
- virtual String formatDateTime(const DateComponents&, FormatType = FormatTypeUnspecified);
+ String formatDateTime(const DateComponents&, FormatType = FormatTypeUnspecified);
virtual ~Localizer();
Modified: trunk/Source/WebCore/platform/text/mac/LocaleMac.h (131584 => 131585)
--- trunk/Source/WebCore/platform/text/mac/LocaleMac.h 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebCore/platform/text/mac/LocaleMac.h 2012-10-17 11:28:39 UTC (rev 131585)
@@ -51,7 +51,6 @@
static PassOwnPtr<LocaleMac> create(NSLocale*);
~LocaleMac();
virtual double parseDateTime(const String&, DateComponents::Type) OVERRIDE;
- virtual String formatDateTime(const DateComponents&, FormatType = FormatTypeUnspecified) OVERRIDE;
#if ENABLE(CALENDAR_PICKER)
virtual String dateFormatText() OVERRIDE;
Modified: trunk/Source/WebCore/platform/text/mac/LocaleMac.mm (131584 => 131585)
--- trunk/Source/WebCore/platform/text/mac/LocaleMac.mm 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebCore/platform/text/mac/LocaleMac.mm 2012-10-17 11:28:39 UTC (rev 131585)
@@ -123,14 +123,6 @@
return [date timeIntervalSince1970] * msPerSecond;
}
-String LocaleMac::formatDateTime(const DateComponents& dateComponents, FormatType formatType)
-{
- if (dateComponents.type() != DateComponents::Date)
- return Localizer::formatDateTime(dateComponents, formatType);
- NSTimeInterval interval = dateComponents.millisecondsSinceEpoch() / msPerSecond;
- return [shortDateFormatter().get() stringFromDate:[NSDate dateWithTimeIntervalSince1970:interval]];
-}
-
#if ENABLE(CALENDAR_PICKER)
static bool isYearSymbol(UChar letter) { return letter == 'y' || letter == 'Y' || letter == 'u'; }
static bool isMonthSymbol(UChar letter) { return letter == 'M' || letter == 'L'; }
Modified: trunk/Source/WebKit/chromium/ChangeLog (131584 => 131585)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-10-17 11:28:39 UTC (rev 131585)
@@ -1,3 +1,15 @@
+2012-10-17 Keishi Hattori <[email protected]>
+
+ Localized date should be based on LDML
+ https://bugs.webkit.org/show_bug.cgi?id=99570
+
+ Reviewed by Kent Tamura.
+
+ * tests/LocaleMacTest.cpp:
+ (TEST_F): Updated expectations.
+ * tests/LocaleWinTest.cpp:
+ (TEST_F): Updated expectations.
+
2012-10-16 MORITA Hajime <[email protected]>
[Shadow DOM][V8] WebCore::V8DOMWindow::installPerContextProperties() is slow when shadowDOMEnabled flag is on.
Modified: trunk/Source/WebKit/chromium/tests/LocaleMacTest.cpp (131584 => 131585)
--- trunk/Source/WebKit/chromium/tests/LocaleMacTest.cpp 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebKit/chromium/tests/LocaleMacTest.cpp 2012-10-17 11:28:39 UTC (rev 131585)
@@ -148,8 +148,8 @@
TEST_F(LocaleMacTest, formatDate)
{
- EXPECT_STREQ("4/27/05", formatDate("en_US", 2005, April, 27).utf8().data());
- EXPECT_STREQ("27/04/05", formatDate("fr_FR", 2005, April, 27).utf8().data());
+ EXPECT_STREQ("04/27/2005", formatDate("en_US", 2005, April, 27).utf8().data());
+ EXPECT_STREQ("27/04/2005", formatDate("fr_FR", 2005, April, 27).utf8().data());
// Do not test ja_JP locale. OS X 10.8 and 10.7 have different formats.
}
Modified: trunk/Source/WebKit/chromium/tests/LocaleWinTest.cpp (131584 => 131585)
--- trunk/Source/WebKit/chromium/tests/LocaleWinTest.cpp 2012-10-17 11:15:07 UTC (rev 131584)
+++ trunk/Source/WebKit/chromium/tests/LocaleWinTest.cpp 2012-10-17 11:28:39 UTC (rev 131585)
@@ -169,68 +169,6 @@
EXPECT_STREQ("YY/mm/DD", LocaleWin::dateFormatText("YY/mm/DD", "year", "month", "day").utf8().data());
}
-TEST_F(LocaleWinTest, TestFormat)
-{
- OwnPtr<LocaleWin> locale = LocaleWin::create(EnglishUS);
-
- EXPECT_STREQ("4/7/2", locale->formatDate("M/d/y", 2012, 2012, April, 7).utf8().data());
- EXPECT_STREQ("4/7/2007", locale->formatDate("M/d/y", 2012, 2007, April, 7).utf8().data());
- EXPECT_STREQ("4/7/8", locale->formatDate("M/d/y", 2012, 2008, April, 7).utf8().data());
- EXPECT_STREQ("4/7/7", locale->formatDate("M/d/y", 2012, 2017, April, 7).utf8().data());
- EXPECT_STREQ("4/7/2018", locale->formatDate("M/d/y", 2012, 2018, April, 7).utf8().data());
- EXPECT_STREQ("12/31/2062", locale->formatDate("M/d/y", 2012, 2062, December, 31).utf8().data());
- EXPECT_STREQ("4/7/0002", locale->formatDate("M/d/y", 2012, 2, April, 7).utf8().data());
-
- EXPECT_STREQ("04/27/12", locale->formatDate("MM/dd/yy", 2012, 2012, April, 27).utf8().data());
- EXPECT_STREQ("04/07/1962", locale->formatDate("MM/dd/yy", 2012, 1962, April, 7).utf8().data());
- EXPECT_STREQ("04/07/63", locale->formatDate("MM/dd/yy", 2012, 1963, April, 7).utf8().data());
- EXPECT_STREQ("01/31/00", locale->formatDate("MM/dd/yy", 2012, 2000, January, 31).utf8().data());
- EXPECT_STREQ("04/07/62", locale->formatDate("MM/dd/yy", 2012, 2062, April, 7).utf8().data());
- EXPECT_STREQ("04/07/2063", locale->formatDate("MM/dd/yy", 2012, 2063, April, 7).utf8().data());
- EXPECT_STREQ("04/07/0001", locale->formatDate("MM/dd/yy", 2012, 1, April, 7).utf8().data());
-
- EXPECT_STREQ("Jan/7/2012", locale->formatDate("MMM/d/yyyy", 2012, 2012, January, 7).utf8().data());
- EXPECT_STREQ("Feb/7/2008", locale->formatDate("MMM/d/yyyy", 2012, 2008, February, 7).utf8().data());
- EXPECT_STREQ("Mar/7/2017", locale->formatDate("MMM/d/yyyy", 2012, 2017, March, 7).utf8().data());
- EXPECT_STREQ("Apr/7/2012", locale->formatDate("MMM/d/yyyy", 2012, 2012, April, 7).utf8().data());
- EXPECT_STREQ("May/7/0002", locale->formatDate("MMM/d/yyyy", 2012, 2, May, 7).utf8().data());
- EXPECT_STREQ("Jun/7/2008", locale->formatDate("MMM/d/yyyy", 2012, 2008, June, 7).utf8().data());
- EXPECT_STREQ("Jul/7/2017", locale->formatDate("MMM/d/yyyy", 2012, 2017, July, 7).utf8().data());
- EXPECT_STREQ("Aug/31/2062", locale->formatDate("MMM/d/yyyy", 2012, 2062, August, 31).utf8().data());
- EXPECT_STREQ("Sep/7/0002", locale->formatDate("MMM/d/yyyy", 2012, 2, September, 7).utf8().data());
- EXPECT_STREQ("Oct/7/2012", locale->formatDate("MMM/d/yyyy", 2012, 2012, October, 7).utf8().data());
- EXPECT_STREQ("Nov/7/2008", locale->formatDate("MMM/d/yyyy", 2012, 2008, November, 7).utf8().data());
- EXPECT_STREQ("Dec/31/2062", locale->formatDate("MMM/d/yyyy", 2012, 2062, December, 31).utf8().data());
-
- EXPECT_STREQ("January-7-2017", locale->formatDate("MMMM-d-yyyy", 2012, 2017, January, 7).utf8().data());
- EXPECT_STREQ("February-31-2062", locale->formatDate("MMMM-d-yyyy", 2012, 2062, February, 31).utf8().data());
- EXPECT_STREQ("March-7-0002", locale->formatDate("MMMM-d-yyyy", 2012, 2, March, 7).utf8().data());
- EXPECT_STREQ("April-7-22012", locale->formatDate("MMMM-d-yyyy", 2012, 22012, April, 7).utf8().data());
- EXPECT_STREQ("May-7-12008", locale->formatDate("MMMM-d-yyyy", 2012, 12008, May, 7).utf8().data());
- EXPECT_STREQ("June-7-22012", locale->formatDate("MMMM-d-yyyy", 2012, 22012, June, 7).utf8().data());
- EXPECT_STREQ("July-7-12008", locale->formatDate("MMMM-d-yyyy", 2012, 12008, July, 7).utf8().data());
- EXPECT_STREQ("August-7-2017", locale->formatDate("MMMM-d-yyyy", 2012, 2017, August, 7).utf8().data());
- EXPECT_STREQ("September-31-2062", locale->formatDate("MMMM-d-yyyy", 2012, 2062, September, 31).utf8().data());
- EXPECT_STREQ("October-7-0002", locale->formatDate("MMMM-d-yyyy", 2012, 2, October, 7).utf8().data());
- EXPECT_STREQ("November-7-22012", locale->formatDate("MMMM-d-yyyy", 2012, 22012, November, 7).utf8().data());
- EXPECT_STREQ("December-7-12008", locale->formatDate("MMMM-d-yyyy", 2012, 12008, December, 7).utf8().data());
-
- EXPECT_STREQ("Jan-1-0001", locale->formatDate("MMM-d-yyyy", 2012, 1, January, 1).utf8().data());
- EXPECT_STREQ("Sep-13-275760", locale->formatDate("MMM-d-yyyy", 2012, 275760, September, 13).utf8().data());
-
- OwnPtr<LocaleWin> persian = LocaleWin::create(Persian);
- // U+06F0 U+06F1 / U+06F0 U+06F8 / U+06F0 U+06F0 U+06F0 U+06F2
- EXPECT_STREQ("\xDB\xB0\xDB\xB1/\xDB\xB0\xDB\xB8/\xDB\xB0\xDB\xB0\xDB\xB0\xDB\xB1", persian->formatDate("dd/MM/yyyy", 2012, 1, August, 1).utf8().data());
-
- // For the following test, we'd like to confirm they don't crash and their
- // results are not important because we can assume invalid arguments are
- // never passed.
- EXPECT_STREQ("2012-13-00", locale->formatDate("yyyy-MM-dd", -1, 2012, December + 1, 0).utf8().data());
- EXPECT_STREQ("-1-00--1", locale->formatDate("y-MM-dd", -1, -1, -1, -1).utf8().data());
- EXPECT_STREQ("-1-124-33", locale->formatDate("y-MM-dd", 2012, -1, 123, 33).utf8().data());
-
-}
-
TEST_F(LocaleWinTest, TestParse)
{
OwnPtr<LocaleWin> locale = LocaleWin::create(EnglishUS);
@@ -272,7 +210,7 @@
TEST_F(LocaleWinTest, formatDate)
{
- EXPECT_STREQ("4/27/2005", formatDate(EnglishUS, 2005, April, 27).utf8().data());
+ EXPECT_STREQ("04/27/2005", formatDate(EnglishUS, 2005, April, 27).utf8().data());
EXPECT_STREQ("27/04/2005", formatDate(FrenchFR, 2005, April, 27).utf8().data());
EXPECT_STREQ("2005/04/27", formatDate(JapaneseJP, 2005, April, 27).utf8().data());
}
_______________________________________________ webkit-changes mailing list [email protected] http://lists.webkit.org/mailman/listinfo/webkit-changes
