aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2011-08-02 10:04:16 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-02 08:50:21 +0200
commit0db6db0263defcd6ff84769b7d927d5a51606f6c (patch)
treeec30dca485b9cf576a70d4b232d6525f3d569c90 /tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml
parent29e71ca376f48bafc2105b656a702f3edd4501a8 (diff)
Add support for comparing value-type properties
This commit allows value-types to be compared with each other and with variants. It also adds a toString() function for each value type, to allow conversion to (and comparison with) string. Task-number: QTBUG-14731 Change-Id: I5bde2820917b2fe19b581724977398680617de34 Reviewed-on: http://codereview.qt.nokia.com/1636 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml')
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml
new file mode 100644
index 0000000000..7bda1d17f4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml
@@ -0,0 +1,23 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_x: vector.x
+ property real v_y: vector.y
+ property real v_z: vector.z
+ property variant copy: vector
+ property string tostring: vector.toString()
+
+ // compare to string
+ property bool equalsString: (vector == tostring)
+
+ // compare vector3ds to various value types
+ property bool equalsColor: (vector == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (vector == Qt.vector3d(23.88, 3.1, 4.3)) // true
+ property bool equalsSize: (vector == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (vector == Qt.point(10, 4)) // false
+ property bool equalsRect: (vector == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (vector == vector) // true
+ property bool equalsOther: (vector == Qt.vector3d(3.1, 2.2, 923.2)) // false
+}
+