From 08ef73f94f6428f8cefc0386980b2ba1f63bee84 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Thu, 6 Feb 2025 16:13:32 +0100 Subject: [PATCH] tst_qfuture: silence all continuation overwrite warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit a30289ee0be41e8311aef6d8737885b354a9f047) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/corelib/thread/qfuture/tst_qfuture.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp index b3c5f757416..66477e6d505 100644 --- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp +++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp @@ -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::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 f1 = p.future(); f1.then([&firstExecuted](int) {