diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-11-08 01:00:09 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-11-08 08:16:27 +0100 |
commit | 53db1ef8d6a40484a1fc8633b2bad9fb2405c08a (patch) | |
tree | fd922515894c0c0c6c565bb6dad655b62d84cd90 /tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp | |
parent | 8e380f6199df1cbaf5d88d929e648a5368f6e0ef (diff) | |
parent | 210f4271e8946c0da0cefff0c07af80081df20f1 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
Change-Id: I1c0c7c44053bf3d5f8f9723662bd0fe67253c8ae
Diffstat (limited to 'tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp')
-rw-r--r-- | tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index 07f67c7843..d529600723 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -61,7 +61,7 @@ private slots: void qrcRootPathUrl(); void implicitImport(); void compositeSingletonCycle(); - + void declarativeCppType(); private: void checkSingleton(const QString & dataDirectory); }; @@ -100,6 +100,8 @@ void tst_QQMLTypeLoader::trimCache() { QQmlEngine engine; QQmlTypeLoader &loader = QQmlEnginePrivate::get(&engine)->typeLoader; + QVector<QQmlTypeData *> releaseLater; + QVector<QV4::ExecutableCompilationUnit *> releaseCompilationUnitLater; for (int i = 0; i < 256; ++i) { QUrl url = testFileUrl("trim_cache.qml"); url.setQuery(QString::number(i)); @@ -112,8 +114,10 @@ void tst_QQMLTypeLoader::trimCache() // QQmlTypeData or its compiledData() should prevent the trimming. if (i % 10 == 0) { // keep ref on data, don't add ref on data->compiledData() + releaseLater.append(data); } else if (i % 5 == 0) { data->compilationUnit()->addref(); + releaseCompilationUnitLater.append(data->compilationUnit()); data->release(); } else { data->release(); @@ -129,6 +133,12 @@ void tst_QQMLTypeLoader::trimCache() QVERIFY(!loader.isTypeLoaded(url)); // The cache is free to keep the others. } + + for (auto *data : qAsConst(releaseCompilationUnitLater)) + data->release(); + + for (auto *data : qAsConst(releaseLater)) + data->release(); } void tst_QQMLTypeLoader::trimCache2() @@ -557,6 +567,15 @@ void tst_QQMLTypeLoader::compositeSingletonCycle() QCOMPARE(qvariant_cast<QColor>(object->property("color")), QColorConstants::Black); } +void tst_QQMLTypeLoader::declarativeCppType() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("declarativeCppType.qml")); + QCOMPARE(component.status(), QQmlComponent::Ready); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); +} + QTEST_MAIN(tst_QQMLTypeLoader) #include "tst_qqmltypeloader.moc" |