summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-04-30 05:48:13 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-04-30 05:50:21 (GMT)
commitdeb92c796c727c6ad0eaf28929cda6d000c1b3c1 (patch)
tree2c9cc6efb5500e7e90fb44e115ea5b2483d0381a /tests/auto
parente4b865ef512e338cf495226dc98540f45fba1d9f (diff)
downloadQt-deb92c796c727c6ad0eaf28929cda6d000c1b3c1.zip
Qt-deb92c796c727c6ad0eaf28929cda6d000c1b3c1.tar.gz
Qt-deb92c796c727c6ad0eaf28929cda6d000c1b3c1.tar.bz2
Fix assignment of value types to javascript var.
Make sure the scriptclass is used. Task-number: QTBUG-10329 Reviewed-by: Aaron Kennedy
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml14
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp14
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml
new file mode 100644
index 0000000..e4715ab
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml
@@ -0,0 +1,14 @@
+import Qt 4.7
+
+QtObject {
+ property int x;
+ property int y;
+ property int z;
+
+ Component.onCompleted: {
+ var vec3 = Qt.vector3d(1, 2, 3);
+ x = vec3.x;
+ y = vec3.y;
+ z = vec3.z;
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
index c18fbf5..95b9baa 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
+++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
@@ -84,6 +84,7 @@ private slots:
void enums();
void conflictingBindings();
void returnValues();
+ void varAssignment();
private:
QDeclarativeEngine engine;
@@ -911,6 +912,19 @@ void tst_qdeclarativevaluetypes::returnValues()
delete object;
}
+void tst_qdeclarativevaluetypes::varAssignment()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("varAssignment.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("x").toInt(), 1);
+ QCOMPARE(object->property("y").toInt(), 2);
+ QCOMPARE(object->property("z").toInt(), 3);
+
+ delete object;
+}
+
QTEST_MAIN(tst_qdeclarativevaluetypes)
#include "tst_qdeclarativevaluetypes.moc"