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

Potential gap in QtQuickTest::compare* APIs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.10
    • Fix Version/s: None
    • Component/s: Testing: QuickTest
    • Labels:
      None

      Description

      In many places in auto tests we do this:

      compare(qtest_compareInternal(null, null), true, "null");
      

      or after refactoring from https://codereview.qt-project.org/#/c/212635/ :

      compare(Compare.compareInternal(null, null), true, "null");
      

      Which actually could be a useful public API, something like:

      compare(a, b, bool expected, msg)

      or maybe:

      compareNotEqual() as alternative for compare(), which compares for "is-equal" and fails if it is not. And maybe this automatic failure behavior is the reason for the following hack (from http://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/imports/testlib/main.cpp#n112):

          bool compare(const QVariant& act, const QVariant& exp) const {
              return act == exp;
          }
      

      Which is not really an alternative, because:

      1) it is hackish, non public API
      2) it compares QVariants, which is different from comparison algorithm used by JS implementation.
      3) this function also doesn't seem to be used anywhere, which indicates that it is not very useful (or maybe just well hidden... but see that two reasons above )

        Attachments

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

          Activity

            People

            • Assignee:
              paeglis Gatis Paeglis
              Reporter:
              paeglis Gatis Paeglis
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes