diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-11-15 18:51:01 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-11-22 11:30:31 +0100 |
commit | bc4be3f98169d7d4ed74d7539299924b57b89bd1 (patch) | |
tree | 9cd8188298b778d5b2580ddc220d3a4389da43f3 | |
parent | 89636733ba3872b9c29ed712e0723b576f65f3ff (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>
-rw-r--r-- | src/imports/tooling/Component.qml | 1 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 23 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/imports/tooling/Component.qml b/src/imports/tooling/Component.qml index 5f628962a7..d87e613907 100644 --- a/src/imports/tooling/Component.qml +++ b/src/imports/tooling/Component.qml @@ -48,6 +48,7 @@ QtObject { property var exports: [] property var exportMetaObjectRevisions: [] property string attachedType + property string valueType property bool isSingleton: false property bool isCreatable: name.length > 0 property bool isComposite: false 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; |