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

TestCase: add support for ignoreWarning() that ignores the line/column numbers

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Duplicate
    • Affects Version/s: 5.7.0
    • Fix Version/s: None
    • Component/s: Testing: QuickTest
    • Labels:
      None

      Description

      It is difficult to test warnings in QML tests, when there are QML warnings with line numbers involved. When the tested component instance is created within the test QML file, the warning URL must manually resolved and the line numbers must be updated whenever the tests change in a way that it affects the line numbers. For example, adding an import.

      TestCase {
          id: testCase
      
          Component {
              id: testComponent
              FooBar { }
          }
      
          function test_something() {
              var object = testComponent.createObject(testCase)
              ignoreWarning(Qt.resolvedUrl("tst_foo.qml") + ":123:45: QML FooBar: cannot do something so i'm throwing a warning")
          }
      }
      

      See for example https://codereview.qt-project.org/#/c/172758/

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              w00t Robin Burchell
              Reporter:
              jpnurmi J-P Nurmi
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes