aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2021-05-11 17:36:08 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2021-05-14 16:39:40 +0200
commit04c2546b82d0609fcaab2e792e2b1e0794dca9eb (patch)
tree807df2b256daab607af986e55c4731dbd5caf3bd /tests
parentf3ed98bf09885795de160468fd615c9e07d5ed5d (diff)
qmllint: Add inline component support
Adds support for inline components for qmllint with a few things not working yet: - Two inline components referencing each other - Using inline components before they are declared These two issues require a larger overhaul of qmllint as a whole and will be addressed in a different change. Change-Id: I2834702c21a8eb728db4709d6f475c33796b3e4d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qmllint/data/inlineComponent.qml14
-rw-r--r--tests/auto/qml/qmllint/data/nestedInlineComponents.qml7
-rw-r--r--tests/auto/qml/qmllint/tst_qmllint.cpp4
3 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/inlineComponent.qml b/tests/auto/qml/qmllint/data/inlineComponent.qml
new file mode 100644
index 0000000000..ce6998a980
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/inlineComponent.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ component IC : QtObject {}
+ QtObject {
+ component IC2: QtObject {}
+
+ property IC ic: IC {}
+ property IC2 ic2: IC2 {}
+ }
+
+ property IC ic : IC {}
+ property IC2 ic2: IC2 {}
+}
diff --git a/tests/auto/qml/qmllint/data/nestedInlineComponents.qml b/tests/auto/qml/qmllint/data/nestedInlineComponents.qml
new file mode 100644
index 0000000000..e2a32df092
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/nestedInlineComponents.qml
@@ -0,0 +1,7 @@
+import QtQml
+
+QtObject {
+ component IC: QtObject {
+ component IC2: QtObject {}
+ }
+}
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp
index d6f5088a9d..330ca0b8f1 100644
--- a/tests/auto/qml/qmllint/tst_qmllint.cpp
+++ b/tests/auto/qml/qmllint/tst_qmllint.cpp
@@ -615,6 +615,9 @@ void TestQmllint::dirtyQmlCode_data()
<< QStringLiteral("unresolvedAttachedType.qml")
<< QStringLiteral("unknown attached property scope UnresolvedAttachedType.")
<< QStringLiteral("Property \"property\" is invalid or does not exist") << false;
+ QTest::newRow("nestedInlineComponents")
+ << QStringLiteral("nestedInlineComponents.qml")
+ << QStringLiteral("Nested inline components are not supported") << QString() << false;
}
void TestQmllint::dirtyQmlCode()
@@ -748,6 +751,7 @@ void TestQmllint::cleanQmlCode_data()
QTest::newRow("QVariant") << QStringLiteral("qvariant.qml");
QTest::newRow("Accessible") << QStringLiteral("accessible.qml");
QTest::newRow("qjsroot") << QStringLiteral("qjsroot.qml");
+ QTest::newRow("InlineComponent") << QStringLiteral("inlineComponent.qml");
}
void TestQmllint::cleanQmlCode()