From 68de38ded1c0e5387ae29aacaee50ba5dacfc59a Mon Sep 17 00:00:00 2001 From: Andrei Golubev Date: Thu, 11 Jun 2020 17:16:54 +0300 Subject: Document QPromise API Documented QPromise. Added snippets under auto tests to ensure they are compiled and run in CI. Task-number: QTBUG-81586 Change-Id: I20084e38f9d2f6fc8540f95ee03ec3d2827177e8 Reviewed-by: Sona Kurazyan --- .../auto/corelib/thread/qpromise/tst_qpromise.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/auto/corelib/thread/qpromise/tst_qpromise.cpp') diff --git a/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp b/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp index 1e5864e59e..02c5b6a8bd 100644 --- a/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp +++ b/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp @@ -68,6 +68,11 @@ private slots: void cancelWhenMoved(); void waitUntilResumed(); void waitUntilCanceled(); + + // snippets (external): + void snippet_basicExample(); + void snippet_multithreadExample(); + void snippet_suspendExample(); }; struct TrivialType { int field = 0; }; @@ -573,5 +578,22 @@ void tst_QPromise::waitUntilCanceled() QCOMPARE(f.resultCount(), 0); } +// Below is a quick and dirty hack to make snippets a part of a test suite +#include "snippet_qpromise.cpp" +void tst_QPromise::snippet_basicExample() +{ + snippet_QPromise::basicExample(); +} + +void tst_QPromise::snippet_multithreadExample() +{ + snippet_QPromise::multithreadExample(); +} + +void tst_QPromise::snippet_suspendExample() +{ + snippet_QPromise::suspendExample(); +} + QTEST_MAIN(tst_QPromise) #include "tst_qpromise.moc" -- cgit v1.2.3