aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmllint/tst_qmllint.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-11-15 18:51:01 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-11-22 11:30:31 +0100
commitbc4be3f98169d7d4ed74d7539299924b57b89bd1 (patch)
tree9cd8188298b778d5b2580ddc220d3a4389da43f3 /tests/auto/qml/qmllint/tst_qmllint.cpp
parent89636733ba3872b9c29ed712e0723b576f65f3ff (diff)
qmllint: Check qmltypes files in import path for validity
Now that we have a module describing the qmltypes format, we can run qmllint on qmltypes files. Change-Id: I23339e52b5081ecb6a2c3b127078389a2b8faab0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmllint/tst_qmllint.cpp')
-rw-r--r--tests/auto/qml/qmllint/tst_qmllint.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp
index 7e21c8d437..3f674fb5cc 100644
--- a/tests/auto/qml/qmllint/tst_qmllint.cpp
+++ b/tests/auto/qml/qmllint/tst_qmllint.cpp
@@ -53,6 +53,9 @@ private Q_SLOTS:
void directoryPassedAsQmlTypesFile();
void oldQmltypes();
+ void qmltypes_data();
+ void qmltypes();
+
private:
QString runQmllint(const QString &fileToLint,
std::function<void(QProcess &)> handleResult,
@@ -146,6 +149,23 @@ void TestQmllint::oldQmltypes()
QVERIFY(errors.contains(QStringLiteral("Revision 0 corresponds to version 0.0; it should be 1.0.")));
}
+void TestQmllint::qmltypes_data()
+{
+ QTest::addColumn<QString>("file");
+
+ const QString importsPath = QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath);
+ QDirIterator it(importsPath, { "*.qmltypes" },
+ QDir::Files, QDirIterator::Subdirectories);
+ while (it.hasNext())
+ QTest::addRow("%s", qPrintable(it.next().mid(importsPath.length()))) << it.filePath();
+}
+
+void TestQmllint::qmltypes()
+{
+ QFETCH(QString, file);
+ runQmllint(file, true);
+}
+
void TestQmllint::dirtyQmlCode_data()
{
QTest::addColumn<QString>("filename");
@@ -306,7 +326,8 @@ QString TestQmllint::runQmllint(const QString &fileToLint,
{
auto qmlImportDir = QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath);
QStringList args;
- args << testFile(fileToLint)
+
+ args << (QFileInfo(fileToLint).isAbsolute() ? fileToLint : testFile(fileToLint))
<< QStringLiteral("-I") << qmlImportDir
<< QStringLiteral("-I") << dataDirectory();
args << extraArgs;