Add a delay before calling wxDateTime::UNow() again in the test

Retrying immediately wasn't very useful, as the times must have been the
same during all loop iterations anyhow, so add a sleep to try to finally
fix the sporadic test failure on Travis.
This commit is contained in:
Vadim Zeitlin
2019-10-23 11:43:53 +02:00
parent ffac936882
commit 1b063e1dea

View File

@@ -20,6 +20,7 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/time.h" // wxGetTimeZone() #include "wx/time.h" // wxGetTimeZone()
#include "wx/utils.h" // wxMilliSleep()
#endif // WX_PRECOMP #endif // WX_PRECOMP
#include "wx/wxcrt.h" // for wxStrstr() #include "wx/wxcrt.h" // for wxStrstr()
@@ -1715,7 +1716,11 @@ TEST_CASE("wxDateTime::UNow", "[datetime][now][unow]")
break; break;
WARN("wxDateTime::Now() and UNow() returned different " WARN("wxDateTime::Now() and UNow() returned different "
"second values, retrying."); "second values ("
<< now.GetSecond() << " and " << unow.GetSecond() <<
"), retrying.");
wxMilliSleep(123);
} }
CHECK( now.GetYear() == unow.GetYear() ); CHECK( now.GetYear() == unow.GetYear() );