diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-06-22 18:38:43 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-06-24 18:28:20 +0200 |
commit | 437b04e6ec5c767907a97af115d82b4cd7db93ae (patch) | |
tree | 6a6cb79149488e214a0068e69f9580ea3a5b572d /tests/auto/qml/qmllint/data | |
parent | 36df81b3bc6d721d5598d5163b0a9659de4a69ee (diff) |
qmllint: Properly process qmldir imports and dependencies
We don't want to pick the dependencies from the qmltypes files. Rather,
parse them directly from the qmldir. Do process versions, too.
Also, import explicitly given qmltypes files only once, and don't expose
QML types from dependencies as actual types. Hide them behind an
inaccessible prefix.
For the inaccessible prefix to work, we need to import the C++ class
names without the prefix. The prefix doesn't make sense for C++ names
anyway.
In addition, properly process version-less imports.
Change-Id: If582ad271db35351d219332c319571a814628fe0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmllint/data')
4 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/Things/plugins.qmltypes b/tests/auto/qml/qmllint/data/Things/plugins.qmltypes index 448a966145..8b57cadb61 100644 --- a/tests/auto/qml/qmllint/data/Things/plugins.qmltypes +++ b/tests/auto/qml/qmllint/data/Things/plugins.qmltypes @@ -55,4 +55,11 @@ Module { isCreatable: false Property { name: "pixelDensity"; type: "double"; isReadonly: true } } + Component { + name: "ItemDerived" + prototype: "QQuickItem" + exports: [ + "Things/ItemDerived 1.0" + ] + } } diff --git a/tests/auto/qml/qmllint/data/Things/qmldir b/tests/auto/qml/qmllint/data/Things/qmldir index c53af3a340..d91d4afc92 100644 --- a/tests/auto/qml/qmllint/data/Things/qmldir +++ b/tests/auto/qml/qmllint/data/Things/qmldir @@ -1,3 +1,5 @@ module Things Something 1.0 SomethingElse.qml plugin doesNotExistPlugin +depends QtQuick 2.0 +import QtQml diff --git a/tests/auto/qml/qmllint/data/qmldirImportAndDepend/bad.qml b/tests/auto/qml/qmllint/data/qmldirImportAndDepend/bad.qml new file mode 100644 index 0000000000..ef80aa54d6 --- /dev/null +++ b/tests/auto/qml/qmllint/data/qmldirImportAndDepend/bad.qml @@ -0,0 +1,5 @@ +import Things + +Item { + objectName: "We cannot instantiate Item as it is not imported" +} diff --git a/tests/auto/qml/qmllint/data/qmldirImportAndDepend/good.qml b/tests/auto/qml/qmllint/data/qmldirImportAndDepend/good.qml new file mode 100644 index 0000000000..275b531845 --- /dev/null +++ b/tests/auto/qml/qmllint/data/qmldirImportAndDepend/good.qml @@ -0,0 +1,10 @@ +import Things + +QtObject { + objectName: "QtQml was imported from Things/qmldir" + + ItemDerived { + objectName: "QQuickItem is depended upon and we know its properties" + x: 4 + } +} |