Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.10.1
-
None
Description
There is a logical issue in private Qt class at \Src\qtdeclarative\src\qmltest\quicktestresult.cpp. QuickTestResult::startLogging() uses global static loggingStarted variable, which is set to true on the first call of this function and after that never returns back to false. Restarting testing environment the second time in the same session is desirable. This issue, however, makes it problematic: everything still works fine except for one thing – ignoreWarning statement in qml test does not recognize console.warn output because it doesn't get properly formatted since QTestLog custom message handler is not installed the second time.
A possible solution would be to reset loggingStarted flag in QuickTestResult::stopLogging():
void QuickTestResult::stopLogging() { Q_D(QuickTestResult); + loggingStarted = false; if (globalProgramName) return; // Logging will be stopped by setProgramName(0). QTestResult::setCurrentTestObject(d->intern(d->testCaseName).constData()); QTestLog::stopLogging(); }
It may be an uncommon use case for QmlTest functionality, but the bug is apparent, and it would be nice to have it addressed.