summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/effects
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-09-05 13:47:05 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-01-09 18:10:54 +0000
commit68511d41d50b1a136fb0e74fdabfd362e0b21a1a (patch)
treebda554889a8d7d16d9b0bf40a67a1505c1a1a762 /tests/auto/widgets/effects
parent0330db86fdd42ef1be1354cdbbd6e0ffc21d9a80 (diff)
qWaitFor: Prevent being stuck in QCoreApplication::processEvents
When using the overload of QCoreApplication::processEvents that takes a maxtime argument, the function will keep processing events until there are no more events, or until it times out. The problem is that the function doesn't distinguish between events that were on the event queue when the function was called, and events generated by processing events as part of its own execution. If for example a widget calls update() in its paintEvent, the function will spin for the entire duration of maxtime. That doesn't work for qWaitFor, where we need to check the predicate between each pass, so we use the overload of processEvents that doesn't take a maxtime. That's fine, as we have our own timeout logic. Change-Id: I9738d7d0187c36d4a5ddfcd3fd075b0bd84583c4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests/auto/widgets/effects')
-rw-r--r--tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp
index 95662a49a0..c4b6e22c37 100644
--- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -313,6 +313,7 @@ void tst_QGraphicsEffect::draw()
view.show();
QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(item->numRepaints > 0);
+ QCoreApplication::processEvents(); // Process all queued paint events
item->reset();
// Make sure installing the effect triggers a repaint.