summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-02-07 14:09:04 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-02-21 14:32:28 +0000
commit3b38392844dd9e145a4783445fd3c96e84bb94d1 (patch)
tree3965cab0ed4eaeafa49d34111ffafd70c0649ae6 /src/testlib/qtestcase.h
parent22a88dce03f12c70aa9987570cc408829cb2574e (diff)
testlib: Add qWaitFor to wait for predicate
Reduces duplication of logic and allows other primitives to be built on top. Change-Id: Ia100014cfb0c09ac2f47c3a156d0c76f0fddafa8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/testlib/qtestcase.h')
-rw-r--r--src/testlib/qtestcase.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index a7e825396a..4beb9ea52d 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -150,7 +150,8 @@ do {\
#define QTRY_IMPL(expr, timeout)\
const int qt_test_step = 50; \
const int qt_test_timeoutValue = timeout; \
- QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); \
+ bool timedOut = !QTest::qWaitFor([&]() { return (expr); }, qt_test_timeoutValue); \
+ Q_UNUSED(timedOut); \
QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)\
// Will try to wait for the expression to become true while allowing event processing