Currently UnitTest::_strictLogCheck defaults to false and only QmlUITestBase opts in via setStrictLogCheck(true). This means any unexpected qCWarning or qCDebug from production code that fires during a unit test is silently ignored.
All unit tests should run in strict mode so that unexpected log output (warnings, debug messages from any category) causes a test failure. This would catch regressions where code paths emit unexpected warnings during tests.
Change needed: Set _strictLogCheck = true by default in UnitTest, or call setStrictLogCheck(true) in UnitTest::init(). Tests that legitimately emit warnings would need to use expectLogMessage() to declare them.
Related: bare qDebug() in test code silently passes CI
Several test files contain bare qDebug() calls (uncategorized, category = "default"). These cause QFAIL locally in a Debug build because Qt's built-in filter enables the default category debug messages, which are then captured and flagged by cleanup().
However, they pass silently in CI because cmake/QGCTest.cmake sets the CTest ENVIRONMENT property:
set(_test_env "QT_LOGGING_RULES=*.debug=false")
This suppresses all debug-level messages — including the default category — before they reach the message handler, so captureIfEnabled() never sees them and cleanup() finds nothing to fail on.
This means the bare qDebug() hygiene check only works locally and is invisible in CI. The fix for the existing bare qDebug() calls has already been applied (replaced with qCDebug(UnitTestLog)), but the underlying asymmetry between local and CI behavior should be documented and understood when enabling strict mode globally.
Currently
UnitTest::_strictLogCheckdefaults tofalseand onlyQmlUITestBaseopts in viasetStrictLogCheck(true). This means any unexpectedqCWarningorqCDebugfrom production code that fires during a unit test is silently ignored.All unit tests should run in strict mode so that unexpected log output (warnings, debug messages from any category) causes a test failure. This would catch regressions where code paths emit unexpected warnings during tests.
Change needed: Set
_strictLogCheck = trueby default inUnitTest, or callsetStrictLogCheck(true)inUnitTest::init(). Tests that legitimately emit warnings would need to useexpectLogMessage()to declare them.Related: bare
qDebug()in test code silently passes CISeveral test files contain bare
qDebug()calls (uncategorized, category ="default"). These cause QFAIL locally in a Debug build because Qt's built-in filter enables thedefaultcategory debug messages, which are then captured and flagged bycleanup().However, they pass silently in CI because
cmake/QGCTest.cmakesets the CTestENVIRONMENTproperty:This suppresses all debug-level messages — including the
defaultcategory — before they reach the message handler, socaptureIfEnabled()never sees them andcleanup()finds nothing to fail on.This means the bare
qDebug()hygiene check only works locally and is invisible in CI. The fix for the existing bareqDebug()calls has already been applied (replaced withqCDebug(UnitTestLog)), but the underlying asymmetry between local and CI behavior should be documented and understood when enabling strict mode globally.