summaryrefslogtreecommitdiffstats
path: root/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
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/doc/snippets/code/src_qtestlib_qtestcase.cpp
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/doc/snippets/code/src_qtestlib_qtestcase.cpp')
-rw-r--r--src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
index 01ee8102f4..990b7a38d7 100644
--- a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
+++ b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
@@ -306,5 +306,13 @@ QTest::keyClick(myWindow, Qt::Key_Escape);
QTest::keyClick(myWindow, Qt::Key_Escape, Qt::ShiftModifier, 200);
//! [29]
+//! [30]
+MyObject obj;
+obj.startup();
+QTest::qWaitFor([&]() {
+ return obj.isReady();
+}, 3000);
+//! [30]
+
}