diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativeinfo')
3 files changed, 47 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativeinfo/data/NestedComponent.qml b/tests/auto/declarative/qdeclarativeinfo/data/NestedComponent.qml new file mode 100644 index 0000000000..d8ae8ae3ba --- /dev/null +++ b/tests/auto/declarative/qdeclarativeinfo/data/NestedComponent.qml @@ -0,0 +1,23 @@ +import QtQuick 1.0 + +QtObject { + property variant nested + property variant nested2: nested.nested + + property variant component + component: Component { + id: myComponent + NestedObject { property string testProp: "test" } + } + + property variant component2 + component2: Component { + id: myComponent2 + Image { property string testProp: "test" } + } + + Component.onCompleted: { + nested = myComponent.createObject(0); + nested2 = myComponent2.createObject(0); + } +} diff --git a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro index 423390f13f..67b6b72e01 100644 --- a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro +++ b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro @@ -14,3 +14,4 @@ symbian: { CONFIG += parallel_test +QT += core-private gui-private declarative-private diff --git a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp index 7a65fc8b6c..c79516e0ef 100644 --- a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp +++ b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp @@ -60,6 +60,7 @@ public: private slots: void qmlObject(); void nestedQmlObject(); + void nestedComponent(); void nonQmlObject(); void nullObject(); void nonQmlContextedObject(); @@ -82,7 +83,7 @@ void tst_qdeclarativeinfo::qmlObject() QObject *object = component.create(); QVERIFY(object != 0); - QString message = component.url().toString() + ":3:1: QML QObject_QML_0: Test Message"; + QString message = component.url().toString() + ":3:1: QML QtObject: Test Message"; QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); qmlInfo(object) << "Test Message"; @@ -115,6 +116,27 @@ void tst_qdeclarativeinfo::nestedQmlObject() qmlInfo(nested2) << "Inner Object"; } +void tst_qdeclarativeinfo::nestedComponent() +{ + QDeclarativeComponent component(&engine, TEST_FILE("NestedComponent.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QObject *nested = qvariant_cast<QObject *>(object->property("nested")); + QVERIFY(nested != 0); + QObject *nested2 = qvariant_cast<QObject *>(object->property("nested2")); + QVERIFY(nested2 != 0); + + QString message = component.url().toString() + ":10:9: QML NestedObject: Complex Object"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + qmlInfo(nested) << "Complex Object"; + + message = component.url().toString() + ":16:9: QML Image: Simple Object"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + qmlInfo(nested2) << "Simple Object"; +} + void tst_qdeclarativeinfo::nonQmlObject() { QObject object; |