summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-04-20 00:05:39 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-04-20 00:05:39 (GMT)
commit1b80a6bc28cb49b9f6e1a2132d929819924aa604 (patch)
treed0de1b7639a4b9259af5b97488e339f604f83e46 /tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
parent18cbadd8edd233b843d04441a05788264da0a67b (diff)
downloadQt-1b80a6bc28cb49b9f6e1a2132d929819924aa604.zip
Qt-1b80a6bc28cb49b9f6e1a2132d929819924aa604.tar.gz
Qt-1b80a6bc28cb49b9f6e1a2132d929819924aa604.tar.bz2
Allow Loader sourceComponent to be set to undefeined.
Diffstat (limited to 'tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
index 1b17a56..a5f75bd 100644
--- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
+++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
@@ -198,6 +198,26 @@ void tst_QDeclarativeLoader::clear()
delete item;
}
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("/SetSourceComponent.qml"));
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item);
+
+ QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(item->QGraphicsObject::children().at(1));
+ QVERIFY(loader);
+ QVERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1);
+
+ QMetaObject::invokeMethod(item, "clear");
+
+ QVERIFY(loader->item() == 0);
+ QCOMPARE(loader->progress(), 0.0);
+ QCOMPARE(loader->status(), QDeclarativeLoader::Null);
+ QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0);
+
+ delete item;
+ }
}
void tst_QDeclarativeLoader::urlToComponent()