diff options
Diffstat (limited to 'tests/auto/declarative/qsgloader/tst_qsgloader.cpp')
-rw-r--r-- | tests/auto/declarative/qsgloader/tst_qsgloader.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/tests/auto/declarative/qsgloader/tst_qsgloader.cpp b/tests/auto/declarative/qsgloader/tst_qsgloader.cpp index cd4792532d..ba8d5e01d7 100644 --- a/tests/auto/declarative/qsgloader/tst_qsgloader.cpp +++ b/tests/auto/declarative/qsgloader/tst_qsgloader.cpp @@ -141,9 +141,14 @@ void tst_QSGLoader::sourceOrComponent() QCOMPARE(static_cast<QSGItem*>(loader)->childItems().count(), error ? 0: 1); if (!error) { - QDeclarativeComponent *c = qobject_cast<QDeclarativeComponent*>(loader->children().at(0)); - QVERIFY(c); - QCOMPARE(loader->sourceComponent(), c); + bool sourceComponentIsChildOfLoader = false; + for (int ii = 0; ii < loader->children().size(); ++ii) { + QDeclarativeComponent *c = qobject_cast<QDeclarativeComponent*>(loader->children().at(ii)); + if (c && c == loader->sourceComponent()) { + sourceComponentIsChildOfLoader = true; + } + } + QVERIFY(sourceComponentIsChildOfLoader); } if (sourceOrComponent == "component") { @@ -585,6 +590,24 @@ void tst_QSGLoader::active() delete object; } + + // check that the component isn't loaded until active is set to true + { + QDeclarativeComponent component(&engine, TEST_FILE("active.7.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("success").toBool(), true); + delete object; + } + + // check that the component is loaded if active is not set (true by default) + { + QDeclarativeComponent component(&engine, TEST_FILE("active.8.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("success").toBool(), true); + delete object; + } } void tst_QSGLoader::initialPropertyValues_data() |