Skip to content

Commit

Permalink
[Win] Skip TestWTF.WTF_DateMath.calculateLocalTimeOffset not in Pacif…
Browse files Browse the repository at this point in the history
…ic Time Zone

https://bugs.webkit.org/show_bug.cgi?id=258839

Reviewed by Ross Kirsling.

The test can pass only in Pacific Time Zone. Skip the test in the
outside of the timezone by getting the current timezone with a Windows
API.

* Tools/TestWebKitAPI/Tests/WTF/DateMath.cpp:
(TestWebKitAPI::isPacificTimeZone):
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/265744@main
  • Loading branch information
fujii committed Jul 4, 2023
1 parent 8cf368e commit e3acb13
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Tools/TestWebKitAPI/Tests/WTF/DateMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,22 @@ TEST(WTF_DateMath, dayInMonthFromDayInYear)
EXPECT_EQ(32, dayInMonthFromDayInYear(366, true));
}

static bool isPacificTimeZone()
{
#if PLATFORM(WIN)
TIME_ZONE_INFORMATION info;
GetTimeZoneInformation(&info);
return info.Bias == 8 * 60 && !info.StandardBias && info.DaylightBias == -60;
#else
return true;
#endif
}

TEST(WTF_DateMath, calculateLocalTimeOffset)
{
if (!isPacificTimeZone())
GTEST_SKIP() << "Not in Pacific Time Zone";

// DST Start: April 30, 1967 (02:00 am)
LocalTimeOffset dstStart1967 = calculateLocalTimeOffset(-84301200000, WTF::LocalTime);
EXPECT_TRUE(dstStart1967.isDST);
Expand Down

0 comments on commit e3acb13

Please sign in to comment.