From 869efe4a49c5286493d7f039325992725bcac6c3 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 16 Mar 2020 12:16:21 +0100 Subject: 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 --- tests/auto/qml/qmllint/data/Things/plugins.qmltypes | 1 + tests/auto/qml/qmllint/data/incompleteQmltypes.qml | 6 ++++++ tests/auto/qml/qmllint/tst_qmllint.cpp | 4 ++++ 3 files changed, 11 insertions(+) create mode 100644 tests/auto/qml/qmllint/data/incompleteQmltypes.qml (limited to 'tests') 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() -- cgit v1.2.3