aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlproperty/data
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2012-05-09 12:21:41 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-16 02:14:57 +0200
commit14e247e4b94df17ed62750b4468c2ac25aabe30f (patch)
tree59784d82bbc05887c6c11e7babdf9cc5575c345a /tests/auto/qml/qqmlproperty/data
parentb22496ba74c0106d949b970fb799fd3fa81243c4 (diff)
Fix composite type property support
The metatype changes caused a regression in composite type properties for which there was no autotest. In particular, declarative previously used the transitional QMetaType::registerType() function, whose implementation specifies a zero-size, which means that accessing a property of that type via QObject::property would fail. This commit adds some unit tests to track the issue, and also fixes the implementation of QQmlEnginePrivate::registerCompositeType to use the updated metatype registration functions. Task-number: QTBUG-25697 Change-Id: Ic4abc1711aee8cf4a50a2ef1769465ef73f5d022 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlproperty/data')
-rw-r--r--tests/auto/qml/qqmlproperty/data/SecondComponent.qml6
-rw-r--r--tests/auto/qml/qqmlproperty/data/componentDir/FirstComponent.qml5
-rw-r--r--tests/auto/qml/qqmlproperty/data/registeredCompositeTypeProperty.qml32
3 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlproperty/data/SecondComponent.qml b/tests/auto/qml/qqmlproperty/data/SecondComponent.qml
new file mode 100644
index 0000000000..45d81c9010
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/SecondComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ property string a: "Hello, World"
+ property bool b: false
+}
diff --git a/tests/auto/qml/qqmlproperty/data/componentDir/FirstComponent.qml b/tests/auto/qml/qqmlproperty/data/componentDir/FirstComponent.qml
new file mode 100644
index 0000000000..1b7614dc07
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/componentDir/FirstComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property int a: 10
+}
diff --git a/tests/auto/qml/qqmlproperty/data/registeredCompositeTypeProperty.qml b/tests/auto/qml/qqmlproperty/data/registeredCompositeTypeProperty.qml
new file mode 100644
index 0000000000..92e1675d11
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/registeredCompositeTypeProperty.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+import "componentDir"
+
+Item {
+ id: root
+
+ property FirstComponent first: FirstComponent { }
+ property FirstComponent second
+ property SecondComponent third: SecondComponent { }
+
+ property list<FirstComponent> fclist: [
+ FirstComponent {
+ a: 15
+ }
+ ]
+ property list<SecondComponent> sclistOne: [
+ SecondComponent {
+ a: "G'day, World"
+ },
+ SecondComponent { },
+ SecondComponent {
+ b: true
+ }
+ ]
+ property list<SecondComponent> sclistTwo
+
+ Component.onCompleted: {
+ var c1 = Qt.createComponent("./componentDir/FirstComponent.qml");
+ var o1 = c1.createObject(root);
+ second = o1;
+ }
+}