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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.7.0
    • Testing: QuickTest
    • None

      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/

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes