diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-16 12:16:21 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-17 09:05:30 +0100 |
commit | 869efe4a49c5286493d7f039325992725bcac6c3 (patch) | |
tree | a1ec0e4ce0420f01fec603e053f9103636053d04 /tests/auto | |
parent | 1b5a6c19ab701c9b94b1ffb094999c34643bcd1d (diff) |
qmllint: Check for unknown types in JavaScript access
There are many incomplete qmltypes files around. We should not just
crash on those.
Task-number: QTBUG-82817
Change-Id: Ie072b80473927570c80fb2f9ae329de711c35904
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qml/qmllint/data/Things/plugins.qmltypes | 1 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/data/incompleteQmltypes.qml | 6 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 4 |
3 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/Things/plugins.qmltypes b/tests/auto/qml/qmllint/data/Things/plugins.qmltypes index 00cda191cc..9d81c21070 100644 --- a/tests/auto/qml/qmllint/data/Things/plugins.qmltypes +++ b/tests/auto/qml/qmllint/data/Things/plugins.qmltypes @@ -12,5 +12,6 @@ Module { "CCC": 2 } } + Property { name: "palette"; type: "QPalette" } } } diff --git a/tests/auto/qml/qmllint/data/incompleteQmltypes.qml b/tests/auto/qml/qmllint/data/incompleteQmltypes.qml new file mode 100644 index 0000000000..ab06bbd8b0 --- /dev/null +++ b/tests/auto/qml/qmllint/data/incompleteQmltypes.qml @@ -0,0 +1,6 @@ +import Things 1.0 + +SomethingEntirelyStrange { + id: self + property var a: self.palette.weDontKnowIt +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index ed401d59e0..ed968d6623 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -160,6 +160,10 @@ void TestQmllint::dirtyQmlCode_data() << QStringLiteral("badTypeAssertion.qml") << QString("Warning: Property \"rrr\" not found on type \"Item\" at 5:39") << QString(); + QTest::newRow("incompleteQmltypes") + << QStringLiteral("incompleteQmltypes.qml") + << QString("Warning: Type \"QPalette\" of member \"palette\" not found at 5:26") + << QString(); } void TestQmllint::dirtyQmlCode() |