summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-03-24 02:42:04 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-03-24 03:30:50 (GMT)
commit364f6c200a6faac825c7f1e0158d708fc60a8ff5 (patch)
treea6c0d7632e2d06b65b5b211249b2990d1e3dd37c /tests
parent30275dfcb8c5303de201bc32fba2a6b9b26fa1cd (diff)
downloadQt-364f6c200a6faac825c7f1e0158d708fc60a8ff5.zip
Qt-364f6c200a6faac825c7f1e0158d708fc60a8ff5.tar.gz
Qt-364f6c200a6faac825c7f1e0158d708fc60a8ff5.tar.bz2
Fix Loader leak when loading a non-QGraphicsObject object.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeloader/data/nonItem.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp13
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeloader/data/nonItem.qml b/tests/auto/declarative/qdeclarativeloader/data/nonItem.qml
new file mode 100644
index 0000000..f42c1d5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeloader/data/nonItem.qml
@@ -0,0 +1,5 @@
+import Qt 4.6
+
+Loader {
+ sourceComponent: QtObject {}
+}
diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
index f27c1ce..7123dda 100644
--- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
+++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
@@ -91,6 +91,7 @@ private slots:
// void networkComponent();
void deleteComponentCrash();
+ void nonItem();
private:
QDeclarativeEngine engine;
@@ -485,6 +486,18 @@ void tst_QDeclarativeLoader::deleteComponentCrash()
delete item;
}
+void tst_QDeclarativeLoader::nonItem()
+{
+ QSKIP("QTBUG-9245", SkipAll);
+ QDeclarativeComponent component(&engine, TEST_FILE("/nonItem.qml"));
+ QTest::ignoreMessage(QtWarningMsg, "QML Loader (file://" SRCDIR "/data/nonItem.qml:3:1) Loader does not support loading non-visual elements.");
+ QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create());
+ QVERIFY(loader);
+ QVERIFY(loader->item() == 0);
+
+ delete loader;
+}
+
void tst_QDeclarativeLoader::networkSafety_data()
{
QTest::addColumn<QUrl>("url");