diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-01-04 17:10:42 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-01-25 23:55:27 +0100 |
commit | d6eaa70859fbec0f02d15bd8e8fd6ddc360ab371 (patch) | |
tree | 51b665e19b7ed4681fdec774edc7a8c9f53e9a79 /tests/auto/qml | |
parent | 0aa681c78b0457ea524a343428bce5395b3b85a9 (diff) |
QmlCompiler: Rename include -> import
We do not include things in QML, we import them. Also, the -i option
preferably imports from qmldir files, not from qmltypes.
Change-Id: Id4c5b3b774516526dfe80afa1c850bcccd6b2b4d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml')
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 38 | ||||
-rw-r--r-- | tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp | 2 |
2 files changed, 20 insertions, 20 deletions
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 70e2f5e47d..0e0f576483 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -87,7 +87,7 @@ private Q_SLOTS: void importMultipartUri(); private: - enum DefaultIncludeOption { NoDefaultIncludes, UseDefaultIncludes }; + enum DefaultImportOption { NoDefaultImports, UseDefaultImports }; enum ContainOption { StringNotContained, StringContained }; enum ReplacementOption { NoReplacementSearch, @@ -96,14 +96,14 @@ private: QString runQmllint(const QString &fileToLint, std::function<void(QProcess &)> handleResult, const QStringList &extraArgs = QStringList(), bool ignoreSettings = true, - bool addIncludeDirs = true); + bool addImportDirs = true); QString runQmllint(const QString &fileToLint, bool shouldSucceed, const QStringList &extraArgs = QStringList(), bool ignoreSettings = true, - bool addIncludeDirs = true); + bool addImportDirs = true); void callQmllint(const QString &fileToLint, bool shouldSucceed, QJsonArray *warnings = nullptr, - QStringList includeDirs = {}, QStringList qmltypesFiles = {}, + QStringList importDirs = {}, QStringList qmltypesFiles = {}, QStringList resources = {}, - DefaultIncludeOption defaultIncludes = UseDefaultIncludes, + DefaultImportOption defaultImports = UseDefaultImports, QMap<QString, QQmlJSLogger::Option> *options = nullptr); void searchWarnings(const QJsonArray &warnings, const QString &string, const QString &filename, @@ -593,7 +593,7 @@ void TestQmllint::dirtyQmlCode_data() << false; QTest::newRow("InvalidImport") << QStringLiteral("invalidImport.qml") - << QStringLiteral("Failed to import FooBar. Are your include paths set up properly?") + << QStringLiteral("Failed to import FooBar. Are your import paths set up properly?") << QString() << QString() << false; QTest::newRow("Unused Import (simple)") << QStringLiteral("unused_simple.qml") << QStringLiteral("Unused import at %1:1:1") @@ -1055,7 +1055,7 @@ void TestQmllint::compilerWarnings() if (enableCompilerWarnings) options[u"compiler"_qs].setLevel(u"warning"_qs); - callQmllint(filename, shouldSucceed, &warnings, {}, {}, {}, UseDefaultIncludes, &options); + callQmllint(filename, shouldSucceed, &warnings, {}, {}, {}, UseDefaultImports, &options); if (!warning.isEmpty()) searchWarnings(warnings, warning, filename); @@ -1083,7 +1083,7 @@ void TestQmllint::controlsSanity() auto options = QQmlJSLogger::options(); options[u"controls-sanity"_qs].setLevel(u"warning"_qs); - callQmllint(filename, false, &warnings, {}, {}, {}, UseDefaultIncludes, &options); + callQmllint(filename, false, &warnings, {}, {}, {}, UseDefaultImports, &options); if (!warning.isEmpty()) searchWarnings(warnings, warning, filename); @@ -1092,14 +1092,14 @@ void TestQmllint::controlsSanity() QString TestQmllint::runQmllint(const QString &fileToLint, std::function<void(QProcess &)> handleResult, const QStringList &extraArgs, bool ignoreSettings, - bool addIncludeDirs) + bool addImportDirs) { auto qmlImportDir = QLibraryInfo::path(QLibraryInfo::QmlImportsPath); QStringList args; args << (QFileInfo(fileToLint).isAbsolute() ? fileToLint : testFile(fileToLint)); - if (addIncludeDirs) { + if (addImportDirs) { args << QStringLiteral("-I") << qmlImportDir << QStringLiteral("-I") << dataDirectory(); } @@ -1153,7 +1153,7 @@ QString TestQmllint::runQmllint(const QString &fileToLint, QString TestQmllint::runQmllint(const QString &fileToLint, bool shouldSucceed, const QStringList &extraArgs, bool ignoreSettings, - bool addIncludeDirs) + bool addImportDirs) { return runQmllint( fileToLint, @@ -1166,12 +1166,12 @@ QString TestQmllint::runQmllint(const QString &fileToLint, bool shouldSucceed, else QVERIFY(process.exitCode() != 0); }, - extraArgs, ignoreSettings, addIncludeDirs); + extraArgs, ignoreSettings, addImportDirs); } void TestQmllint::callQmllint(const QString &fileToLint, bool shouldSucceed, QJsonArray *warnings, - QStringList includeDirs, QStringList qmltypesFiles, - QStringList resources, DefaultIncludeOption defaultIncludes, + QStringList importPaths, QStringList qmldirFiles, + QStringList resources, DefaultImportOption defaultImports, QMap<QString, QQmlJSLogger::Option> *options) { QJsonArray jsonOutput; @@ -1179,9 +1179,9 @@ void TestQmllint::callQmllint(const QString &fileToLint, bool shouldSucceed, QJs bool success = m_linter.lintFile( QFileInfo(fileToLint).isAbsolute() ? fileToLint : testFile(fileToLint), nullptr, true, warnings ? &jsonOutput : nullptr, - defaultIncludes == UseDefaultIncludes ? m_defaultImportPaths + includeDirs - : includeDirs, - qmltypesFiles, resources, options != nullptr ? *options : QQmlJSLogger::options()); + defaultImports == UseDefaultImports ? m_defaultImportPaths + importPaths + : importPaths, + qmldirFiles, resources, options != nullptr ? *options : QQmlJSLogger::options()); QVERIFY2(success == shouldSucceed, QJsonDocument(jsonOutput).toJson()); if (warnings) { @@ -1336,7 +1336,7 @@ void TestQmllint::attachedPropertyReuse() { QJsonArray warnings; - callQmllint("attachedPropNotReused.qml", false, &warnings, {}, {}, {}, UseDefaultIncludes, + callQmllint("attachedPropNotReused.qml", false, &warnings, {}, {}, {}, UseDefaultImports, &options); searchWarnings(warnings, @@ -1347,7 +1347,7 @@ void TestQmllint::attachedPropertyReuse() } { QJsonArray warnings; - callQmllint("attachedPropEnum.qml", true, &warnings, {}, {}, {}, UseDefaultIncludes, + callQmllint("attachedPropEnum.qml", true, &warnings, {}, {}, {}, UseDefaultImports, &options); QVERIFY2(warnings.isEmpty(), qPrintable(QJsonDocument(warnings).toJson())); } diff --git a/tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp b/tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp index 6f12e585ba..7707b9731f 100644 --- a/tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp +++ b/tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp @@ -188,7 +188,7 @@ void tst_qmltc_qprocess::noQtQml() // test that qmltc exits gracefully const auto errors = runQmltc(u"dummy.qml"_qs, false); - QVERIFY(errors.contains(u"Failed to import QtQml. Are your include paths set up properly?"_qs)); + QVERIFY(errors.contains(u"Failed to import QtQml. Are your import paths set up properly?"_qs)); } void tst_qmltc_qprocess::inlineComponent() |