Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-66486

QtDeclarative QmlTest QuickTestResult is not finalised properly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.10.1
    • Testing: QuickTest
    • None

      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():

      /Src/qtdeclarative/src/qmltest/quicktestresult.cpp
      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.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            dzmitry.mazouka Dzmitry Mazouka
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes