From 292cb12e024e63f17c501611e021b6f8da7d6dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 7 Feb 2017 14:09:04 +0100 Subject: 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 --- src/testlib/qtestcase.qdoc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/testlib/qtestcase.qdoc') 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 -- cgit v1.2.3