diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-16 23:21:10 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-16 23:21:16 +0200 |
commit | 345226aa3ecee8642c3bf46e40c981d4a49d958e (patch) | |
tree | eb49f01c70d239286cb3f08bbe677c47c640cd12 /tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp | |
parent | 5149aa68eca6ede8836ec4f07a14d22d9da9b161 (diff) | |
parent | a273a0ad9c1df7aed612ee6353753f668d545076 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: Ib45654e3e79087da4754377f0d78b70c44ed4695
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 3e8e1d23ea..36350e2d08 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -43,6 +43,7 @@ private slots: void testLoadComplete(); void loadComponentSynchronously(); void trimCache(); + void trimCache2(); }; void tst_QQMLTypeLoader::testLoadComplete() @@ -107,6 +108,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" |