diff options
author | Michael Brasser <mbrasser@ford.com> | 2016-08-26 12:57:58 -0500 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-08-30 08:28:39 +0000 |
commit | c14c382e6e8527be1129788ccca31309b032f99c (patch) | |
tree | dbdb1cfc07afb71418732bdd52bc5c8e1ec37507 /tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp | |
parent | fcc2c95421710f98c7b2dec73e2c8b0d9164bc9b (diff) |
Allow for garbage collection of types with errors in trimCache()
Change-Id: I821ea14f60871735bface4e2cf4e61fcb61b2784
Task-number: QTBUG-55567
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp')
-rw-r--r-- | tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index a1eaa0567f..8eb413e9f7 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -48,6 +48,7 @@ private slots: void testLoadComplete(); void loadComponentSynchronously(); void trimCache(); + void trimCache2(); }; void tst_QQMLTypeLoader::testLoadComplete() @@ -112,6 +113,19 @@ void tst_QQMLTypeLoader::trimCache() } } +void tst_QQMLTypeLoader::trimCache2() +{ + QQuickView *window = new QQuickView(); + window->setSource(testFileUrl("trim_cache2.qml")); + QQmlTypeLoader &loader = QQmlEnginePrivate::get(window->engine())->typeLoader; + // in theory if gc has already run this could be false + // QCOMPARE(loader.isTypeLoaded(testFileUrl("MyComponent2.qml")), true); + window->engine()->collectGarbage(); + QTest::qWait(1); // force event loop + window->engine()->trimComponentCache(); + QCOMPARE(loader.isTypeLoaded(testFileUrl("MyComponent2.qml")), false); +} + QTEST_MAIN(tst_QQMLTypeLoader) #include "tst_qqmltypeloader.moc" |