diff options
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" |