From edef007137f823cbd92160e3f27d2c83cb4dc2bf Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Tue, 3 Apr 2018 13:57:52 +0300 Subject: tests/auto/gui/kernel: Use QTRY_VERIFY instead of manual wait loops This reduces the timeout from 10 seconds to the default 5, but the tested events (resize events, painting) seem like something that should happen in 5 seconds. Change-Id: I1d12372f37264bf7be64096e43813cd03f567102 Reviewed-by: Laszlo Agocs --- tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp | 9 ++------- tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp | 6 +----- 2 files changed, 3 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp index a971450ee8..9c36b6898a 100644 --- a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp +++ b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp @@ -156,10 +156,7 @@ void tst_QOpenGLWindow::resize() // Check that a future resize triggers resizeGL. w.resize(800, 600); - int maxWait = 1000; - while (w.resizeCount == resCount && maxWait-- >= 0) - QTest::qWait(10); - QVERIFY(w.resizeCount > resCount); + QTRY_VERIFY(w.resizeCount > resCount); } class PainterWindow : public QOpenGLWindow @@ -239,9 +236,7 @@ void tst_QOpenGLWindow::partial() for (int i = 0; i < 10; ++i) { w.paintCount = 0; w.update(); - int maxWait = 1000; - while (w.paintCount == 0 && maxWait-- >= 0) - QTest::qWait(10); + QTRY_VERIFY(w.paintCount > 0); } // Now since the painting went to an extra framebuffer, all the rects should diff --git a/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp b/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp index ffc440ac2d..deb4837956 100644 --- a/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp +++ b/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp @@ -76,11 +76,7 @@ void tst_QRasterWindow::basic() w.reset(); w.update(); - int maxWait = 1000; - while (w.paintCount == 0 && --maxWait > 0) - QTest::qWait(10); - - QVERIFY(w.paintCount >= 1); + QTRY_VERIFY(w.paintCount >= 1); } #include -- cgit v1.2.3