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 <laszlo.agocs@qt.io>
This commit is contained in:
Kari Oikarinen 2018-04-03 13:57:52 +03:00
parent b318c14bd5
commit edef007137
2 changed files with 3 additions and 12 deletions

View File

@ -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

View File

@ -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 <tst_qrasterwindow.moc>