aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmllint/tst_qmllint.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-08-16 11:31:51 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-08-30 10:34:25 +0200
commit8b396cb21606c3b384d1bab71851767ea7b24ca5 (patch)
treeec3128a0527d04f766bbde305842258b471130a6 /tests/auto/qml/qmllint/tst_qmllint.cpp
parent02f43807c6e2a35dc28b7ef477db55bb8312e60c (diff)
qmllint: Warn about magic signal handlers
Those are typically part of Connections elements. We want to use functions instead. Change-Id: I08b65eae8b8a6ba95f7a3570f5465961abbb506e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qmllint/tst_qmllint.cpp')
-rw-r--r--tests/auto/qml/qmllint/tst_qmllint.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp
index c332354bcd..c1d45ddaf1 100644
--- a/tests/auto/qml/qmllint/tst_qmllint.cpp
+++ b/tests/auto/qml/qmllint/tst_qmllint.cpp
@@ -44,6 +44,8 @@ private Q_SLOTS:
void testUnqualified_data();
void testUnqualifiedNoSpuriousParentWarning();
void catchIdentifierNoFalsePositive();
+ void testUnmatchedSignalHandler();
+
private:
QString runQmllint(const QString &fileToLint, bool shouldSucceed);
@@ -126,6 +128,14 @@ void TestQmllint::catchIdentifierNoFalsePositive()
runQmllint("catchIdentifierNoWarning.qml", true);
}
+void TestQmllint::testUnmatchedSignalHandler()
+{
+ const QString output = runQmllint("UnmatchedSignalHandler.qml", false);
+ QVERIFY(output.contains(QString::asprintf(
+ "Warning: no matching signal found for handler \"onClicked\" at %d:%d", 12, 13)));
+ QVERIFY(!output.contains(QStringLiteral("onMouseXChanged")));
+}
+
void TestQmllint::test()
{
QFETCH(QString, filename);