Backed out changeset 6a6f56d7cd12 (bug 1947875) for causing gtest failures @AppDateTimeFormat.

This commit is contained in:
Goloman Adrian
2025-02-17 13:44:43 +02:00
parent 01e42a3bec
commit c648a1084d
2 changed files with 2 additions and 11 deletions

View File

@@ -73,6 +73,7 @@ nsresult AppDateTimeFormat::Format(const DateTimeFormat::ComponentsBag& aBag,
aStringOut.Truncate(); aStringOut.Truncate();
nsAutoCString str;
nsAutoString timeZoneID; nsAutoString timeZoneID;
BuildTimeZoneString(aExplodedTime->tm_params, timeZoneID); BuildTimeZoneString(aExplodedTime->tm_params, timeZoneID);
@@ -81,8 +82,7 @@ nsresult AppDateTimeFormat::Format(const DateTimeFormat::ComponentsBag& aBag,
auto dateTimePatternGenerator = genResult.unwrap(); auto dateTimePatternGenerator = genResult.unwrap();
auto result = DateTimeFormat::TryCreateFromComponents( auto result = DateTimeFormat::TryCreateFromComponents(
*sLocale, aBag, dateTimePatternGenerator.get(), *sLocale, aBag, dateTimePatternGenerator.get(), Some(timeZoneID));
Some(Span<const char16_t>(timeZoneID.Data(), timeZoneID.Length())));
NS_ENSURE_TRUE(result.isOk(), NS_ERROR_FAILURE); NS_ENSURE_TRUE(result.isOk(), NS_ERROR_FAILURE);
auto dateTimeFormat = result.unwrap(); auto dateTimeFormat = result.unwrap();

View File

@@ -99,15 +99,6 @@ TEST(AppDateTimeFormat, FormatPRExplodedTime)
ASSERT_TRUE(formattedTime.Find(u"2:47:00 PM") != kNotFound || ASSERT_TRUE(formattedTime.Find(u"2:47:00 PM") != kNotFound ||
formattedTime.Find(u"2:47:00\u202FPM") != kNotFound || formattedTime.Find(u"2:47:00\u202FPM") != kNotFound ||
formattedTime.Find(u"14:47:00") != kNotFound); formattedTime.Find(u"14:47:00") != kNotFound);
ComponentsBag components{};
components.weekday = mozilla::Some(DateTimeFormat::Text::Short);
components.timeZoneName = mozilla::Some(DateTimeFormat::TimeZoneName::Short);
// From above: Wed, 31 Dec 1969 14:47:00 -09:13
rv = AppDateTimeFormat::Format(components, &prExplodedTime, formattedTime);
ASSERT_NS_SUCCEEDED(rv);
ASSERT_TRUE(formattedTime.Find(u"Wed") != kNotFound);
ASSERT_TRUE(formattedTime.Find(u"-09:13") != kNotFound);
} }
TEST(AppDateTimeFormat, DateFormatSelectors) TEST(AppDateTimeFormat, DateFormatSelectors)