Public bug reported:

See upstream bug https://bugreports.qt.io/browse/QTBUG-34878

There is already a fix upstream which has been merged to Qt5.8 ( see 
https://codereview.qt-project.org/#/c/158967/ )
Without that fix, all the unit tests relying on compare() to compare colours 
must be considered unreliable and potentially misleading, as they could be 
producing PASSes instead of FAILs.


Bug description copied from that link:
"QtTest's compare() function considers two colors (the QML basic type) as equal 
when they aren't.
I am aware that Qt.colorEqual exists (and it works correctly), but I think that 
this makes it far too easy to write tests that don't catch an error.
Consider the following test case:

import QtQuick 2.2
import QtTest 1.0

Item {
    Rectangle {
        id: black
        color: "#000000"
    }

    Rectangle {
        id: white
        color: "#ffffff"
    }

    TestCase {
        name: "ColorComparison"

        function test_this_should_fail() {
            compare(black.color, white.color)
        }

        function test_this_is_ok() {
            compare(black.color == white.color, false)
            compare(Qt.colorEqual(black.color, white.color), false)
        }
    }
}"

** Affects: qtdeclarative-opensource-src (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to qtdeclarative-opensource-
src in Ubuntu.
https://bugs.launchpad.net/bugs/1610349

Title:
  QML compare() does not reliably compare colours

Status in qtdeclarative-opensource-src package in Ubuntu:
  New

Bug description:
  See upstream bug https://bugreports.qt.io/browse/QTBUG-34878

  There is already a fix upstream which has been merged to Qt5.8 ( see 
https://codereview.qt-project.org/#/c/158967/ )
  Without that fix, all the unit tests relying on compare() to compare colours 
must be considered unreliable and potentially misleading, as they could be 
producing PASSes instead of FAILs.

  
  Bug description copied from that link:
  "QtTest's compare() function considers two colors (the QML basic type) as 
equal when they aren't.
  I am aware that Qt.colorEqual exists (and it works correctly), but I think 
that this makes it far too easy to write tests that don't catch an error.
  Consider the following test case:

  import QtQuick 2.2
  import QtTest 1.0

  Item {
      Rectangle {
          id: black
          color: "#000000"
      }

      Rectangle {
          id: white
          color: "#ffffff"
      }

      TestCase {
          name: "ColorComparison"

          function test_this_should_fail() {
              compare(black.color, white.color)
          }

          function test_this_is_ok() {
              compare(black.color == white.color, false)
              compare(Qt.colorEqual(black.color, white.color), false)
          }
      }
  }"

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qtdeclarative-opensource-src/+bug/1610349/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to