From 247f6a34d161f10c4f6d5d516b8bfb7043ca78a2 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 5 Mar 2014 10:21:52 +0100 Subject: [new compiler] Fix auto component creation with composite types A binding like this property Component foo: SomeComposite {} should not do an implicit component insertion if SomeComposite is actually a component. The property assignment is compatible and can proceed normally. Fixes tst_qquickcanvasitem, but added a separate unit test for this case. Change-Id: I7221eebd38dba3f2a82b59341739b9b67211e352 Reviewed-by: Lars Knoll --- tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 28 +++++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp') diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 07644bef16..3a52d586ea 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -1342,14 +1342,26 @@ void tst_qqmllanguage::simpleBindings() void tst_qqmllanguage::autoComponentCreation() { - QQmlComponent component(&engine, testFileUrl("autoComponentCreation.qml")); - VERIFY_ERRORS(0); - MyTypeObject *object = qobject_cast(component.create()); - QVERIFY(object != 0); - QVERIFY(object->componentProperty() != 0); - MyTypeObject *child = qobject_cast(object->componentProperty()->create()); - QVERIFY(child != 0); - QCOMPARE(child->realProperty(), qreal(9)); + { + QQmlComponent component(&engine, testFileUrl("autoComponentCreation.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QVERIFY(object->componentProperty() != 0); + MyTypeObject *child = qobject_cast(object->componentProperty()->create()); + QVERIFY(child != 0); + QCOMPARE(child->realProperty(), qreal(9)); + } + { + QQmlComponent component(&engine, testFileUrl("autoComponentCreation.2.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QVERIFY(object->componentProperty() != 0); + MyTypeObject *child = qobject_cast(object->componentProperty()->create()); + QVERIFY(child != 0); + QCOMPARE(child->realProperty(), qreal(9)); + } } void tst_qqmllanguage::autoComponentCreationInGroupProperty() -- cgit v1.2.3