summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-03-28 16:32:00 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-04-12 01:57:15 +0200
commit2f95cd8f8b3a4d2216916fc55f15df5c901648f4 (patch)
treebd4e2b9b56eaad64fbea12c79d0eb9b1cdf148ae /tests/auto/corelib/thread/qpromise/tst_qpromise.cpp
parent82112db29df5065c89ccb2056a211f1858ffed28 (diff)
Long live QPromise::emplaceResult/At()!
And implement the rvalue overload of addResult() using it. [ChangeLog][QtCore][QPromise] Added emplaceResult() and emplaceResultAt() member functions. Fixes: QTBUG-112270 Change-Id: Id369542215a60c0818f1afa8d564498be84732e8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/corelib/thread/qpromise/tst_qpromise.cpp')
-rw-r--r--tests/auto/corelib/thread/qpromise/tst_qpromise.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp b/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp
index 09332f92ef..0b0e6c321f 100644
--- a/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp
+++ b/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp
@@ -203,12 +203,20 @@ void tst_QPromise::addResultWithBracedInitializer() // QTBUG-111826
{
QString strValue;
int intValue = 0;
+#ifndef __cpp_aggregate_paren_init // make emplacement work with MyClass
+ MyClass(QString s, int i) : strValue(std::move(s)), intValue(i) {}
+#endif
};
{
QPromise<MyClass> myPromise;
myPromise.addResult({"bar", 1});
}
+
+ {
+ QPromise<MyClass> myPromise;
+ myPromise.emplaceResult("bar", 1);
+ }
}
void tst_QPromise::addResultOutOfOrder()