aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmllint
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-11-15 16:59:46 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-01-13 16:54:22 +0100
commit01b865411d945960cb00b51a0078549eb3dd38e8 (patch)
tree85695e53c11322ac34d50111c1a9b89fc311acad /tests/auto/qml/qmllint
parent2677de3c79de984e88e4a950c915b4f3f54786dd (diff)
qmllint: parse simple type assertions
Change-Id: Ic24018137d8f989686d4a8f927efb824453d114b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmllint')
-rw-r--r--tests/auto/qml/qmllint/data/badTypeAssertion.qml6
-rw-r--r--tests/auto/qml/qmllint/data/goodTypeAssertion.qml6
-rw-r--r--tests/auto/qml/qmllint/tst_qmllint.cpp5
3 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/badTypeAssertion.qml b/tests/auto/qml/qmllint/data/badTypeAssertion.qml
new file mode 100644
index 0000000000..717fc1b1bb
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/badTypeAssertion.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ property QtObject foo: Item { x: 4 }
+ property real foox: (foo as Item).rrr
+}
diff --git a/tests/auto/qml/qmllint/data/goodTypeAssertion.qml b/tests/auto/qml/qmllint/data/goodTypeAssertion.qml
new file mode 100644
index 0000000000..6f5f52eb6b
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/goodTypeAssertion.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ property QtObject foo: Item { x: 4 }
+ property real foox: (foo as Item).x
+}
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp
index f906c3ac45..655e6a1d65 100644
--- a/tests/auto/qml/qmllint/tst_qmllint.cpp
+++ b/tests/auto/qml/qmllint/tst_qmllint.cpp
@@ -156,6 +156,10 @@ void TestQmllint::dirtyQmlCode_data()
<< QStringLiteral("parentIsComponent.qml")
<< QString("Warning: Property \"progress\" not found on type \"QQuickItem\" at 7:39")
<< QString();
+ QTest::newRow("badTypeAssertion")
+ << QStringLiteral("badTypeAssertion.qml")
+ << QString("Warning: Property \"rrr\" not found on type \"Item\" at 5:39")
+ << QString();
}
void TestQmllint::dirtyQmlCode()
@@ -186,6 +190,7 @@ void TestQmllint::cleanQmlCode_data()
QTest::newRow("methodsInJavascript") << QStringLiteral("javascriptMethods.qml");
QTest::newRow("goodAlias") << QStringLiteral("goodAlias.qml");
QTest::newRow("goodParent") << QStringLiteral("goodParent.qml");
+ QTest::newRow("goodTypeAssertion") << QStringLiteral("goodTypeAssertion.qml");
}
void TestQmllint::cleanQmlCode()