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

QAbstractItemModelTester doesn't indicate which model failed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5
    • Testing: qtestlib
    • None

    Description

      I want to test every model in my application during integration testing, so I do this in initTestCase():

          auto models = window->findChildren<QAbstractItemModel*>();
          for (const auto model : models)
              new QAbstractItemModelTester(model);
      

      The problem is that if QAbstractItemModelTester sees an issue and causes a test failure, I have no idea which model is at fault:

      FAIL!  : tst_Stuff::initTestCase() 'model->hasChildren(topIndex)' returned FALSE. ()
         Loc: [/Users/mitch/dev/qt-dev/qtbase/src/testlib/qabstractitemmodeltester.cpp(409)]
      FAIL!  : tst_Stuff::initTestCase() Compared values are not the same
         Actual   (model->parent(childIndex)): QModelIndex(-1,-1,0x0,0x0)
         Expected (topIndex)                 : QModelIndex(0,0,0x0,0x137361d40)
         Loc: [/Users/mitch/dev/qt-dev/qtbase/src/testlib/qabstractitemmodeltester.cpp(503)]
      

      It should identify the model in the failure message.

      Attachments

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

        Activity

          People

            macadder Jason McDonald
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes