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

QtTest comparing two urls gives wrong results

XMLWordPrintable

    • 99651acdf7f34ad976522f12eb89ea8fc19ee0a5

      Comparing two value of type url with compare() seems to always pass with QtTest - even when the URLs are not the same. Works as expected with verify() and using compare() with string.

      import QtQuick 2.0
      import QtTest 1.0
      Item {
          resources: TestCase {
              
              name: "URL" 
              property url path1: "path1"
              property url path2: "path2"
      
              function test_url_compare() { 
                  // passes even though should fail! 
                  compare(path1, path2)
              } 
              function test_url_compare_string() {
                  // fails as it should
                  compare(path1.toString(), path2.toString())
              }
              function test_url_verify() { 
                  // fails as it should 
                  verify(path1 == path2)
              }
          }
      }

       

      Similar to this issue: https://bugreports.qt.io/browse/QTBUG-22255 , but Qt.resolvedUrl() return string type, not url type, then this works with compare().

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

            liaqi Liang Qi
            gbdivers Guillaume Belz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes