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

QtDeclarative QmlTest QuickTestResult is not finalised properly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.10.1
    • Fix Version/s: None
    • Component/s: Testing: QuickTest
    • Labels:
      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():

      /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.

        Attachments

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

          Activity

            People

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

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes