summaryrefslogtreecommitdiffstats
path: root/tests/auto/opengl
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/opengl
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/opengl')
-rw-r--r--tests/auto/opengl/qgl/tst_qgl.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp
index 7666bf81e4..053c4b026b 100644
--- a/tests/auto/opengl/qgl/tst_qgl.cpp
+++ b/tests/auto/opengl/qgl/tst_qgl.cpp
@@ -924,6 +924,7 @@ void tst_QGL::partialGLWidgetUpdates()
widget.setAutoFillBackground(autoFillBackground);
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
+ QCoreApplication::processEvents(); // Process all queued paint events
if (widget.format().doubleBuffer() != doubleBufferedContext)
QSKIP("Platform does not support requested format");