Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-94552 Add descriptive QCOMPARE failure messages for Qt types
  3. QTBUG-92102

Add descriptive QCOMPARE failure messages for pointers

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: Testing: qtestlib
    • Labels:
      None

      Description

      If I compare two QQuickItem pointers, for example

      QCOMPARE(dialogHelper.window()->activeFocusItem(), expectedFocusItem);
      

      and the comparison fails, I get this output:

      FAIL!  : tst_QQuickFileDialogImpl::tabFocusNavigation() Compared pointers are not the same
         Loc: [/home/mitch/dev/qt-dev/qtquickcontrols2/tests/auto/dialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp(991)]
      

      compare that to e.g. comparing two ints:

      FAIL!  : tst_QQuickFileDialogImpl::tabFocusNavigation() Compared values are not the same
         Actual   (1): 1
         Expected (2): 2
         Loc: [/home/mitch/dev/qt-dev/qtquickcontrols2/tests/auto/dialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp(994)]
      

      It would be useful to know what the actual values of the pointers are. For example, if I do:

      qDebug() << "  Actual:" << dialogHelper.window()->activeFocusItem();
      qDebug() << "Expected:" << expectedFocusItem;
      

      I get:

      QDEBUG : tst_QQuickFileDialogImpl::tabFocusNavigation()   Actual: "ComboBox_QMLTYPE_15(0x611000170880, parent=0x611000170740, geometry=20,20 326x40)"
      QDEBUG : tst_QQuickFileDialogImpl::tabFocusNavigation() Expected: "FileDialogDelegate_QMLTYPE_7(0x611000124fc0, name=\"fileDialogDelegate0\", parent=0x6030002036b0, geometry=0,0 558x40, z=1)"
      

        Attachments

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

          Activity

            People

            Assignee:
            macadder Jason McDonald
            Reporter:
            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