diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-08-16 13:11:53 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-08-26 17:52:32 +0200 |
commit | 69dcabed60208c6e6226b52332bf4ab5b107130d (patch) | |
tree | 9f36c3b74a3d0ebf73ba24193b6224c4859e3069 /tests | |
parent | 5c04f14e4cdb64eb89532491dcf09e27c5fe29ac (diff) |
Make the qmllint test an actual test
Change-Id: I59a96cbef9a68454b68a37e5c7aed45cb4009785
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qmllint/qmllint.pro | 13 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp (renamed from tests/auto/qml/qmllint/main.cpp) | 21 |
2 files changed, 19 insertions, 15 deletions
diff --git a/tests/auto/qml/qmllint/qmllint.pro b/tests/auto/qml/qmllint/qmllint.pro index b53a6f6877..95470b4085 100644 --- a/tests/auto/qml/qmllint/qmllint.pro +++ b/tests/auto/qml/qmllint/qmllint.pro @@ -1,6 +1,11 @@ -TEMPLATE = app -TARGET = testqmllint -INCLUDEPATH += . +CONFIG += testcase +TARGET = tst_qmllint +macos:CONFIG -= app_bundle + +SOURCES += tst_qmllint.cpp + +include (../../shared/util.pri) + +TESTDATA = data/* -SOURCES += main.cpp QT += testlib diff --git a/tests/auto/qml/qmllint/main.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 87b34d83bd..582f146dca 100644 --- a/tests/auto/qml/qmllint/main.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -30,12 +30,14 @@ #include <QProcess> #include <QString> -class TestQmllint: public QObject +#include <util.h> + +class TestQmllint: public QQmlDataTest { Q_OBJECT private Q_SLOTS: - void initTestCase(); + void initTestCase() override; void test(); void test_data(); void testUnqualified(); @@ -48,6 +50,7 @@ private: void TestQmllint::initTestCase() { + QQmlDataTest::initTestCase(); m_qmllintPath = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/qmllint"); #ifdef Q_OS_WIN m_qmllintPath += QLatin1String(".exe"); @@ -80,9 +83,8 @@ void TestQmllint::testUnqualified() QFETCH(QString, warningMessage); QFETCH(int, warningLine); QFETCH(int, warningColumn); - filename.prepend(QStringLiteral("data/")); QStringList args; - args << QStringLiteral("-U") << filename << QStringLiteral("-I") << qmlImportDir; + args << QStringLiteral("-U") << testFile(filename) << QStringLiteral("-I") << qmlImportDir; QProcess process; process.start(m_qmllintPath, args); @@ -122,8 +124,7 @@ void TestQmllint::testUnqualifiedNoSpuriousParentWarning() { auto qmlImportDir = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath); { - QString filename = QLatin1String("spuriousParentWarning.qml"); - filename.prepend(QStringLiteral("data/")); + QString filename = testFile("spuriousParentWarning.qml"); QStringList args; args << QStringLiteral("-U") << filename << QStringLiteral("-I") << qmlImportDir; QProcess process; @@ -133,8 +134,7 @@ void TestQmllint::testUnqualifiedNoSpuriousParentWarning() QVERIFY(process.exitCode() == 0); } { - QString filename = QLatin1String("nonSpuriousParentWarning.qml"); - filename.prepend(QStringLiteral("data/")); + QString filename = testFile("nonSpuriousParentWarning.qml"); QStringList args; args << QStringLiteral("-U") << filename << QStringLiteral("-I") << qmlImportDir; QProcess process; @@ -163,13 +163,12 @@ void TestQmllint::test() { QFETCH(QString, filename); QFETCH(bool, isValid); - filename = QStringLiteral("data/") + filename; QStringList args; - args << QStringLiteral("--silent") << filename; + args << QStringLiteral("--silent") << testFile(filename); bool success = QProcess::execute(m_qmllintPath, args) == 0; QCOMPARE(success, isValid); } QTEST_MAIN(TestQmllint) -#include "main.moc" +#include "tst_qmllint.moc" |