diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2024-02-22 11:38:21 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-02-25 12:40:16 +0000 |
commit | 6fac3de3c8e31de5eabcffcd98b1608ff634a135 (patch) | |
tree | 76c275da3b37641f16a8a86126b5953ee4b930d7 | |
parent | d2c829af3efe66aa039369b70ac806f7185623a9 (diff) |
qmllint: With --bare do not use the current directory
That's what --bare promises after all.
Pick-to: 6.5
Fixes: QTBUG-115478
Change-Id: Iae7563203709bc28b7bcaa0da68cad1826c035d9
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
(cherry picked from commit 7fae7bf04a28ff0751c8ff0aef0a1c42dc6db32d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 1b17d26a57d7abfc5548e14008473ceec60f55f1)
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 15 | ||||
-rw-r--r-- | tools/qmllint/main.cpp | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index d15277d6b6..f77705d322 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -401,6 +401,21 @@ void TestQmllint::autoqmltypes() QVERIFY(process.readAllStandardError() .contains("is not a qmldir file. Assuming qmltypes")); QVERIFY(process.readAllStandardOutput().isEmpty()); + + { + QProcess bare; + bare.setWorkingDirectory(testFile("autoqmltypes")); + bare.start(m_qmllintPath, { QStringLiteral("--bare"), QStringLiteral("test.qml") }); + bare.waitForFinished(); + + const QByteArray errors = bare.readAllStandardError(); + QVERIFY(!errors.contains("is not a qmldir file. Assuming qmltypes")); + QVERIFY(errors.contains("Failed to import TestTest.")); + QVERIFY(bare.readAllStandardOutput().isEmpty()); + + QCOMPARE(bare.exitStatus(), QProcess::NormalExit); + QVERIFY(bare.exitCode() != 0); + } } void TestQmllint::resources() diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp index 531f056a28..0c59e47169 100644 --- a/tools/qmllint/main.cpp +++ b/tools/qmllint/main.cpp @@ -296,7 +296,7 @@ All warnings can be set to three levels: QStringList defaultQmldirFiles; if (parser.isSet(qmldirFilesOption)) { defaultQmldirFiles = parser.values(qmldirFilesOption); - } else { + } else if (!parser.isSet(qmlImportNoDefault)){ // If nothing given explicitly, use the qmldir file from the current directory. QFileInfo qmldirFile(QStringLiteral("qmldir")); if (qmldirFile.isFile()) { |