aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2021-02-03 12:06:33 +0100
committerMaximilian Goldstein <max.goldstein@qt.io>2021-02-04 10:57:03 +0100
commit067c236c746ca37de4fcdddfbd894546697273a1 (patch)
tree3e1ee3955f073f382ba800249ffb497a96caf534 /tests
parent232634984e04deab21c40b99ac637a744416d51d (diff)
qmllint: Fix segmentation fault
Change-Id: Ie04ad4221b25628687c2575facf90488b83d21bf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 5fb34b67b810ca284c216009925f4f38220c4510)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qmllint/data/SegFault.bad.qml6
-rw-r--r--tests/auto/qml/qmllint/data/SegFault.qml6
-rw-r--r--tests/auto/qml/qmllint/tst_qmllint.cpp10
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/SegFault.bad.qml b/tests/auto/qml/qmllint/data/SegFault.bad.qml
new file mode 100644
index 0000000000..c31777e7c8
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/SegFault.bad.qml
@@ -0,0 +1,6 @@
+import QtQuick as T
+T.Item {
+ T.Rectangle {
+ property int length: parent.T.Screen.foobar
+ }
+}
diff --git a/tests/auto/qml/qmllint/data/SegFault.qml b/tests/auto/qml/qmllint/data/SegFault.qml
new file mode 100644
index 0000000000..c66ad472f1
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/SegFault.qml
@@ -0,0 +1,6 @@
+import QtQuick as T
+T.Item {
+ T.Rectangle {
+ property int length: parent.T.Screen.pixelDensity
+ }
+}
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp
index 2a6ff48baf..9dd5679769 100644
--- a/tests/auto/qml/qmllint/tst_qmllint.cpp
+++ b/tests/auto/qml/qmllint/tst_qmllint.cpp
@@ -249,6 +249,12 @@ void TestQmllint::dirtyQmlCode_data()
<< QStringLiteral("badAliasObject.qml")
<< QString("Warning: Property \"wrongwrongwrong\" not found on type \"QtObject\"")
<< QString();
+ // TODO: This fails but currently for the wrong reasons, make sure to add a warning message requirement
+ // once it does fail properly in order to avoid regressions.
+ QTest::newRow("segFault (bad)")
+ << QStringLiteral("SegFault.bad.qml")
+ << QString()
+ << QString();
}
void TestQmllint::dirtyQmlCode()
@@ -307,12 +313,14 @@ void TestQmllint::cleanQmlCode_data()
QTest::newRow("anchors2") << QStringLiteral("anchors2.qml");
QTest::newRow("optionalImport") << QStringLiteral("optionalImport.qml");
QTest::newRow("goodAliasObject") << QStringLiteral("goodAliasObject.qml");
+ QTest::newRow("segFault") << QStringLiteral("SegFault.qml");
}
void TestQmllint::cleanQmlCode()
{
QFETCH(QString, filename);
const QString warnings = runQmllint(filename, true);
+ QEXPECT_FAIL("segFault", "This property exists and should not produce a warning", Abort);
QVERIFY2(warnings.isEmpty(), qPrintable(warnings));
}
@@ -356,6 +364,8 @@ QString TestQmllint::runQmllint(const QString &fileToLint, bool shouldSucceed, c
return runQmllint(fileToLint, [&](QProcess &process) {
QVERIFY(process.waitForFinished());
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+
+ QEXPECT_FAIL("segFault", "This property exists and should not produce a warning", Abort);
if (shouldSucceed)
QCOMPARE(process.exitCode(), 0);
else