aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
diff options
context:
space:
mode:
authorMichael Brasser <mbrasser@ford.com>2017-12-21 11:03:53 -0600
committerMichael Brasser <michael.brasser@live.com>2017-12-29 02:30:32 +0000
commit78a5add79497300802c2152b5bf561b6bef305f1 (patch)
tree4840dfc5d192ac57d3c3faae91ec791ae1d8d84d /tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
parent6f6fa9ee929292639a24f2b15c432a41df92610d (diff)
Remove extra addref
The code was previously updated to use QQmlRefPointer, so we shouldn't explicitly addref. This allows more components to be correctly trimmed when needed. Change-Id: I15a961cfc456eeab5c791c8a282cc7e2852912cb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp')
-rw-r--r--tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
index 5ab729042f..5a3d76e903 100644
--- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
+++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
@@ -44,6 +44,7 @@ private slots:
void loadComponentSynchronously();
void trimCache();
void trimCache2();
+ void trimCache3();
void keepSingleton();
void keepRegistrations();
void intercept();
@@ -124,6 +125,26 @@ void tst_QQMLTypeLoader::trimCache2()
QCOMPARE(loader.isTypeLoaded(testFileUrl("MyComponent2.qml")), false);
}
+// test trimming the cache of an item that contains sub-items created via incubation
+void tst_QQMLTypeLoader::trimCache3()
+{
+ QScopedPointer<QQuickView> window(new QQuickView());
+ window->setSource(testFileUrl("trim_cache3.qml"));
+ QQmlTypeLoader &loader = QQmlEnginePrivate::get(window->engine())->typeLoader;
+ QCOMPARE(loader.isTypeLoaded(testFileUrl("ComponentWithIncubator.qml")), true);
+
+ QQmlProperty::write(window->rootObject(), "source", QString());
+
+ // handle our deleteLater and cleanup
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ window->engine()->collectGarbage();
+
+ window->engine()->trimComponentCache();
+
+ QCOMPARE(loader.isTypeLoaded(testFileUrl("ComponentWithIncubator.qml")), false);
+}
+
static void checkSingleton(const QString &dataDirectory)
{
QQmlEngine engine;