summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/thread
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-12-29 08:03:49 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-12-30 07:03:51 +0100
commitf68a2316d8b265a1827bd905170b3006f8533db4 (patch)
tree16e6239de538b07915cf4b6118ae244b45a09a2e /tests/auto/corelib/thread
parent114b94c26e990c792f2735b1104dd094ada714f6 (diff)
Long live QPromise::addResults()!
Makes the pre-existing QFutureInterface functionality available via the public QPromise API. [ChangeLog][QtCore][QPromise] Added addResults() to report multiple results at once. Change-Id: I18e6ef2781df422020b9022d78d6c45107b01668 Reviewed-by: Sona Kurazyan <kurazyan.sona@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/corelib/thread')
-rw-r--r--tests/auto/corelib/thread/qpromise/tst_qpromise.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp b/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp
index 12206aa9fc..c63fb74616 100644
--- a/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp
+++ b/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp
@@ -168,6 +168,15 @@ void tst_QPromise::addResult()
QCOMPARE(f.resultCount(), 3);
QCOMPARE(f.resultAt(2), result);
}
+ // add multiple results in one go:
+ {
+ QList results = {42, 4242, 424242};
+ QVERIFY(promise.addResults(results));
+ QCOMPARE(f.resultCount(), 6);
+ QCOMPARE(f.resultAt(3), 42);
+ QCOMPARE(f.resultAt(4), 4242);
+ QCOMPARE(f.resultAt(5), 424242);
+ }
// add as lvalue at position and overwrite
{
int result = -1;