aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2012-02-24 14:40:11 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-27 02:39:41 +0100
commitd2921ffc52fed380326f8abb86d6d659cc47f9d1 (patch)
tree88502570f2e5b3fee145dc89608f21ab018c3e90 /tests
parentde02b0f6ba4c422ff617308617b32804b15d1f7e (diff)
Check engine equality condition inside null ptr check
Previously, we asserted if the engine associated with the two external resources from the arguments to the object comparison callback were not equal, prior to checking that the external resources were non-null. Task-number: QTBUG-24489 Change-Id: I4b2bd2377fcf38163d1341e43e056b1405ab72ac Reviewed-by: Yunqiao Yin <charles.yin@nokia.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/nonValueTypeComparison.qml10
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp13
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/nonValueTypeComparison.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/nonValueTypeComparison.qml
new file mode 100644
index 0000000000..0ffa5eb666
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/nonValueTypeComparison.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Item {
+ property variant somepoint: Qt.point(1,2)
+ property variant randomjsobj: {"some": 1, "thing": 2}
+ property bool test1: somepoint != randomjsobj
+
+ property variant similar: {"x":1, "y":2}
+ property bool test2: somepoint != similar
+}
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
index 72ec7a5abf..e701efa2a4 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
+++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
@@ -93,6 +93,7 @@ private slots:
void returnValues();
void varAssignment();
void bindingsSpliceCorrectly();
+ void nonValueTypeComparison();
private:
QDeclarativeEngine engine;
@@ -1301,6 +1302,18 @@ void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly()
}
}
+void tst_qdeclarativevaluetypes::nonValueTypeComparison()
+{
+ QDeclarativeComponent component(&engine, testFileUrl("nonValueTypeComparison.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+
+ delete object;
+}
+
QTEST_MAIN(tst_qdeclarativevaluetypes)
#include "tst_qdeclarativevaluetypes.moc"