From dc6085a808fcc689eb72bbdb77fff6cfbc4eab19 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 1 Oct 2023 21:32:09 +0200 Subject: [PATCH] Use WaitFor() in WaitForPaint::YieldUntilPainted() No real changes, just refactor the existing code to call the new function instead of duplicating it. --- tests/waitfor.h | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/tests/waitfor.h b/tests/waitfor.h index 35b1c161ca..37be4595cf 100644 --- a/tests/waitfor.h +++ b/tests/waitfor.h @@ -57,23 +57,10 @@ public: // event to come and logs a warning if we didn't get it. void YieldUntilPainted(int timeoutInMS = 250) { - wxStopWatch sw; - for ( ;; ) + if ( WaitFor("repaint", [this]() { return m_painted; }, timeoutInMS) ) { - wxYield(); - - if ( m_painted ) - { - // Reset it in case YieldUntilPainted() is called again. - m_painted = false; - break; - } - - if ( sw.Time() > timeoutInMS ) - { - WARN("Didn't get a paint event until timeout expiration"); - break; - } + // Reset it in case YieldUntilPainted() is called again. + m_painted = false; } }