diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-02-07 14:09:04 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-09-25 12:19:18 +0000 |
commit | 292cb12e024e63f17c501611e021b6f8da7d6dcc (patch) | |
tree | 20b607b50fae0a42bcc75e51d31bb114f20cc213 /src/testlib/qtestcase.qdoc | |
parent | 0dbede2b174508d5cc56e7c4a26abcaac996bc13 (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: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src/testlib/qtestcase.qdoc')
-rw-r--r-- | src/testlib/qtestcase.qdoc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/testlib/qtestcase.qdoc b/src/testlib/qtestcase.qdoc index 2d1e27ec40..5b90419e28 100644 --- a/src/testlib/qtestcase.qdoc +++ b/src/testlib/qtestcase.qdoc @@ -1075,6 +1075,21 @@ \sa QTest::qSleep(), QSignalSpy::wait() */ +/*! \fn void QTest::qWaitFor(Functor predicate, int timeout) + + Waits for \a timeout milliseconds or until the \a predicate returns true. + + Returns \c true if the \a predicate returned true at any point, otherwise returns \c false. + + Example: + \snippet code/src_qtestlib_qtestcase.cpp 30 + + The code above will wait for the object to become ready, for a + maximum of three seconds. + + \since 5.10 +*/ + /*! \fn bool QTest::qWaitForWindowExposed(QWindow *window, int timeout) \since 5.0 |