summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-05-04 11:23:44 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-05-04 19:40:32 +0200
commitf7d1dc0eeeca42c07b42d3a851c52ccf84e946e5 (patch)
treed4bb28629d22f0b39873a0b830b3ecf164a9a402
parenta43ca591c1835c27fd2acd63298c42f51b470f8e (diff)
tst_qthreadpool: expect a warning, cleaning up the test run
Change-Id: Ie9944d05e7afe5740ed10eef39c2df9281985002 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
index 0c4f11a0dc..775dd85b86 100644
--- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
+++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
@@ -1468,6 +1468,10 @@ void tst_QThreadPool::threadReuse()
void tst_QThreadPool::nullFunctions()
{
+ const auto expectWarning = [] {
+ QTest::ignoreMessage(QtMsgType::QtWarningMsg,
+ "Trying to create null QRunnable. This may stop working.");
+ };
// Note this is not necessarily testing intended behavior, only undocumented behavior.
// If this is changed it should be noted in Behavioral Changes.
FunctionPointer nullFunction = nullptr;
@@ -1475,10 +1479,14 @@ void tst_QThreadPool::nullFunctions()
{
TestThreadPool manager;
// should not crash:
+ expectWarning();
manager.start(nullFunction);
+ expectWarning();
manager.start(nullStdFunction);
// should fail (and not leak):
+ expectWarning();
QVERIFY(!manager.tryStart(nullStdFunction));
+ expectWarning();
QVERIFY(!manager.tryStart(nullFunction));
}
}