diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2019-11-18 16:15:01 +0100 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2019-11-25 15:34:40 +0100 |
commit | f1f395b37da163bce2dc3b5fc4e298bb4f56a3e7 (patch) | |
tree | 9ce2ba89a86ed754a8ecb8f52181770853e21a08 /tests/auto/qml/qqmlimport/tst_qqmlimport.cpp | |
parent | ba494aaa24defe1401f621b791891e696b308756 (diff) | |
parent | 0ee087f5a5edd7d1aa39fd15e0dc85985320c09a (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: I48b9c2e4f3a75c18470c55f73f2089dc1401de54
Diffstat (limited to 'tests/auto/qml/qqmlimport/tst_qqmlimport.cpp')
-rw-r--r-- | tests/auto/qml/qqmlimport/tst_qqmlimport.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp index ca1e52ad2c..9c865b3f73 100644 --- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp +++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp @@ -32,6 +32,7 @@ #include <QtQuick/qquickview.h> #include <QtQuick/qquickitem.h> #include <private/qqmlimport_p.h> +#include <private/qqmlengine_p.h> #include "../../shared/util.h" class tst_QQmlImport : public QQmlDataTest @@ -46,6 +47,7 @@ private slots: void completeQmldirPaths(); void interceptQmldir(); void singletonVersionResolution(); + void removeDynamicPlugin(); void cleanup(); }; @@ -260,6 +262,25 @@ void tst_QQmlImport::singletonVersionResolution() } } +void tst_QQmlImport::removeDynamicPlugin() +{ + qmlClearTypeRegistrations(); + QQmlEngine engine; + { + // Load something that adds a dynamic plugin + QQmlComponent component(&engine); + component.setData(QByteArray("import QtTest 1.0; TestResult{}"), QUrl()); + QVERIFY(component.isReady()); + } + QQmlImportDatabase *imports = &QQmlEnginePrivate::get(&engine)->importDatabase; + const QStringList &plugins = imports->dynamicPlugins(); + QVERIFY(!plugins.isEmpty()); + for (const QString &plugin : plugins) + QVERIFY(imports->removeDynamicPlugin(plugin)); + QVERIFY(imports->dynamicPlugins().isEmpty()); + qmlClearTypeRegistrations(); +} + QTEST_MAIN(tst_QQmlImport) |