Fix wxPropertyGrid test case failing once every 4 years

Don't assume that the same date is valid in the previous year, as this
is not the case for Feb 29.
This commit is contained in:
Vadim Zeitlin 2024-02-29 16:15:04 +01:00
parent a62d2dc9d9
commit 2464c900f5

View file

@ -819,9 +819,11 @@ TEST_CASE("PropertyGridTestCase", "[propgrid]")
#if wxUSE_DATETIME
wxDateTime dt1 = wxDateTime::Now();
dt1.SetYear(dt1.GetYear() - 1);
if ( dt1.GetMonth() == wxDateTime::Feb && dt1.GetDay() == 29 )
dt1.SetDay(28);
wxDateTime dt2 = wxDateTime::Now();
wxDateTime dt2 = dt1;
dt1.SetYear(dt1.GetYear() - 1);
dt2.SetYear(dt2.GetYear() - 10);
#endif