diff --git a/tests/datetime/datetimetest.cpp b/tests/datetime/datetimetest.cpp index c1f156038d..12c28f12e6 100644 --- a/tests/datetime/datetimetest.cpp +++ b/tests/datetime/datetimetest.cpp @@ -21,6 +21,7 @@ #endif // WX_PRECOMP #include "wx/wxcrt.h" // for wxStrstr() +#include "wx/scopeguard.h" #include "wx/private/localeset.h" @@ -2538,6 +2539,12 @@ TEST_CASE("Easter", "[datetime][holiday][easter]") TEST_CASE("US Catholic Holidays", "[datetime][holiday]") { + // Clear the wxDateTimeWorkDays that exists by default, and restore it at the end, + // after cleaning up the authority tested here. + wxDateTimeHolidayAuthority::ClearAllAuthorities(); + wxON_BLOCK_EXIT0(wxDateTimeHolidayAuthority::ClearAllAuthorities); + wxON_BLOCK_EXIT1(wxDateTimeHolidayAuthority::AddAuthority, new wxDateTimeWorkDays); + SECTION("Ascension") { wxDateTime ascension = wxDateTimeUSCatholicFeasts::GetThursdayAscension(2023); @@ -2565,6 +2572,12 @@ TEST_CASE("US Catholic Holidays", "[datetime][holiday]") TEST_CASE("Christian Holidays", "[datetime][holiday][christian]") { + // Clear the wxDateTimeWorkDays that exists by default, and restore it at the end, + // after cleaning up the authority tested here. + wxDateTimeHolidayAuthority::ClearAllAuthorities(); + wxON_BLOCK_EXIT0(wxDateTimeHolidayAuthority::ClearAllAuthorities); + wxON_BLOCK_EXIT1(wxDateTimeHolidayAuthority::AddAuthority, new wxDateTimeWorkDays); + SECTION("Easter") { wxDateTime easter = wxDateTimeChristianHolidays::GetEaster(2023);