From e59957d2c46bb52ab5fefeb91ace7e192558373a Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 18 Feb 2021 10:32:53 +0100 Subject: qmllint: Resolve attached property scopes Previously, all attached property scopes were just ignored. Task-number: QTBUG-84369 Change-Id: I324becf92402eacea9d150e6e51359edae562dde Reviewed-by: Fabian Kosmale (cherry picked from commit f34ecc8f99522b69d1aaa3d5d233add9ed9b6da9) --- tests/auto/qml/qmllint/data/attached.qml | 5 +++++ tests/auto/qml/qmllint/data/badAttached.qml | 5 +++++ tests/auto/qml/qmllint/tst_qmllint.cpp | 5 +++++ 3 files changed, 15 insertions(+) create mode 100644 tests/auto/qml/qmllint/data/attached.qml create mode 100644 tests/auto/qml/qmllint/data/badAttached.qml (limited to 'tests/auto/qml') diff --git a/tests/auto/qml/qmllint/data/attached.qml b/tests/auto/qml/qmllint/data/attached.qml new file mode 100644 index 0000000000..0fcf3cacc6 --- /dev/null +++ b/tests/auto/qml/qmllint/data/attached.qml @@ -0,0 +1,5 @@ +import QtQml + +QtObject { + Component.objectName: "foobar" +} diff --git a/tests/auto/qml/qmllint/data/badAttached.qml b/tests/auto/qml/qmllint/data/badAttached.qml new file mode 100644 index 0000000000..93d64ec8ae --- /dev/null +++ b/tests/auto/qml/qmllint/data/badAttached.qml @@ -0,0 +1,5 @@ +import QtQml + +QtObject { + WrongAttached.foo: "bar" +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index c8e0dd2db3..a86c202790 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -302,6 +302,10 @@ void TestQmllint::dirtyQmlCode_data() << QStringLiteral("onAssignment.qml") << QStringLiteral("Property \"loops\" not found on type \"bool\"") << QString(); + QTest::newRow("BadAttached") + << QStringLiteral("badAttached.qml") + << QStringLiteral("unknown attached property scope WrongAttached.") + << QString(); } void TestQmllint::dirtyQmlCode() @@ -366,6 +370,7 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("segFault") << QStringLiteral("SegFault.qml"); QTest::newRow("grouped scope failure") << QStringLiteral("groupedScope.qml"); QTest::newRow("layouts depends quick") << QStringLiteral("layouts.qml"); + QTest::newRow("attached") << QStringLiteral("attached.qml"); } void TestQmllint::cleanQmlCode() -- cgit v1.2.3