diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-11-11 17:35:09 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-01-13 16:54:13 +0100 |
commit | 6c68a39a56299c72da30a4bac3ca7fe8420687a4 (patch) | |
tree | b88b33e57c71f131dec7adfd4cf42b87766f1382 /tests | |
parent | d0b2a3b5eb4021fb19b634e550cbc6f6664ad775 (diff) |
qmllint: Resolve aliases
Change-Id: Ida53af9774dc72559395064169113d0ee1f47f24
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qmllint/data/badAlias.qml | 5 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/data/badAliasProperty.qml | 6 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/data/goodAlias.qml | 12 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 9 |
4 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/badAlias.qml b/tests/auto/qml/qmllint/data/badAlias.qml new file mode 100644 index 0000000000..2dd7d1a7e0 --- /dev/null +++ b/tests/auto/qml/qmllint/data/badAlias.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 + +QtObject { + property alias wrong: nowhere +} diff --git a/tests/auto/qml/qmllint/data/badAliasProperty.qml b/tests/auto/qml/qmllint/data/badAliasProperty.qml new file mode 100644 index 0000000000..9483c52cd0 --- /dev/null +++ b/tests/auto/qml/qmllint/data/badAliasProperty.qml @@ -0,0 +1,6 @@ +import QtQml 2.0 + +QtObject { + id: self + property alias wrong: self.nowhere +} diff --git a/tests/auto/qml/qmllint/data/goodAlias.qml b/tests/auto/qml/qmllint/data/goodAlias.qml new file mode 100644 index 0000000000..d2fa4485ec --- /dev/null +++ b/tests/auto/qml/qmllint/data/goodAlias.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 + +Item { + id: self + + QtObject { + id: inner + } + + property alias innerObj: inner + property alias name: self.objectName +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index d63017e5b1..5066451f6d 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -140,6 +140,14 @@ void TestQmllint::dirtyQmlCode_data() << QStringLiteral("unknownJavascriptMethod.qml") << QString("Warning: Property \"foo2\" not found on type \"Methods\" at 5:25") << QString(); + QTest::newRow("badAlias") + << QStringLiteral("badAlias.qml") + << QString("Warning: unqualified access at 4:27") + << QString(); + QTest::newRow("badAliasProperty") + << QStringLiteral("badAliasProperty.qml") + << QString("Warning: Property \"nowhere\" not found on type \"QtObject\" at 5:32") + << QString(); } void TestQmllint::dirtyQmlCode() @@ -168,6 +176,7 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("forLoop") << QStringLiteral("forLoop.qml"); QTest::newRow("esmodule") << QStringLiteral("esmodule.mjs"); QTest::newRow("methodsInJavascript") << QStringLiteral("javascriptMethods.qml"); + QTest::newRow("goodAlias") << QStringLiteral("goodAlias.qml"); } void TestQmllint::cleanQmlCode() |