tst_qmllint: Fix settings tests

Some of the settings tests were broken in a way where they could never
fail, even if the feature was broken. This is fixed now.

Also expanded the tests to also cover the additional qml import path option.

Change-Id: Ibd5b8fde36362ccf0cc3b9d7d639c2485fd6ae77
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Maximilian Goldstein 2022-01-11 13:14:34 +01:00
parent 4125efb29e
commit dd0e69a20b
8 changed files with 23 additions and 3 deletions

View File

@ -1,2 +1,2 @@
[Foo]
[General]
DisableDefaultImports=true

View File

@ -0,0 +1,2 @@
[General]
AdditionalQmlImportPaths=subdir

View File

@ -0,0 +1,3 @@
import Custom
Thing {}

View File

@ -0,0 +1,2 @@
module Custom
typeinfo custom.qmltypes

View File

@ -1,2 +1,3 @@
[General]
OverwriteImportTypes=custom.qmltypes
OverwriteImportTypes=subdir/custom.qmltypes

View File

@ -0,0 +1,11 @@
import QtQuick.tooling 1.2
Module {
dependencies: []
Component {
name: "Thing"
prototype: "QObject"
exports: [
"Custom/Thing 1.0",
]
}
}

View File

@ -1269,11 +1269,12 @@ void TestQmllint::settingsFile()
QVERIFY(runQmllint("settings/unusedImportWarning/unused.qml", false, QStringList(), false)
.contains(QStringLiteral("Info: %1:2:1: Unused import at %1:2:1")
.arg(testFile("settings/unusedImportWarning/unused.qml"))));
QVERIFY(runQmllint("settings/bare/bare.qml", false, { "--bare" }, false, false)
QVERIFY(runQmllint("settings/bare/bare.qml", false, {}, false, false)
.contains(QStringLiteral("Failed to find the following builtins: "
"builtins.qmltypes, jsroot.qmltypes")));
QVERIFY(runQmllint("settings/qmltypes/qmltypes.qml", false, QStringList(), false)
.contains(QStringLiteral("not a qmldir file. Assuming qmltypes.")));
QVERIFY(runQmllint("settings/qmlimports/qmlimports.qml", true, QStringList(), false).isEmpty());
}
void TestQmllint::additionalImplicitImport()