diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-06-04 15:47:50 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-06-11 18:06:53 +0200 |
commit | 8311d0135ed27b457144bfa0b9587f12cf17b364 (patch) | |
tree | b96fc9e18cd9ca9864cfb118a37887d7b15bc5db /tests/auto/qml/qqmlimport/tst_qqmlimport.cpp | |
parent | 11a09e212877988d37416842ad73d9aa357ba51f (diff) |
QML: Fix precedence of module imports
Types imported transitively via a qmldir import statement should not
shadow types available from the module itself.
Change-Id: Id34edc5c5e2fff4ba37009f4bab9039b7ed18dff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlimport/tst_qqmlimport.cpp')
-rw-r--r-- | tests/auto/qml/qqmlimport/tst_qqmlimport.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp index 316c4cb168..ac21a2fac6 100644 --- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp +++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp @@ -52,6 +52,7 @@ private slots: void partialImportVersions_data(); void partialImportVersions(); void registerModuleImport(); + void importDependenciesPrecedence(); void cleanup(); void envResourceImportPath(); }; @@ -388,6 +389,20 @@ void tst_QQmlImport::registerModuleImport() } } +void tst_QQmlImport::importDependenciesPrecedence() +{ + QQmlEngine engine; + engine.addImportPath(dataDirectory()); + + QQmlComponent component(&engine, testFile("dependencies.qml")); + QVERIFY(component.isReady()); + + QScopedPointer<QObject> instance(component.create()); + QVERIFY(!instance.isNull()); + QCOMPARE(instance->property("a").toString(), QString::fromLatin1("a")); + QCOMPARE(instance->property("b").toString(), QString::fromLatin1("b")); +} + QTEST_MAIN(tst_QQmlImport) |