aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2012-03-14 11:35:13 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-15 13:18:17 +0100
commit20ffaaf2977255147ad8a45762d5efb6b5635829 (patch)
treefa163034fac34b6a7dcc731e63ac9d1ae3148e54 /tests
parent49b451dae44d801524288d16d8f45a3ef583275e (diff)
Fix bug in v4 strict equality.
Change-Id: I184065e0b7c8c6536f2081b9bf03e98992a4c9fe Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/v4/data/equals.qml48
-rw-r--r--tests/auto/qml/v4/data/strictEquals.qml48
-rw-r--r--tests/auto/qml/v4/tst_v4.cpp2
3 files changed, 98 insertions, 0 deletions
diff --git a/tests/auto/qml/v4/data/equals.qml b/tests/auto/qml/v4/data/equals.qml
new file mode 100644
index 0000000000..c32603cc7e
--- /dev/null
+++ b/tests/auto/qml/v4/data/equals.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject myprop1: null
+ property QtObject myprop2: QtObject {}
+ property real zero: 0
+ property bool falseProp: false
+
+ property bool test1: myprop1 == false
+ property bool test2: myprop1 == null
+ property bool test3: 5 == myprop1
+ property bool test4: null == myprop1
+ property bool test5: myprop1 != false
+ property bool test6: myprop1 != null
+ property bool test7: 5 != myprop1
+ property bool test8: null != myprop1
+
+ property bool test9: myprop2 == false
+ property bool test10: myprop2 == null
+ property bool test11: 5 == myprop2
+ property bool test12: null == myprop2
+ property bool test13: myprop2 != false
+ property bool test14: myprop2 != null
+ property bool test15: 5 != myprop2
+ property bool test16: null != myprop2
+
+ property bool test17: myprop1 == myprop1
+ property bool test18: myprop1 != myprop1
+ property bool test19: myprop1 == myprop2
+ property bool test20: myprop1 != myprop2
+ property bool test21: myprop2 == myprop2
+ property bool test22: myprop2 != myprop2
+
+ property bool test23: myprop1 == "hello"
+ property bool test24: myprop1 != "hello"
+ property bool test25: myprop2 == "hello"
+ property bool test26: myprop2 != "hello"
+
+ property bool test27: falseProp == zero
+ property bool test28: falseProp != zero
+ property bool test29: falseProp == 1
+ property bool test30: falseProp != 1
+ property bool test31: true == zero
+ property bool test32: true != zero
+ property bool test33: true == 1
+ property bool test34: true != 1
+}
+
diff --git a/tests/auto/qml/v4/data/strictEquals.qml b/tests/auto/qml/v4/data/strictEquals.qml
new file mode 100644
index 0000000000..3f4d0d8b3f
--- /dev/null
+++ b/tests/auto/qml/v4/data/strictEquals.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject myprop1: null
+ property QtObject myprop2: QtObject {}
+ property real zero: 0
+ property bool falseProp: false
+
+ property bool test1: myprop1 === false
+ property bool test2: myprop1 === null
+ property bool test3: 5 === myprop1
+ property bool test4: null === myprop1
+ property bool test5: myprop1 !== false
+ property bool test6: myprop1 !== null
+ property bool test7: 5 !== myprop1
+ property bool test8: null !== myprop1
+
+ property bool test9: myprop2 === false
+ property bool test10: myprop2 === null
+ property bool test11: 5 === myprop2
+ property bool test12: null === myprop2
+ property bool test13: myprop2 !== false
+ property bool test14: myprop2 !== null
+ property bool test15: 5 !== myprop2
+ property bool test16: null !== myprop2
+
+ property bool test17: myprop1 === myprop1
+ property bool test18: myprop1 !== myprop1
+ property bool test19: myprop1 === myprop2
+ property bool test20: myprop1 !== myprop2
+ property bool test21: myprop2 === myprop2
+ property bool test22: myprop2 !== myprop2
+
+ property bool test23: myprop1 === "hello"
+ property bool test24: myprop1 !== "hello"
+ property bool test25: myprop2 === "hello"
+ property bool test26: myprop2 !== "hello"
+
+ property bool test27: falseProp === zero
+ property bool test28: falseProp !== zero
+ property bool test29: falseProp === 1
+ property bool test30: falseProp !== 1
+ property bool test31: true === zero
+ property bool test32: true !== zero
+ property bool test33: true === 1
+ property bool test34: true !== 1
+}
+
diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp
index ed65cd2a82..1c89617157 100644
--- a/tests/auto/qml/v4/tst_v4.cpp
+++ b/tests/auto/qml/v4/tst_v4.cpp
@@ -124,6 +124,8 @@ void tst_v4::qtscript_data()
{
QTest::addColumn<QString>("file");
+ QTest::newRow("equals") << "equals.qml";
+ QTest::newRow("strict equals") << "strictEquals.qml";
QTest::newRow("qreal -> int rounding") << "qrealToIntRounding.qml";
QTest::newRow("exception on fetch") << "fetchException.qml";
QTest::newRow("logical or") << "logicalOr.qml";