tst_qfuture: silence all continuation overwrite warnings

Introduce a helper function to silence this lengthy warning, and use
it consistently in all places where the warning was triggered.

Amends 502a7706b94380d4957a7e594fc7c4c4db8ae81b which introduced the
warning.

Pick-to: 6.8 6.5
Change-Id: Ifa5c7e0182a12885af4db42ef5d68b1f27a0c6bc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a30289ee0be41e8311aef6d8737885b354a9f047)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ivan Solovev 2025-02-06 16:13:32 +01:00 committed by Qt Cherry-pick Bot
parent 59a571c75d
commit 08ef73f94f

View File

@ -276,6 +276,13 @@ private:
QtPrivate::ResultStoreBase &store;
};
static void suppressContinuationOverrideWarning()
{
QTest::ignoreMessage(QtWarningMsg,
"Adding a continuation to a future which already has a continuation. "
"The existing continuation is overwritten.");
}
void tst_QFuture::compareCompiles()
{
QTestPrivate::testEqualityOperatorsCompile<QFuture<int>::const_iterator>();
@ -4560,6 +4567,7 @@ void tst_QFuture::whenAllIteratorsWithFailed()
QCOMPARE(results.size(), 2);
QCOMPARE(results[1].result(), 1);
// A shorter way of handling the exception
suppressContinuationOverrideWarning();
results[0].onFailed([&](const QException &) {
finished = true;
return 0;
@ -4715,6 +4723,7 @@ void tst_QFuture::whenAllDifferentTypesWithFailed()
QVERIFY(f.isFinished());
bool failed = false;
// A shorter way of handling the exception
suppressContinuationOverrideWarning();
f.onFailed([&](const QException &) {
failed = true;
return -1;
@ -4969,9 +4978,7 @@ void tst_QFuture::continuationOverride()
bool firstExecuted = false;
bool secondExecuted = false;
QTest::ignoreMessage(QtWarningMsg,
"Adding a continuation to a future which already has a continuation. "
"The existing continuation is overwritten.");
suppressContinuationOverrideWarning();
QFuture<int> f1 = p.future();
f1.then([&firstExecuted](int) {