Make wxStopWatchTestCase::Misc() run in 2.5 seconds instead of 7. This not
only makes the test run faster but allows us to test wxMilliSleep() and
precision of wxStopWatch for time periods in fractional seconds.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69833
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
sw.Pause(); // pause it immediately
sw.Pause(); // pause it immediately
t = sw.Time();
// check that the stop watch doesn't advance while paused
t = sw.Time();
// check that the stop watch doesn't advance while paused
t >= 0 && t < tolerance
);
t >= 0 && t < tolerance
);
+ static const int sleepTime = 500;
+ wxMilliSleep(sleepTime);
- // check that it did advance now by ~3s
+ // check that it did advance now by ~1.5s
WX_ASSERT_MESSAGE
(
("Actual time value is %ld", t),
WX_ASSERT_MESSAGE
(
("Actual time value is %ld", t),
- t > 3000 - tolerance && t < 3000 + tolerance
+ t > sleepTime - tolerance && t < sleepTime + tolerance
+
+ // check that this sleep won't be taken into account below
+ wxMilliSleep(sleepTime);
+ wxMilliSleep(sleepTime);
t = sw.Time();
// and it should advance again
WX_ASSERT_MESSAGE
(
("Actual time value is %ld", t),
t = sw.Time();
// and it should advance again
WX_ASSERT_MESSAGE
(
("Actual time value is %ld", t),
- t > 5000 - tolerance && t < 5000 + tolerance
+ t > 2*sleepTime - tolerance && t < 2*sleepTime + tolerance