diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index 72d6f8ae4b..2b99364655 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -122,10 +122,7 @@ GridTestCase::GridTestCase() m_grid->Refresh(); m_grid->Update(); - if ( !waitForPaint.YieldUntilPainted() ) - { - WARN("Grid not repainted until timeout expiration"); - } + waitForPaint.YieldUntilPainted(); } GridTestCase::~GridTestCase() diff --git a/tests/waitforpaint.h b/tests/waitforpaint.h index 481fcc8b9a..0a1891901b 100644 --- a/tests/waitforpaint.h +++ b/tests/waitforpaint.h @@ -29,8 +29,8 @@ public: } // This function waits up to the given number of milliseconds for the paint - // event to come and returns true if we did get it or false otherwise. - bool YieldUntilPainted(int timeoutInMS = 250) const + // event to come and logs a warning if we didn't get it. + void YieldUntilPainted(int timeoutInMS = 250) { wxStopWatch sw; for ( ;; ) @@ -38,10 +38,17 @@ public: wxYield(); if ( m_painted ) - return true; + { + // Reset it in case YieldUntilPainted() is called again. + m_painted = false; + break; + } if ( sw.Time() > timeoutInMS ) - return false; + { + WARN("Didn't get a paint event until timeout expiration"); + break; + } } } @@ -85,9 +92,8 @@ public: { } - bool YieldUntilPainted(int WXUNUSED(timeoutInMS) = 250) const + void YieldUntilPainted(int WXUNUSED(timeoutInMS) = 250) { - return true; } }; diff --git a/tests/window/setsize.cpp b/tests/window/setsize.cpp index e65861e57d..566f84fd54 100644 --- a/tests/window/setsize.cpp +++ b/tests/window/setsize.cpp @@ -98,10 +98,7 @@ TEST_CASE("wxWindow::MovePreservesSize", "[window][size][move]") w->Show(); - if ( !waitForPaint.YieldUntilPainted() ) - { - WARN("Didn't get a paint event until timeout expiration"); - } + waitForPaint.YieldUntilPainted(); const wxRect rectOrig = w->GetRect();