From 2464c900f5508eb5f317668300990a24037f3487 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 29 Feb 2024 16:15:04 +0100 Subject: [PATCH] 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. --- tests/controls/propgridtest.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/controls/propgridtest.cpp b/tests/controls/propgridtest.cpp index 2314fbd5a5..abd623927e 100644 --- a/tests/controls/propgridtest.cpp +++ b/tests/controls/propgridtest.cpp @@ -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