summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2020-11-13 14:09:15 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2020-11-13 20:31:22 +0100
commit2bce62a3189fc7d6822dc0ee7c07d274cda2f193 (patch)
treee9f7771c3e99d6d6e7312897a0f9cc3b8a845abf /tests/auto/corelib
parent1c4ddbafbba68611a432721d3d2997683b789b2e (diff)
Conditionally disable code snippets that depend on cxx11_future
Fixes: QTBUG-88392 Change-Id: Ida215253fdcad66a5a67084d3ff6781583101859 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp b/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp
index 65a0921616..fec23c1e81 100644
--- a/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp
+++ b/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp
@@ -71,6 +71,7 @@ public:
void snippet_QPromise::basicExample()
{
+#if QT_CONFIG(cxx11_future)
//! [basic]
QPromise<int> promise;
QFuture<int> future = promise.future();
@@ -88,10 +89,12 @@ void snippet_QPromise::basicExample()
QCOMPARE(future.result(), 42);
thread->wait();
+#endif
}
void snippet_QPromise::multithreadExample()
{
+#if QT_CONFIG(cxx11_future)
//! [multithread_init]
QSharedPointer<QPromise<int>> sharedPromise(new QPromise<int>());
QFuture<int> future = sharedPromise->future();
@@ -133,10 +136,12 @@ void snippet_QPromise::multithreadExample()
for (auto& t : threads)
t->wait();
sharedPromise->finish();
+#endif
}
void snippet_QPromise::suspendExample()
{
+#if QT_CONFIG(cxx11_future)
//! [suspend_start]
// Create promise and future
QPromise<int> promise;
@@ -194,4 +199,5 @@ void snippet_QPromise::suspendExample()
QList<int> expected(100);
std::iota(expected.begin(), expected.end(), 0);
QCOMPARE(future.results(), expected);
+#endif
}