diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-02-26 10:53:02 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-02 14:48:59 +0100 |
commit | 849de77470ca81bc97a547af28c4caa3b8a84078 (patch) | |
tree | 91fac20f584c89deb375363a94b73145828107ca /tests/auto/qml | |
parent | bf47d66216e649fe947956e02edd0a4b24ddb0fe (diff) |
[new compiler] Fix implicit component determination inside group properties
Don't only scan full-typed objects for property bindings that may define
components implicitly, do this for any types we know (propertyCache populated)
and that aren't explicitly of Component type.
Change-Id: I918b636be6d524e919cdd4efd49c33e63da64de3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/qml')
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/autoComponentCreationInGroupProperties.qml | 6 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/testtypes.h | 4 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 13 |
3 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/autoComponentCreationInGroupProperties.qml b/tests/auto/qml/qqmllanguage/data/autoComponentCreationInGroupProperties.qml new file mode 100644 index 0000000000..6dae861e62 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/autoComponentCreationInGroupProperties.qml @@ -0,0 +1,6 @@ +import Test 1.0 +MyTypeObject { + selfGroupProperty { + componentProperty : MyTypeObject { realProperty: 9 } + } +} diff --git a/tests/auto/qml/qqmllanguage/testtypes.h b/tests/auto/qml/qqmllanguage/testtypes.h index 27ad340256..5086180da1 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.h +++ b/tests/auto/qml/qqmllanguage/testtypes.h @@ -256,6 +256,8 @@ class MyTypeObject : public QObject Q_PROPERTY(MyGroupedObject *grouped READ grouped CONSTANT) Q_PROPERTY(MyGroupedObject *nullGrouped READ nullGrouped CONSTANT) + Q_PROPERTY(MyTypeObject *selfGroupProperty READ selfGroupProperty) + public: MyTypeObject() : objectPropertyValue(0), componentPropertyValue(0) {} @@ -550,6 +552,8 @@ public: MyGroupedObject *nullGrouped() { return 0; } + MyTypeObject *selfGroupProperty() { return this; } + void doAction() { emit action(); } signals: void action(); diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 826bd124b7..07644bef16 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -117,6 +117,7 @@ private slots: void dynamicSignalsAndSlots(); void simpleBindings(); void autoComponentCreation(); + void autoComponentCreationInGroupProperty(); void propertyValueSource(); void attachedProperties(); void dynamicObjects(); @@ -1351,6 +1352,18 @@ void tst_qqmllanguage::autoComponentCreation() QCOMPARE(child->realProperty(), qreal(9)); } +void tst_qqmllanguage::autoComponentCreationInGroupProperty() +{ + QQmlComponent component(&engine, testFileUrl("autoComponentCreationInGroupProperties.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->componentProperty() != 0); + MyTypeObject *child = qobject_cast<MyTypeObject *>(object->componentProperty()->create()); + QVERIFY(child != 0); + QCOMPARE(child->realProperty(), qreal(9)); +} + void tst_qqmllanguage::propertyValueSource() { { |