diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-06 15:45:05 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-08 18:54:29 +0200 |
commit | 04bc9d83f22a7266fb0caf53c2c3da0d9b06fef4 (patch) | |
tree | 883b9e3eba194efa05dbab3592fca8f1273b844b /tests/auto/qml | |
parent | e8007671d4ec6d791cb337b297f2beb7e5300929 (diff) |
Allow optional imports in qmldir files
This is useful for modules that select their imports at runtime using
qmlRegisterModuleImport(). We can list all possible variants as optional
imports so that tools can see what types might be available.
Task-number: QTBUG-87130
Change-Id: I8a37bdde79aef3619fd1f05e5ea6781d521afa88
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml')
-rw-r--r-- | tests/auto/qml/qmllint/data/Things/qmldir | 1 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/data/optionalImport.qml | 5 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/Things/qmldir b/tests/auto/qml/qmllint/data/Things/qmldir index 554f75d313..3c48ae0648 100644 --- a/tests/auto/qml/qmllint/data/Things/qmldir +++ b/tests/auto/qml/qmllint/data/Things/qmldir @@ -3,3 +3,4 @@ Something 1.0 SomethingElse.qml typeinfo plugins.qmltypes depends QtQuick 2.0 import QtQml +optional import QtQuick.LocalStorage auto diff --git a/tests/auto/qml/qmllint/data/optionalImport.qml b/tests/auto/qml/qmllint/data/optionalImport.qml new file mode 100644 index 0000000000..2be7cd444a --- /dev/null +++ b/tests/auto/qml/qmllint/data/optionalImport.qml @@ -0,0 +1,5 @@ +import Things 6.0 + +QtObject { + property var db: LocalStorage.openDatabaseSync("foo", "2", "bar", 4) +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 09ffd2c9ec..4c18253b0c 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -282,6 +282,7 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("enumFromQtQml") << QStringLiteral("enumFromQtQml.qml"); QTest::newRow("anchors1") << QStringLiteral("anchors1.qml"); QTest::newRow("anchors2") << QStringLiteral("anchors2.qml"); + QTest::newRow("optionalImport") << QStringLiteral("optionalImport.qml"); } void TestQmllint::cleanQmlCode() |