aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2011-09-08 15:13:42 +1000
committerQt by Nokia <qt-info@nokia.com>2011-09-19 07:31:00 +0200
commit85554f7f262ff5aae15562b11c6d08bcc03c961f (patch)
tree42208f1b3ea9ea02ec482314d9a99fa1b701793c /tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
parent1aa075b6319ded90d79dfe28605294283502bead (diff)
Fix QDeclarativeListProperty assignment
This commit ensures that a QDeclarativeListReference can be assigned to another QDeclarativeListProperty, by retrieving each element in the list reference and converting to the appropriate type before appending to the target list property. Task-number: QTBUG-16316 Change-Id: Id8858058f052a53bf43eadc085fd278654478d77 Reviewed-on: http://codereview.qt-project.org/4388 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index b732cd8193..dc3f053e17 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -131,6 +131,7 @@ private slots:
void jsObject();
void undefinedResetsProperty();
void listToVariant();
+ void listAssignment();
void multiEngineObject();
void deletedObject();
void attachedPropertyScope();
@@ -2233,6 +2234,21 @@ void tst_qdeclarativeecmascript::listToVariant()
delete object;
}
+// QTBUG-16316
+Q_DECLARE_METATYPE(QDeclarativeListProperty<MyQmlObject>)
+void tst_qdeclarativeecmascript::listAssignment()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("listAssignment.qml"));
+ QObject *obj = component.create();
+ QCOMPARE(obj->property("list1length").toInt(), 2);
+ QDeclarativeListProperty<MyQmlObject> list1 = obj->property("list1").value<QDeclarativeListProperty<MyQmlObject> >();
+ QDeclarativeListProperty<MyQmlObject> list2 = obj->property("list2").value<QDeclarativeListProperty<MyQmlObject> >();
+ QCOMPARE(list1.count(&list1), list2.count(&list2));
+ QCOMPARE(list1.at(&list1, 0), list2.at(&list2, 0));
+ QCOMPARE(list1.at(&list1, 1), list2.at(&list2, 1));
+ delete obj;
+}
+
// QTBUG-7957
void tst_qdeclarativeecmascript::multiEngineObject()
{