aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier De Cannière <[email protected]>2025-05-06 15:10:51 +0200
committerOlivier De Cannière <[email protected]>2025-05-08 12:31:35 +0200
commit230c1afe3e5c9b01bd2494b3eb9b90fec2844a50 (patch)
tree84ce18deee6571f69fc96dc3471dbd0b9b414286
parent15f3c849cc3afe720554492eea3c1c4dd24733f5 (diff)
tst_qmllint: Clean up sorted functions
Since we recently sorted some data test functions and the git history already is compromised, we can take the opportunity to clean those up. This unifies the style of all test entries and removes a lot of boilerplate. This should make the tests easier to read and navigate. There were 517 tests executed by qmllint both before and after this change. Pick-to: 6.9 6.8 6.5 Change-Id: Ie394c5b6e967377903da0138ac7ee37ec9dc6765 Reviewed-by: Sami Shalayel <[email protected]>
-rw-r--r--tests/auto/qml/qmllint/tst_qmllint.cpp883
1 files changed, 358 insertions, 525 deletions
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp
index 6bd0a471b0..ec408e96f7 100644
--- a/tests/auto/qml/qmllint/tst_qmllint.cpp
+++ b/tests/auto/qml/qmllint/tst_qmllint.cpp
@@ -511,189 +511,144 @@ void TestQmllint::dirtyQmlCode_data()
QTest::newRow("2Interceptors")
<< QStringLiteral("2interceptors.qml")
- << Result { { Message { QStringLiteral("Duplicate interceptor on property \"x\"") } } };
- QTest::newRow("2ValueSources") << QStringLiteral("2valueSources.qml")
- << Result { { Message { QStringLiteral(
- "Duplicate value source on property \"x\"") } } };
+ << Result{ { { "Duplicate interceptor on property \"x\""_L1 } } };
+ QTest::newRow("2ValueSources")
+ << QStringLiteral("2valueSources.qml")
+ << Result{ { { "Duplicate value source on property \"x\""_L1 } } };
QTest::newRow("AssignToReadOnlyProperty")
<< QStringLiteral("assignToReadOnlyProperty.qml")
- << Result{
- { Message{ QStringLiteral("Cannot assign to read-only property activeFocus") } },
- {},
- {}
- };
+ << Result{ { { "Cannot assign to read-only property activeFocus"_L1 } } };
QTest::newRow("AssignToReadOnlyProperty2")
<< QStringLiteral("assignToReadOnlyProperty2.qml")
- << Result { { Message {
- QStringLiteral("Cannot assign to read-only property activeFocus") } } };
+ << Result{ { { "Cannot assign to read-only property activeFocus"_L1 } } };
QTest::newRow("AutomatchedSignalHandler")
<< QStringLiteral("AutomatchedSignalHandler.qml")
- << Result { { Message { QStringLiteral("Unqualified access"), 12, 36 } } };
+ << Result{ { { "Unqualified access"_L1, 12, 36 } } };
QTest::newRow("AutomatchedSignalHandler2")
<< QStringLiteral("AutomatchedSignalHandler.qml")
- << Result{ { Message{
- QStringLiteral(
- "Implicitly defining \"onClicked\" as signal handler in Connections "
- "is deprecated. "
- "Create a function instead: \"function onClicked() { ... }\"")} } };
- QTest::newRow("BadAttached") << QStringLiteral("badAttached.qml")
- << Result { { Message { QStringLiteral(
- "unknown attached property scope WrongAttached.") } } };
- QTest::newRow("BadBinding") << QStringLiteral("badBinding.qml")
- << Result{ { Message{ QStringLiteral(
- "Could not find property \"doesNotExist\".") } } };
+ << Result{ { { "Implicitly defining \"onClicked\" as signal handler in Connections "
+ "is deprecated. Create a function instead: \"function onClicked() "
+ "{ ... }\""_L1 } } };
+ QTest::newRow("BadAttached")
+ << QStringLiteral("badAttached.qml")
+ << Result{ { { "unknown attached property scope WrongAttached."_L1 } } };
+ QTest::newRow("BadBinding")
+ << QStringLiteral("badBinding.qml")
+ << Result{ { { "Could not find property \"doesNotExist\"."_L1 } } };
QTest::newRow("BadLiteralBinding")
<< QStringLiteral("badLiteralBinding.qml")
- << Result { { Message {
- QStringLiteral("Cannot assign literal of type string to int") } } };
+ << Result{ { { "Cannot assign literal of type string to int"_L1 } } };
QTest::newRow("BadLiteralBindingDate")
<< QStringLiteral("badLiteralBindingDate.qml")
- << Result { { Message {
- QStringLiteral("Cannot assign binding of type QString to QDateTime") } } };
+ << Result{ { { "Cannot assign binding of type QString to QDateTime"_L1 } } };
QTest::newRow("BadModulePrefix")
<< QStringLiteral("badModulePrefix.qml")
- << Result { { Message {
- QStringLiteral("Cannot access singleton as a property of an object") } } };
+ << Result{ { { "Cannot access singleton as a property of an object"_L1 } } };
QTest::newRow("BadModulePrefix2")
<< QStringLiteral("badModulePrefix2.qml")
- << Result { { Message { QStringLiteral(
- "Cannot use non-QObject type QRectF to access prefixed import") } },
- { Message { QStringLiteral(
- "Type not found in namespace") },
- Message { QStringLiteral(
- "Member \"BirthdayParty\" not found on type \"QRectF\"") } },
- };
+ << Result{ { { "Cannot use non-QObject type QRectF to access prefixed import"_L1 } },
+ { { "Type not found in namespace"_L1 },
+ { "Member \"BirthdayParty\" not found on type \"QRectF\""_L1 } } };
QTest::newRow("BadPropertyType")
<< QStringLiteral("badPropertyType.qml")
- << Result { { Message { QStringLiteral(
- "No type found for property \"bad\". This may be due to a missing "
- "import statement or incomplete qmltypes files.") } } };
+ << Result{ { { "No type found for property \"bad\". This may be due to a missing "_L1
+ "import statement or incomplete qmltypes files."_L1 } } };
QTest::newRow("BadScriptBindingOnAttachedSignalHandler")
<< QStringLiteral("badScriptBinding.attachedSignalHandler.qml")
- << Result { { Message {
- QStringLiteral("no matching signal found for handler \"onBogusSignal\""), 3,
- 10 } } };
+ << Result{ { { "no matching signal found for handler \"onBogusSignal\""_L1, 3, 10 } } };
QTest::newRow("BadScriptBindingOnAttachedType")
<< QStringLiteral("badScriptBinding.attached.qml")
- << Result{ { Message{ QStringLiteral("Could not find property \"bogusProperty\"."), 5,
- 12 } } };
+ << Result{ { { "Could not find property \"bogusProperty\"."_L1, 5, 12 } } };
QTest::newRow("BadScriptBindingOnGroup")
<< QStringLiteral("badScriptBinding.group.qml")
- << Result{ { Message{ QStringLiteral("Could not find property \"bogusProperty\"."), 3,
- 10 } } };
+ << Result{ { { "Could not find property \"bogusProperty\"."_L1, 3, 10 } } };
{
const QString warning = u"Do not mix translation functions"_s;
- QTest::addRow("BadTranslationMix") << testFile(u"translations/BadMix.qml"_s)
- << Result{ {
- Message{ warning, 5, 49 },
- Message{ warning, 6, 56 },
- } };
+ QTest::addRow("BadTranslationMix")
+ << testFile(u"translations/BadMix.qml"_s)
+ << Result{ { { warning, 5, 49 }, { warning, 6, 56 }, } };
QTest::addRow("BadTranslationMixWithMacros")
<< testFile(u"translations/BadMixWithMacros.qml"_s)
- << Result{ {
- Message{ warning, 5, 29 },
- } };
+ << Result{ { { warning, 5, 29 } } };
}
QTest::newRow("CoerceToVoid")
<< QStringLiteral("coercetovoid.qml")
<< Result{ { { "Function without return type annotation returns double"_L1 } } };
QTest::newRow("DefaultPropertyLookupInUnknownType")
<< QStringLiteral("unknownParentDefaultPropertyCheck.qml")
- << Result { { Message { QStringLiteral(
- "Alien was not found. Did you add all imports and dependencies?") } } };
+ << Result{ { { "Alien was not found. Did you add all imports and dependencies?"_L1 } } };
QTest::newRow("DefaultPropertyWithWrongType(string)")
<< QStringLiteral("defaultPropertyWithWrongType.qml")
- << Result { { Message { QStringLiteral(
- "Cannot assign to default property of incompatible type") } },
- { Message { QStringLiteral(
- "Cannot assign to non-existent default property") } } };
+ << Result{ { { "Cannot assign to default property of incompatible type"_L1 } },
+ { { "Cannot assign to non-existent default property"_L1 } } };
QTest::newRow("Deprecation (Property binding, no reason)")
<< QStringLiteral("deprecatedPropertyBinding.qml")
- << Result { { Message {
- QStringLiteral("Binding on deprecated property \"deprecated\"") } } };
+ << Result{ { { "Binding on deprecated property \"deprecated\""_L1 } } };
QTest::newRow("Deprecation (Property binding, with reason)")
<< QStringLiteral("deprecatedPropertyBindingReason.qml")
- << Result { { Message { QStringLiteral(
- "Binding on deprecated property \"deprecatedReason\" (Reason: Test)") } } };
+ << Result{ { { "Binding on deprecated property \"deprecatedReason\" (Reason: Test)"_L1 } } };
QTest::newRow("Deprecation (Property, no reason)")
<< QStringLiteral("deprecatedProperty.qml")
- << Result { { Message { QStringLiteral("Property \"deprecated\" is deprecated") } } };
+ << Result{ { { "Property \"deprecated\" is deprecated"_L1 } } };
QTest::newRow("Deprecation (Property, with reason)")
<< QStringLiteral("deprecatedPropertyReason.qml")
- << Result { { Message {
- QStringLiteral("Property \"deprecated\" is deprecated (Reason: Test)") } } };
+ << Result{ { { "Property \"deprecated\" is deprecated (Reason: Test)"_L1 } } };
QTest::newRow("Deprecation (Type, no reason)")
<< QStringLiteral("deprecatedType.qml")
- << Result { { Message { QStringLiteral("Type \"TypeDeprecated\" is deprecated") } } };
+ << Result{ { { "Type \"TypeDeprecated\" is deprecated"_L1 } } };
QTest::newRow("Deprecation (Type, with reason)")
<< QStringLiteral("deprecatedTypeReason.qml")
- << Result { { Message { QStringLiteral(
- "Type \"TypeDeprecatedReason\" is deprecated (Reason: Test)") } } };
+ << Result{ { { "Type \"TypeDeprecatedReason\" is deprecated (Reason: Test)"_L1 } } };
QTest::newRow("DoubleAssignToDefaultProperty")
<< QStringLiteral("defaultPropertyWithDoubleAssignment.qml")
- << Result { { Message { QStringLiteral(
- "Cannot assign multiple objects to a default non-list property") } } };
+ << Result{ { { "Cannot assign multiple objects to a default non-list property"_L1 } } };
QTest::newRow("InvalidImport")
<< QStringLiteral("invalidImport.qml")
- << Result { { Message { QStringLiteral(
- "Failed to import FooBar. Are your import paths set up properly?"), 2, 1 } } };
+ << Result{ { { "Failed to import FooBar. Are your import paths set up properly?"_L1,
+ 2, 1 } } };
QTest::newRow("Invalid_id_blockstatement")
<< QStringLiteral("invalidId2.qml")
- << Result { { Message { QStringLiteral("id must be followed by an identifier") } } };
+ << Result{ { { "id must be followed by an identifier"_L1 } } };
QTest::newRow("Invalid_id_expression")
<< QStringLiteral("invalidId1.qml")
- << Result { { Message { QStringLiteral("Failed to parse id") } } };
- QTest::newRow("Invalid_syntax_JS") << QStringLiteral("failure1.js")
- << Result { { Message { QStringLiteral("Expected token `;'"),
- 4, 12, QtCriticalMsg } } };
+ << Result{ { { "Failed to parse id"_L1 } } };
+ QTest::newRow("Invalid_syntax_JS")
+ << QStringLiteral("failure1.js")
+ << Result{ { { "Expected token `;'"_L1, 4, 12, QtCriticalMsg } } };
QTest::newRow("Invalid_syntax_QML")
<< QStringLiteral("failure1.qml")
- << Result { { Message { QStringLiteral("Expected token `:'"), 4, 8, QtCriticalMsg } } };
+ << Result{ { { "Expected token `:'"_L1, 4, 8, QtCriticalMsg } } };
QTest::newRow("IsNotAnEntryOfEnum")
<< QStringLiteral("IsNotAnEntryOfEnum.qml")
- << Result{ {
- Message {
- QStringLiteral("Member \"Mode\" not found on type \"Item\""), 12,
- 29},
- Message{
- QStringLiteral("\"Hour\" is not an entry of enum \"Mode\"."), 13,
- 62}
- },
- {},
- { Message{ QStringLiteral("Hours") } }
- };
+ << Result{ { { "Member \"Mode\" not found on type \"Item\""_L1, 12, 29 },
+ { "\"Hour\" is not an entry of enum \"Mode\"."_L1, 13, 62 } },
+ {},
+ { { "Hours"_L1 } } };
QTest::newRow("MemberNotFound")
<< QStringLiteral("memberNotFound.qml")
- << Result { { Message {
- QStringLiteral("Member \"foo\" not found on type \"QtObject\""), 6,
- 31 } } };
+ << Result{ { { "Member \"foo\" not found on type \"QtObject\""_L1, 6, 31 } } };
QTest::newRow("MissingDefaultProperty")
<< QStringLiteral("defaultPropertyWithoutKeyword.qml")
- << Result { { Message {
- QStringLiteral("Cannot assign to non-existent default property") } } };
+ << Result{ { { "Cannot assign to non-existent default property"_L1 } } };
QTest::newRow("MissingDefaultPropertyDefinedInTheSameType")
<< QStringLiteral("defaultPropertyWithinTheSameType.qml")
- << Result { { Message {
- QStringLiteral("Cannot assign to non-existent default property") } } };
+ << Result{ { { "Cannot assign to non-existent default property"_L1 } } };
QTest::newRow("MultiDefaultPropertyWithWrongType")
<< QStringLiteral("multiDefaultPropertyWithWrongType.qml")
- << Result { { Message { QStringLiteral(
- "Cannot assign to default property of incompatible type") } },
- { Message { QStringLiteral(
- "Cannot assign to non-existent default property") } } };
+ << Result{ { { "Cannot assign to default property of incompatible type"_L1 } },
+ { { "Cannot assign to non-existent default property"_L1 } } };
QTest::newRow("NonExistentListProperty")
<< QStringLiteral("nonExistentListProperty.qml")
- << Result { { Message { QStringLiteral("Could not find property \"objs\".") } } };
+ << Result{ { { "Could not find property \"objs\"."_L1 } } };
QTest::newRow("NotScopedEnumCpp")
<< QStringLiteral("NotScopedEnumCpp.qml")
- << Result{ { Message{
- QStringLiteral("You cannot access unscoped enum \"TheEnum\" from here."), 5,
- 49 } } };
- QTest::newRow("OnAssignment") << QStringLiteral("onAssignment.qml")
- << Result { { Message { QStringLiteral(
- "Member \"loops\" not found on type \"bool\"") } } };
- QTest::newRow("PropertyAliasCycles") << QStringLiteral("settings/propertyAliasCycle/file.qml")
- << Result::cleanWithSettings();
+ << Result{ { { "You cannot access unscoped enum \"TheEnum\" from here."_L1, 5, 49 } } };
+ QTest::newRow("OnAssignment")
+ << QStringLiteral("onAssignment.qml")
+ << Result{ { { "Member \"loops\" not found on type \"bool\""_L1 } } };
+ QTest::newRow("PropertyAliasCycles")
+ << QStringLiteral("settings/propertyAliasCycle/file.qml")
+ << Result::cleanWithSettings();
// make sure that warnings are triggered without settings:
QTest::newRow("PropertyAliasCycles2")
<< QStringLiteral("settings/propertyAliasCycle/file.qml")
@@ -701,552 +656,428 @@ void TestQmllint::dirtyQmlCode_data()
{ "\"cycle1\" is part of an alias cycle"_L1 } } };
QTest::newRow("QtQuick.Window 2.0")
<< QStringLiteral("qtquickWindow20.qml")
- << Result { { Message { QStringLiteral(
- "Member \"window\" not found on type \"QQuickWindow\"") } } };
+ << Result{ { { "Member \"window\" not found on type \"QQuickWindow\""_L1 } } };
QTest::newRow("SignalParameterMismatch")
<< QStringLiteral("namedSignalParameters.qml")
- << Result { { Message { QStringLiteral(
- "Parameter 1 to signal handler for \"onSig\" is called \"argarg\". "
- "The signal has a parameter of the same name in position 2.") } },
- { Message { QStringLiteral("onSig2") } } };
+ << Result{ { { "Parameter 1 to signal handler for \"onSig\" is called \"argarg\". "
+ "The signal has a parameter of the same name in position 2."_L1 } },
+ { { "onSig2"_L1 } } };
QTest::newRow("StoreNameMethod")
<< QStringLiteral("storeNameMethod.qml")
- << Result { { Message { QStringLiteral("Cannot assign to method foo") } } };
+ << Result{ { { "Cannot assign to method foo"_L1 } } };
QTest::newRow("TooManySignalParameters")
<< QStringLiteral("tooManySignalParameters.qml")
- << Result { { Message {
- QStringLiteral("Signal handler for \"onSig\" has more formal parameters "
- "than the signal it handles.") } } };
- QTest::newRow("TypePropertAccess") << QStringLiteral("typePropertyAccess.qml") << Result {};
+ << Result{ { { "Signal handler for \"onSig\" has more formal parameters than the "
+ "signal it handles."_L1 } } };
+ QTest::newRow("TypePropertAccess")
+ << QStringLiteral("typePropertyAccess.qml")
+ << Result{};
QTest::newRow("UnknownJavascriptMethd")
<< QStringLiteral("unknownJavascriptMethod.qml")
- << Result { { Message {
- QStringLiteral("Member \"foo2\" not found on type \"Methods\""), 5,
- 25 } } };
+ << Result{ { { "Member \"foo2\" not found on type \"Methods\""_L1, 5, 25 } } };
QTest::newRow("Unused Import (prefix)")
<< QStringLiteral("unused_prefix.qml")
- << Result { { Message { QStringLiteral("Unused import"), 1, 1, QtInfoMsg } },
+ << Result{ { { "Unused import"_L1, 1, 1, QtInfoMsg } },
{},
{},
Result::ExitsNormally };
QTest::newRow("Unused Import (simple)")
<< QStringLiteral("unused_simple.qml")
- << Result { { Message { QStringLiteral("Unused import"), 1, 1, QtInfoMsg } },
+ << Result{ { { "Unused import"_L1, 1, 1, QtInfoMsg } },
{},
{},
Result::ExitsNormally };
QTest::newRow("ValueSource+2Interceptors")
<< QStringLiteral("valueSourceBetween2interceptors.qml")
- << Result { { Message { QStringLiteral("Duplicate interceptor on property \"x\"") } } };
+ << Result{ { { "Duplicate interceptor on property \"x\""_L1 } } };
QTest::newRow("ValueSource+ListValue")
<< QStringLiteral("valueSource_listValue.qml")
- << Result { { Message { QStringLiteral(
- "Cannot combine value source and binding on property \"objs\"") } } };
+ << Result{ { { "Cannot combine value source and binding on property \"objs\""_L1 } } };
QTest::newRow("ValueSource+Value")
<< QStringLiteral("valueSource_Value.qml")
- << Result { { Message { QStringLiteral(
- "Cannot combine value source and binding on property \"obj\"") } } };
+ << Result{ { { "Cannot combine value source and binding on property \"obj\""_L1 } } };
QTest::newRow("VariableUsedBeforeDeclaration")
<< QStringLiteral("useBeforeDeclaration.qml")
- << Result{ {
- Message{ "Identifier 'argq' is used here before its declaration"_L1, 5, 9 },
- Message{ "Note: declaration of 'argq' here"_L1, 6, 13 },
- } };
- QTest::newRow("WithStatement") << QStringLiteral("WithStatement.qml")
- << Result { { Message { QStringLiteral(
- "with statements are strongly discouraged") } } };
- QTest::newRow("aliasCycle1") << QStringLiteral("aliasCycle.qml")
- << Result { { Message {
- QStringLiteral("Alias \"b\" is part of an alias cycle"),
- 6, 5 } } };
- QTest::newRow("aliasCycle2") << QStringLiteral("aliasCycle.qml")
- << Result { { Message {
- QStringLiteral("Alias \"a\" is part of an alias cycle"),
- 5, 5 } } };
+ << Result{ { { "Identifier 'argq' is used here before its declaration"_L1, 5, 9 },
+ { "Note: declaration of 'argq' here"_L1, 6, 13 }, } };
+ QTest::newRow("WithStatement")
+ << QStringLiteral("WithStatement.qml")
+ << Result{ { { "with statements are strongly discouraged"_L1 } } };
+ QTest::newRow("aliasCycle1")
+ << QStringLiteral("aliasCycle.qml")
+ << Result{ { { "Alias \"b\" is part of an alias cycle"_L1, 6, 5 } } };
+ QTest::newRow("aliasCycle2")
+ << QStringLiteral("aliasCycle.qml")
+ << Result{ { { "Alias \"a\" is part of an alias cycle"_L1, 5, 5 } } };
QTest::newRow("anchors3")
<< QStringLiteral("anchors3.qml")
- << Result { { Message { QStringLiteral(
- "Cannot assign binding of type QQuickItem to QQuickAnchorLine") } } };
+ << Result{ { { "Cannot assign binding of type QQuickItem to QQuickAnchorLine"_L1 } } };
QTest::newRow("annotatedDefaultParameter")
<< QStringLiteral("annotatedDefaultParameter.qml")
<< Result{ { { "Type annotations on default parameters are not supported"_L1 } } };
QTest::newRow("assignNonExistingTypeToVarProp")
<< QStringLiteral("assignNonExistingTypeToVarProp.qml")
- << Result { { Message { QStringLiteral(
- "NonExistingType was not found. Did you add all imports and dependencies?")
- } } };
+ << Result{ { { "NonExistingType was not found. Did you add all imports and "
+ "dependencies?"_L1 } } };
// should succeed, but it does not:
QTest::newRow("attachedPropertyAccess")
- << QStringLiteral("goodAttachedPropertyAccess.qml") << Result::clean();
+ << QStringLiteral("goodAttachedPropertyAccess.qml")
+ << Result::clean();
// should succeed, but it does not:
QTest::newRow("attachedPropertyNested")
- << QStringLiteral("goodAttachedPropertyNested.qml") << Result::clean();
+ << QStringLiteral("goodAttachedPropertyNested.qml")
+ << Result::clean();
QTest::newRow("autoFixConnectionsBinding")
<< QStringLiteral("autofix/ConnectionsHandler.qml")
- << Result{
- { Message{
- u"Implicitly defining \"onWidthChanged\" as signal handler in "
- u"Connections is deprecated. "
- u"Create a function instead: \"function onWidthChanged() { ... }\"."_s },
- Message{
- u"Implicitly defining \"onColorChanged\" as signal handler in "
- u"Connections is deprecated. "
- u"Create a function instead: \"function onColorChanged(collie) { ... }\"."_s } },
- {},
- {
- Message{ u"function onWidthChanged() { console.log(\"new width:\", width) }"_s },
- Message{ u"function onColorChanged(col) { console.log(\"new color:\", col) }"_s },
- },
- };
+ << Result{ { { "Implicitly defining \"onWidthChanged\" as signal handler in "
+ "Connections is deprecated. Create a function instead: \"function "
+ "onWidthChanged() { ... }\"."_L1 },
+ { "Implicitly defining \"onColorChanged\" as signal handler in "
+ "Connections is deprecated. Create a function instead: \"function "
+ "onColorChanged(collie) { ... }\"."_L1 } },
+ { },
+ { { "function onWidthChanged() { console.log(\"new width:\", width) }"_L1 },
+ { "function onColorChanged(col) { console.log(\"new color:\", col) }"_L1 }, }, };
QTest::newRow("bad constant number to string")
<< QStringLiteral("numberToStringProperty.qml")
- << Result { { Message { QStringLiteral(
- "Cannot assign literal of type double to QString") } } };
+ << Result{ { { "Cannot assign literal of type double to QString"_L1 } } };
QTest::newRow("bad string binding (QT_TR_NOOP)")
<< QStringLiteral("bad_QT_TR_NOOP.qml")
- << Result { { Message {
- QStringLiteral("Cannot assign literal of type string to int") } } };
+ << Result{ { { "Cannot assign literal of type string to int"_L1 } } };
QTest::newRow("bad template literal (simple)")
<< QStringLiteral("badTemplateStringSimple.qml")
- << Result { { Message {
- QStringLiteral("Cannot assign literal of type string to int") } } };
- QTest::newRow("bad tranlsation binding (qsTr)") << QStringLiteral("bad_qsTr.qml") << Result {};
+ << Result{ { { "Cannot assign literal of type string to int"_L1 } } };
+ QTest::newRow("bad tranlsation binding (qsTr)")
+ << QStringLiteral("bad_qsTr.qml")
+ << Result{};
QTest::newRow("bad unary minus to string")
<< QStringLiteral("unaryMinusToStringProperty.qml")
- << Result { { Message { QStringLiteral(
- "Cannot assign literal of type double to QString") } } };
+ << Result{ { { "Cannot assign literal of type double to QString"_L1 } } };
QTest::newRow("badAlias")
<< QStringLiteral("badAlias.qml")
- << Result { { Message { QStringLiteral("Cannot resolve alias \"wrong\""), 4, 5 } } };
+ << Result{ { { "Cannot resolve alias \"wrong\""_L1, 4, 5 } } };
QTest::newRow("badAliasExpression")
<< QStringLiteral("badAliasExpression.qml")
- << Result { { Message {
- QStringLiteral("Invalid alias expression. Only IDs and field member "
- "expressions can be aliased"),
- 5, 26 } } };
+ << Result{ { { "Invalid alias expression. Only IDs and field member expressions can "_L1
+ "be aliased"_L1, 5, 26 } } };
QTest::newRow("badAliasNotAnExpression")
<< QStringLiteral("badAliasNotAnExpression.qml")
- << Result { { Message {
- QStringLiteral("Invalid alias expression. Only IDs and field member "
- "expressions can be aliased"),
- 4, 30 } } };
+ << Result{ { { "Invalid alias expression. Only IDs and field member expressions can "_L1
+ "be aliased"_L1, 4, 30 } } };
QTest::newRow("badAliasObject")
<< QStringLiteral("badAliasObject.qml")
- << Result { { Message { QStringLiteral("Member \"wrongwrongwrong\" not "
- "found on type \"QtObject\""),
- 8, 40 } } };
+ << Result{ { { "Member \"wrongwrongwrong\" not found on type \"QtObject\""_L1, 8, 40 } } };
QTest::newRow("badAliasProperty1")
<< QStringLiteral("badAliasProperty.qml")
- << Result { { Message { QStringLiteral("Cannot resolve alias \"wrong\""), 5, 5 } } };
+ << Result{ { { "Cannot resolve alias \"wrong\""_L1, 5, 5 } } };
QTest::newRow("badAttachedProperty")
<< QStringLiteral("badAttachedProperty.qml")
<< Result{ { { "Member \"progress\" not found on type \"TestTypeAttached\""_L1 } } };
QTest::newRow("badAttachedPropertyNested")
<< QStringLiteral("badAttachedPropertyNested.qml")
- << Result { { Message { QStringLiteral(
- "Member \"progress\" not found on type \"QObject\""),
- 12, 41 } },
- { Message { QString("Member \"progress\" not found on type \"QObject\""),
- 6, 37 } } };
+ << Result{ { { "Member \"progress\" not found on type \"QObject\""_L1, 12, 41 } },
+ { { "Member \"progress\" not found on type \"QObject\""_L1, 6, 37 } } };
QTest::newRow("badAttachedPropertyTypeQtObject")
<< QStringLiteral("badAttachedPropertyTypeQtObject.qml")
- << Result{ { Message{
- QStringLiteral("Cannot assign object of type QtObject to int") } } };
+ << Result{ { { "Cannot assign object of type QtObject to int"_L1 } } };
QTest::newRow("badAttachedPropertyTypeString")
<< QStringLiteral("badAttachedPropertyTypeString.qml")
- << Result{ { Message{ QStringLiteral("Cannot assign literal of type string to int") } },
- {},
- {} };
+ << Result{ { { "Cannot assign literal of type string to int"_L1 } } };
QTest::newRow("badEnumFromQtQml")
<< QStringLiteral("badEnumFromQtQml.qml")
- << Result { { Message { QStringLiteral("Member \"Linear123\" not "
- "found on type \"QQmlEasingEnums\""),
- 4, 30 } } };
+ << Result{ { { "Member \"Linear123\" not found on type \"QQmlEasingEnums\""_L1,
+ 4, 30 } } };
QTest::newRow("badGeneralizedGroup1")
<< QStringLiteral("badGeneralizedGroup1.qml")
- << Result{ { Message{ QStringLiteral("Could not find property \"aaaa\".") } } };
+ << Result{ { { "Could not find property \"aaaa\"."_L1 } } };
QTest::newRow("badGeneralizedGroup2")
<< QStringLiteral("badGeneralizedGroup2.qml")
- << Result { { Message { QStringLiteral("unknown grouped property scope aself") } } };
+ << Result{ { { "unknown grouped property scope aself"_L1 } } };
QTest::newRow("badParent")
<< QStringLiteral("badParent.qml")
- << Result { { Message { QStringLiteral("Member \"rrr\" not found on type \"Item\""),
- 5, 34 } } };
+ << Result{ { { "Member \"rrr\" not found on type \"Item\""_L1, 5, 34 } } };
QTest::newRow("badQmldirImportAndDepend")
<< QStringLiteral("qmldirImportAndDepend/bad.qml")
- << Result { { Message {
- QStringLiteral("Item was not found. "
- "Did you add all imports and dependencies?"),
- 3, 1 } } };
- QTest::newRow("badScript") << QStringLiteral("badScript.qml")
- << Result { { Message {
- QStringLiteral(
- "Member \"stuff\" not found on type \"Empty\""),
- 5, 21 } } };
+ << Result{ { { "Item was not found. Did you add all imports and dependencies?"_L1,
+ 3, 1 } } };
+ QTest::newRow("badScript")
+ << QStringLiteral("badScript.qml")
+ << Result{ { { "Member \"stuff\" not found on type \"Empty\""_L1, 5, 21 } } };
QTest::newRow("badScriptOnAttachedProperty")
<< QStringLiteral("badScript.attached.qml")
- << Result { { Message { QStringLiteral("Unqualified access"), 3, 26 } } };
+ << Result{ { { "Unqualified access"_L1, 3, 26 } } };
QTest::newRow("badTypeAssertion")
<< QStringLiteral("badTypeAssertion.qml")
- << Result { { Message {
- QStringLiteral("Member \"rrr\" not found on type \"QQuickItem\""), 5,
- 39 } } };
+ << Result{ { { "Member \"rrr\" not found on type \"QQuickItem\""_L1, 5, 39 } } };
QTest::newRow("badlyBoundComponents")
<< QStringLiteral("badlyBoundComponents.qml")
- << Result{ { Message{ QStringLiteral("Unqualified access"), 18, 36 } } };
+ << Result{ { { "Unqualified access"_L1, 18, 36 } } };
QTest::newRow("brokenNamespace")
<< QStringLiteral("brokenNamespace.qml")
- << Result { { Message { QStringLiteral("Type not found in namespace"), 4, 19 } } };
+ << Result{ { { "Type not found in namespace"_L1, 4, 19 } } };
QTest::newRow("cachedDependency")
<< QStringLiteral("cachedDependency.qml")
- << Result { { Message { QStringLiteral("Unused import"), 1, 1, QtInfoMsg } },
- { Message { QStringLiteral(
- "Cannot assign binding of type QQuickItem to QObject") } },
+ << Result{ { { "Unused import"_L1, 1, 1, QtInfoMsg } },
+ { { "Cannot assign binding of type QQuickItem to QObject"_L1 } },
{},
Result::ExitsNormally };
QTest::newRow("callJSValue")
<< QStringLiteral("callJSValueProp.qml")
- << Result { { Message { QStringLiteral(
- "Property \"jsValue\" is a QJSValue property. It may or may not be "
- "a method. Use a regular Q_INVOKABLE instead.") } } };
+ << Result{ { { "Property \"jsValue\" is a QJSValue property. It may or may not be "
+ "a method. Use a regular Q_INVOKABLE instead."_L1 } } };
QTest::newRow("callVarProp")
<< QStringLiteral("callVarProp.qml")
- << Result { { Message { QStringLiteral(
- "Property \"foo\" is a var property. It may or may not be a "
- "method. Use a regular function instead.") } } };
+ << Result{ { { "Property \"foo\" is a var property. It may or may not be a "
+ "method. Use a regular function instead."_L1 } } };
QTest::newRow("connectionsBinding")
<< QStringLiteral("autofix/ConnectionsHandler.qml")
- << Result{
- { Message{
- u"Implicitly defining \"onWidthChanged\" as signal handler in "
- u"Connections is deprecated. "
- u"Create a function instead: \"function onWidthChanged() { ... }\"."_s },
- Message{
- u"Implicitly defining \"onColorChanged\" as signal handler in "
- u"Connections is deprecated. "
- u"Create a function instead: \"function onColorChanged(collie) { ... }\"."_s } },
- };
+ << Result{ { { "Implicitly defining \"onWidthChanged\" as signal handler in "
+ "Connections is deprecated. Create a function instead: \"function "
+ "onWidthChanged() { ... }\"."_L1 },
+ { "Implicitly defining \"onColorChanged\" as signal handler in "
+ "Connections is deprecated. Create a function instead: "
+ "\"function onColorChanged(collie) { ... }\"."_L1 } } };
QTest::newRow("cppPropertyChangeHandlers-no-property")
<< QStringLiteral("badCppPropertyChangeHandlers3.qml")
- << Result { { Message {
- QStringLiteral("no matching signal found for handler \"onXChanged\"") } } };
+ << Result{ { { "no matching signal found for handler \"onXChanged\""_L1 } } };
QTest::newRow("cppPropertyChangeHandlers-not-a-signal")
<< QStringLiteral("badCppPropertyChangeHandlers4.qml")
- << Result { { Message { QStringLiteral(
- "no matching signal found for handler \"onWannabeSignal\"") } } };
+ << Result{ { { "no matching signal found for handler \"onWannabeSignal\""_L1 } } };
QTest::newRow("cppPropertyChangeHandlers-wrong-parameters-size-bindable")
<< QStringLiteral("badCppPropertyChangeHandlers1.qml")
- << Result { { Message { QStringLiteral(
- "Signal handler for \"onAChanged\" has more formal parameters than "
- "the signal it handles") } } };
+ << Result{ { { "Signal handler for \"onAChanged\" has more formal parameters than "
+ "the signal it handles"_L1 } } };
QTest::newRow("cppPropertyChangeHandlers-wrong-parameters-size-notify")
<< QStringLiteral("badCppPropertyChangeHandlers2.qml")
- << Result { { Message { QStringLiteral(
- "Signal handler for \"onBChanged\" has more formal parameters than "
- "the signal it handles") } } };
+ << Result{ { { "Signal handler for \"onBChanged\" has more formal parameters than "
+ "the signal it handles"_L1 } } };
QTest::newRow("cycle in import")
<< QStringLiteral("cycleHead.qml")
- << Result { { Message { QStringLiteral(
- "MenuItem is part of an inheritance cycle: MenuItem -> MenuItem") } } };
+ << Result{ { { "MenuItem is part of an inheritance cycle: MenuItem -> MenuItem"_L1 } } };
QTest::newRow("deprecatedFunction")
<< QStringLiteral("deprecatedFunction.qml")
- << Result { { Message { QStringLiteral(
- "Method \"deprecated(foobar)\" is deprecated (Reason: No particular "
- "reason.)") } } };
+ << Result{ { { "Method \"deprecated(foobar)\" is deprecated (Reason: No particular "
+ "reason.)"_L1 } } };
QTest::newRow("deprecatedFunctionInherited")
<< QStringLiteral("deprecatedFunctionInherited.qml")
- << Result { { Message { QStringLiteral(
- "Method \"deprecatedInherited(c, d)\" is deprecated (Reason: This "
- "deprecation should be visible!)") } } };
+ << Result{ { { "Method \"deprecatedInherited(c, d)\" is deprecated (Reason: This "
+ "deprecation should be visible!)"_L1 } } };
QTest::newRow("didYouMean(binding)")
<< QStringLiteral("didYouMeanBinding.qml")
- << Result{ { Message{ QStringLiteral("Could not find property \"witdh\".") } },
+ << Result{ { { "Could not find property \"witdh\"."_L1 } },
{},
- { Message{ QStringLiteral("width") } } };
+ { { "width"_L1 } } };
QTest::newRow("didYouMean(component)")
<< QStringLiteral("didYouMeanComponent.qml")
- << Result { { Message { QStringLiteral(
- "Itym was not found. Did you add all imports and dependencies?")
- }, {},
- { Message { QStringLiteral("Item") } } } };
+ << Result{ { { "Itym was not found. Did you add all imports and dependencies?"_L1 },
+ {},
+ { { "Item"_L1 } } } };
QTest::newRow("didYouMean(enum)")
<< QStringLiteral("didYouMeanEnum.qml")
- << Result { { Message { QStringLiteral(
- "Member \"Readx\" not found on type \"QQuickImage\"") },
+ << Result{ { { "Member \"Readx\" not found on type \"QQuickImage\""_L1 },
{},
- { Message { QStringLiteral("Ready") } } } };
+ { { "Ready"_L1 } } } };
QTest::newRow("didYouMean(property)")
<< QStringLiteral("didYouMeanProperty.qml")
- << Result { { Message { QStringLiteral(
- "Member \"hoight\" not found on type \"Rectangle\"") },
+ << Result{ { { "Member \"hoight\" not found on type \"Rectangle\""_L1 },
{},
- { Message { QStringLiteral("height") } } } };
+ { { "height"_L1 } } } };
QTest::newRow("didYouMean(propertyCall)")
<< QStringLiteral("didYouMeanPropertyCall.qml")
- << Result {
- { Message { QStringLiteral("Member \"lgg\" not found on type \"Console\"") },
- {},
- { Message { QStringLiteral("log") } } }
- };
+ << Result{ { { "Member \"lgg\" not found on type \"Console\""_L1 },
+ {},
+ { { "log"_L1 } } } };
QTest::newRow("didYouMean(unqualified)")
<< QStringLiteral("didYouMeanUnqualified.qml")
- << Result { { Message { QStringLiteral("Unqualified access") } },
+ << Result{ { { "Unqualified access"_L1 } },
{},
- { Message { QStringLiteral("height") } } };
+ { { "height"_L1 } } };
QTest::newRow("didYouMean(unqualifiedCall)")
<< QStringLiteral("didYouMeanUnqualifiedCall.qml")
- << Result { { Message { QStringLiteral("Unqualified access") } },
+ << Result{ { { "Unqualified access"_L1 } },
{},
- { Message { QStringLiteral("func") } } };
+ { { "func"_L1 } } };
QTest::newRow("duplicated id")
<< QStringLiteral("duplicateId.qml")
- << Result { { Message {
- QStringLiteral("Found a duplicated id. id root was first declared "), 0, 0,
- QtCriticalMsg } } };
+ << Result{ { { "Found a duplicated id. id root was first declared "_L1, 0, 0,
+ QtCriticalMsg } } };
QTest::newRow("duplicatedPropertyName")
<< QStringLiteral("duplicatedPropertyName.qml")
- << Result{ { Message{ QStringLiteral("Duplicated property name \"cat\"."), 5, 5 } } };
+ << Result{ { { "Duplicated property name \"cat\"."_L1, 5, 5 } } };
QTest::newRow("duplicatedSignalName")
<< QStringLiteral("duplicatedPropertyName.qml")
- << Result{ { Message{ QStringLiteral("Duplicated signal name \"clicked\"."), 8, 5 } } };
+ << Result{ { { "Duplicated signal name \"clicked\"."_L1, 8, 5 } } };
QTest::newRow("enumInvalid")
<< QStringLiteral("enumInvalid.qml")
- << Result { {
- Message { QStringLiteral("Member \"red\" not found on type \"QtObject\""), 5, 25 },
- Message { QStringLiteral("Member \"red\" not found on type \"QtObject\""), 6, 25 },
- Message {
- QStringLiteral("You cannot access unscoped enum \"Unscoped\" from here."),
- 8, 32
- },
- Message {
- QStringLiteral("You cannot access unscoped enum \"Unscoped\" from here."),
- 9, 38
- },
- Message {
- QStringLiteral("Member \"S2\" not found on type \"EnumTesterScoped\""),
- 10, 38
- },
- }, {
- Message { QStringLiteral("Did you mean \"S2\"?"), 0, 0, QtInfoMsg }
- }, {
- Message { QStringLiteral("Did you mean \"U2\"?"), 10, 38, QtInfoMsg }
- } };
+ << Result{ { { "Member \"red\" not found on type \"QtObject\""_L1, 5, 25 },
+ { "Member \"red\" not found on type \"QtObject\""_L1, 6, 25 },
+ { "You cannot access unscoped enum \"Unscoped\" from here."_L1, 8, 32 },
+ { "You cannot access unscoped enum \"Unscoped\" from here."_L1, 9, 38 },
+ { "Member \"S2\" not found on type \"EnumTesterScoped\""_L1, 10, 38 }, },
+ { { "Did you mean \"S2\"?"_L1, 0, 0, QtInfoMsg } },
+ { { "Did you mean \"U2\"?"_L1, 10, 38, QtInfoMsg } } };
QTest::newRow("id_in_value_type")
<< QStringLiteral("idInValueType.qml")
- << Result{ { Message{ "id declarations are only allowed in objects" } } };
+ << Result{ { { "id declarations are only allowed in objects"_L1 } } };
QTest::newRow("inaccessibleId")
<< QStringLiteral("inaccessibleId.qml")
- << Result { { Message {
- QStringLiteral("Member \"objectName\" not found on type \"int\"") } } };
+ << Result{ { { "Member \"objectName\" not found on type \"int\""_L1 } } };
QTest::newRow("inaccessibleId2")
<< QStringLiteral("inaccessibleId2.qml")
- << Result { { Message {
- QStringLiteral("Member \"objectName\" not found on type \"int\"") } } };
+ << Result{ { { "Member \"objectName\" not found on type \"int\""_L1 } } };
QTest::newRow("incompleteQmltypes")
<< QStringLiteral("incompleteQmltypes.qml")
- << Result { { Message {
- QStringLiteral("Type \"QPalette\" of property \"palette\" not found"), 5,
- 26 } } };
+ << Result{ { { "Type \"QPalette\" of property \"palette\" not found"_L1, 5, 26 } } };
QTest::newRow("incompleteQmltypes2")
<< QStringLiteral("incompleteQmltypes2.qml")
- << Result { { Message { QStringLiteral("Member \"weDontKnowIt\" "
- "not found on type \"CustomPalette\""),
- 5, 35 } } };
+ << Result{ { { "Member \"weDontKnowIt\" not found on type \"CustomPalette\""_L1,
+ 5, 35 } } };
QTest::newRow("incompleteQmltypes3")
<< QStringLiteral("incompleteQmltypes3.qml")
- << Result { { Message {
- QStringLiteral("Type \"QPalette\" of property \"palette\" not found"), 5,
- 21 } } };
+ << Result{ { { "Type \"QPalette\" of property \"palette\" not found"_L1, 5, 21 } } };
QTest::newRow("inheritanceCycle")
<< QStringLiteral("Cycle1.qml")
- << Result { { Message {
- QStringLiteral("Cycle1 is part of an inheritance cycle: Cycle2 -> Cycle3 "
- "-> Cycle1 -> Cycle2"),
- 2, 1 } } };
+ << Result{ { { "Cycle1 is part of an inheritance cycle: Cycle2 -> Cycle3 -> "
+ "Cycle1 -> Cycle2"_L1,
+ 2, 1 } } };
QTest::newRow("inlineComponentNoComponent")
<< QStringLiteral("inlineComponentNoComponent.qml")
- << Result { { Message {
- QStringLiteral("Inline component declaration must be followed by a typename"),
- 3, 2 } } };
- QTest::newRow("invalidAliasTarget1") << QStringLiteral("invalidAliasTarget.qml")
- << Result { { Message {
- QStringLiteral("Invalid alias expression - an initalizer is needed."),
- 6, 18 } } };
- QTest::newRow("invalidAliasTarget2") << QStringLiteral("invalidAliasTarget.qml")
- << Result { { Message {
- QStringLiteral("Invalid alias expression. Only IDs and field member expressions can be aliased"),
- 7, 30 } } };
- QTest::newRow("invalidAliasTarget3") << QStringLiteral("invalidAliasTarget.qml")
- << Result { { Message {
- QStringLiteral("Invalid alias expression. Only IDs and field member expressions can be aliased"),
- 9, 34 } } };
+ << Result{ { { "Inline component declaration must be followed by a typename"_L1,
+ 3, 2 } } };
+ QTest::newRow("invalidAliasTarget1")
+ << QStringLiteral("invalidAliasTarget.qml")
+ << Result{ { { "Invalid alias expression - an initalizer is needed."_L1, 6, 18 } } };
+ QTest::newRow("invalidAliasTarget2")
+ << QStringLiteral("invalidAliasTarget.qml")
+ << Result{ { { "Invalid alias expression. Only IDs and field member expressions can "
+ "be aliased"_L1,
+ 7, 30 } } };
+ QTest::newRow("invalidAliasTarget3")
+ << QStringLiteral("invalidAliasTarget.qml")
+ << Result{ { { "Invalid alias expression. Only IDs and field member expressions can be "
+ "aliased"_L1,
+ 9, 34 } } };
QTest::newRow("invalidInterceptor")
<< QStringLiteral("invalidInterceptor.qml")
- << Result { { Message { QStringLiteral(
- "On-binding for property \"angle\" has wrong type \"Item\"") } } };
+ << Result{ { { "On-binding for property \"angle\" has wrong type \"Item\""_L1 } } };
QTest::newRow("javascriptMethodsInModule")
<< QStringLiteral("javascriptMethodsInModuleBad.qml")
- << Result { { Message {
- QStringLiteral("Member \"unknownFunc\" not found on type \"Foo\""), 5,
- 21 } } };
+ << Result{ { { "Member \"unknownFunc\" not found on type \"Foo\""_L1, 5, 21 } } };
QTest::newRow("jsVarDeclarationsWriteConst")
<< QStringLiteral("jsVarDeclarationsWriteConst.qml")
- << Result { { Message {
- QStringLiteral("Cannot assign to read-only property constProp") } } };
+ << Result{ { { "Cannot assign to read-only property constProp"_L1 } } };
QTest::newRow("lowerCaseQualifiedImport")
<< QStringLiteral("lowerCaseQualifiedImport.qml")
- << Result{
- {
- Message{
- u"Import qualifier 'test' must start with a capital letter."_s },
- Message{
- u"Namespace 'test' of 'test.Rectangle' must start with an upper case letter."_s },
- },
- {},
- {}
- };
+ << Result{ { { "Import qualifier 'test' must start with a capital letter."_L1 },
+ { "Namespace 'test' of 'test.Rectangle' must start with an upper case "
+ "letter."_L1 } } };
QTest::newRow("lowerCaseQualifiedImport2")
<< QStringLiteral("lowerCaseQualifiedImport2.qml")
- << Result{
- {
- Message{
- u"Import qualifier 'test' must start with a capital letter."_s },
- Message{
- u"Namespace 'test' of 'test.Item' must start with an upper case letter."_s },
- Message{
- u"Namespace 'test' of 'test.Rectangle' must start with an upper case letter."_s },
- Message{
- u"Namespace 'test' of 'test.color' must start with an upper case letter."_s },
- Message{
- u"Namespace 'test' of 'test.Grid' must start with an upper case letter."_s },
- },
- {},
- {}
- };
+ << Result{ { { "Import qualifier 'test' must start with a capital letter."_L1 },
+ { "Namespace 'test' of 'test.Item' must start with an upper case letter."_L1 },
+ { "Namespace 'test' of 'test.Rectangle' must start with an upper case letter."_L1 },
+ { "Namespace 'test' of 'test.color' must start with an upper case letter."_L1 },
+ { "Namespace 'test' of 'test.Grid' must start with an upper case letter."_L1 } } };
QTest::newRow("missingComponentBehaviorBound")
<< QStringLiteral("missingComponentBehaviorBound.qml")
- << Result {
- { Message{ QStringLiteral("Unqualified access"), 8, 31 } },
- {},
- { Message{ QStringLiteral("Set \"pragma ComponentBehavior: Bound\" in "
- "order to use IDs from outer components "
- "in nested components."), 0, 0, QtInfoMsg } },
- Result::AutoFixable
- };
+ << Result{ { { "Unqualified access"_L1, 8, 31 } },
+ {},
+ { { "Set \"pragma ComponentBehavior: Bound\" in order to use IDs from "
+ "outer components in nested components."_L1,
+ 0, 0, QtInfoMsg } },
+ Result::AutoFixable };
QTest::newRow("missingQmltypes")
<< QStringLiteral("missingQmltypes.qml")
- << Result { { Message { QStringLiteral("QML types file does not exist") } } };
+ << Result{ { { "QML types file does not exist"_L1 } } };
QTest::newRow("missingRequiredAlias")
<< QStringLiteral("missingRequiredAlias.qml")
- << Result{ { Message{ u"Component is missing required property foo from Item"_s } } };
+ << Result{ { { "Component is missing required property foo from Item"_L1 } } };
QTest::newRow("missingRequiredOnObjectDefinitionBinding")
<< QStringLiteral("missingRequiredPropertyOnObjectDefinitionBinding.qml")
<< Result{ { { uR"(Component is missing required property i from QtObject)"_s, 4, 26 } } };
QTest::newRow("missingSingletonPragma")
<< QStringLiteral("missingSingletonPragma.qml")
- << Result { { Message { QStringLiteral(
- "Type MissingPragma declared as singleton in qmldir but missing "
- "pragma Singleton") } } };
+ << Result{ { { "Type MissingPragma declared as singleton in qmldir but missing pragma "
+ "Singleton"_L1 } } };
QTest::newRow("missingSingletonQmldir")
<< QStringLiteral("missingSingletonQmldir.qml")
- << Result { { Message { QStringLiteral(
- "Type MissingQmldirSingleton not declared as singleton in qmldir but using "
- "pragma Singleton") } } };
+ << Result{ { { "Type MissingQmldirSingleton not declared as singleton in qmldir but "
+ "using pragma Singleton"_L1 } } };
QTest::addRow("multifix")
<< QStringLiteral("multifix.qml")
- << Result { {
- Message { QStringLiteral("Unqualified access"), 7, 19, QtWarningMsg},
- Message { QStringLiteral("Unqualified access"), 11, 19, QtWarningMsg},
- }, {}, {
- Message { QStringLiteral("pragma ComponentBehavior: Bound\n"), 1, 1 }
- }, { Result::AutoFixable }};
+ << Result{ { { "Unqualified access"_L1, 7, 19, QtWarningMsg },
+ { "Unqualified access"_L1, 11, 19, QtWarningMsg } },
+ {},
+ { { "pragma ComponentBehavior: Bound\n"_L1, 1, 1 } },
+ { Result::AutoFixable } };
QTest::newRow("multilineString")
<< QStringLiteral("multilineString.qml")
- << Result { { Message { QStringLiteral("String contains unescaped line terminator "
- "which is deprecated."),
- 0, 0, QtInfoMsg } },
+ << Result{ { { "String contains unescaped line terminator which is deprecated."_L1,
+ 0, 0, QtInfoMsg } },
{},
- { Message { "`Foo\nmultiline\\`\nstring`", 4, 32 },
- Message { "`another\\`\npart\nof it`", 6, 11 },
- Message { R"(`
+ { { "`Foo\nmultiline\\`\nstring`"_L1, 4, 32 },
+ { "`another\\`\npart\nof it`"_L1, 6, 11 },
+ { R"(`
quote: " \\" \\\\"
ticks: \` \` \\\` \\\`
singleTicks: ' \' \\' \\\'
-expression: \${expr} \${expr} \\\${expr} \\\${expr}`)",
- 10, 28 },
- Message {
- R"(`
+expression: \${expr} \${expr} \\\${expr} \\\${expr}`)"_L1, 10, 28 },
+ { R"(`
quote: " \" \\" \\\"
ticks: \` \` \\\` \\\`
singleTicks: ' \\' \\\\'
-expression: \${expr} \${expr} \\\${expr} \\\${expr}`)",
- 16, 27 } },
+expression: \${expr} \${expr} \\\${expr} \\\${expr}`)"_L1, 16, 27 } },
{ Result::ExitsNormally, Result::AutoFixable } };
// The warning should show up only once even though
// we have to run the type propagator multiple times.
QTest::newRow("multiplePasses")
<< testFile("multiplePasses.qml")
- << Result {{ Message { QStringLiteral("Unqualified access") }}};
- QTest::newRow("nanchors1") << QStringLiteral("nanchors1.qml")
- << Result{ { Message{ QStringLiteral(
- "unknown grouped property scope nanchors.") } },
- {},
- {} };
- QTest::newRow("nanchors2") << QStringLiteral("nanchors2.qml")
- << Result{ { Message{ QStringLiteral(
- "unknown grouped property scope nanchors.") } },
- {},
- {} };
- QTest::newRow("nanchors3") << QStringLiteral("nanchors3.qml")
- << Result{ { Message{ QStringLiteral(
- "unknown grouped property scope nanchors.") } },
- {},
- {} };
+ << Result{ { { "Unqualified access"_L1 } } };
+ QTest::newRow("nanchors1")
+ << QStringLiteral("nanchors1.qml")
+ << Result{ { { "unknown grouped property scope nanchors."_L1 } } };
+ QTest::newRow("nanchors2")
+ << QStringLiteral("nanchors2.qml")
+ << Result{ { { "unknown grouped property scope nanchors."_L1 } } };
+ QTest::newRow("nanchors3")
+ << QStringLiteral("nanchors3.qml")
+ << Result{ { { "unknown grouped property scope nanchors."_L1 } } };
QTest::newRow("nestedInlineComponents")
<< QStringLiteral("nestedInlineComponents.qml")
- << Result { { Message {
- QStringLiteral("Nested inline components are not supported") } } };
+ << Result{ { { "Nested inline components are not supported"_L1 } } };
QTest::newRow("nonNullStored")
<< QStringLiteral("nonNullStored.qml")
- << Result { { Message { QStringLiteral(
- "Member \"objectName\" not found on type \"Foozle\"") } },
- { Message { QStringLiteral("Unqualified access") } } };
+ << Result{ { { "Member \"objectName\" not found on type \"Foozle\""_L1 } },
+ { { "Unqualified access"_L1 } } };
QTest::newRow("notQmlRootMethods")
<< QStringLiteral("notQmlRootMethods.qml")
- << Result{ {
- Message{ u"Member \"deleteLater\" not found on type \"QtObject\""_s },
- Message{ u"Member \"destroyed\" not found on type \"QtObject\""_s },
- } };
- QTest::newRow("nullBinding") << QStringLiteral("nullBinding.qml")
- << Result{ { Message{ QStringLiteral(
- "Cannot assign literal of type null to double") } } };
+ << Result{ { { "Member \"deleteLater\" not found on type \"QtObject\""_L1 },
+ { "Member \"destroyed\" not found on type \"QtObject\""_L1 } } };
+ QTest::newRow("nullBinding")
+ << QStringLiteral("nullBinding.qml")
+ << Result{ { { "Cannot assign literal of type null to double"_L1 } } };
QTest::newRow("parentIsComponent")
<< QStringLiteral("parentIsComponent.qml")
- << Result { { Message {
- QStringLiteral("Member \"progress\" not found on type \"QQuickItem\""), 7,
- 39 } } };
+ << Result{ { { "Member \"progress\" not found on type \"QQuickItem\""_L1, 7, 39 } } };
QTest::newRow("redundantOptionalChainingEnums")
<< QStringLiteral("RedundantOptionalChainingEnums.qml")
<< Result{ { { "Redundant optional chaining for enum lookup"_L1, 5, 54 },
{ "Redundant optional chaining for enum lookup"_L1, 6, 26 } } };
QTest::newRow("segFault (bad)")
<< QStringLiteral("SegFault.bad.qml")
- << Result { { Message { QStringLiteral(
- "Member \"foobar\" not found on type \"QQuickScreenAttached\"") } } };
- QTest::newRow("shadowedMethod") << QStringLiteral("shadowedMethod.qml")
- << Result { { Message { QStringLiteral(
- "Method \"foo\" is shadowed by a property.") } } };
+ << Result{ { { "Member \"foobar\" not found on type \"QQuickScreenAttached\""_L1 } } };
+ QTest::newRow("shadowedMethod")
+ << QStringLiteral("shadowedMethod.qml")
+ << Result{ { { "Method \"foo\" is shadowed by a property."_L1 } } };
QTest::newRow("shadowedSignal")
<< QStringLiteral("shadowedSignal.qml")
- << Result { { Message {
- QStringLiteral("Signal \"pressed\" is shadowed by a property.") } } };
+ << Result{ { { "Signal \"pressed\" is shadowed by a property."_L1 } } };
QTest::newRow("shadowedSignalWithId")
<< QStringLiteral("shadowedSignalWithId.qml")
- << Result { { Message {
- QStringLiteral("Signal \"pressed\" is shadowed by a property") } } };
- QTest::newRow("shadowedSlot") << QStringLiteral("shadowedSlot.qml")
- << Result { { Message { QStringLiteral(
- "Slot \"move\" is shadowed by a property") } } };
+ << Result{ { { "Signal \"pressed\" is shadowed by a property"_L1 } } };
+ QTest::newRow("shadowedSlot")
+ << QStringLiteral("shadowedSlot.qml")
+ << Result{ { { "Slot \"move\" is shadowed by a property"_L1 } } };
{
const auto msgGen = [](const QString &name, quint32 line, quint32 col) {
return Message{ "Reading non-constant and non-notifiable property %1. Binding might "_L1
@@ -1259,53 +1090,38 @@ expression: \${expr} \${expr} \\\${expr} \\\${expr}`)",
msgGen("cppConstantNotifiable"_L1, 16, 24), msgGen("i"_L1, 17, 24),
msgGen("ro"_L1, 18, 24) } };
}
- QTest::newRow("string as id") << QStringLiteral("stringAsId.qml")
- << Result { { Message { QStringLiteral(
- "ids do not need quotation marks") } } };
+ QTest::newRow("string as id")
+ << QStringLiteral("stringAsId.qml")
+ << Result{ { { "ids do not need quotation marks"_L1 } } };
QTest::newRow("stringIdUsedInWarning")
<< QStringLiteral("stringIdUsedInWarning.qml")
- << Result { { Message {
- QStringLiteral("i is a member of a parent element"),
- } },
+ << Result{ { { "i is a member of a parent element"_L1, } },
{},
- { Message { QStringLiteral("stringy.") } } };
+ { { "stringy."_L1 } } };
QTest::newRow("unboundComponents")
<< QStringLiteral("unboundComponents.qml")
- << Result { {
- Message { QStringLiteral("Unqualified access"), 10, 25 },
- Message { QStringLiteral("Unqualified access"), 14, 33 }
- } };
+ << Result{ { { "Unqualified access"_L1, 10, 25 },
+ { "Unqualified access"_L1, 14, 33 } } };
QTest::newRow("unknownTypeCustomParser")
<< QStringLiteral("unknownTypeCustomParser.qml")
- << Result { { Message { QStringLiteral("TypeDoesNotExist was not found.") } } };
+ << Result{ { { "TypeDoesNotExist was not found."_L1 } } };
QTest::newRow("unresolvedArrayBinding")
<< QStringLiteral("unresolvedArrayBinding.qml")
- << Result{ { Message{ QStringLiteral(u"Declaring an object which is not an Qml object"
- " as a list member.") } },
- {},
- {} };
+ << Result{ { { "Declaring an object which is not an Qml object as a list member."_L1 } } };
QTest::newRow("unresolvedAttachedType")
<< QStringLiteral("unresolvedAttachedType.qml")
- << Result { { Message { QStringLiteral(
- "unknown attached property scope UnresolvedAttachedType.") } },
- { Message { QStringLiteral("Could not find property \"property\".") } } };
+ << Result{ { { "unknown attached property scope UnresolvedAttachedType."_L1 } },
+ { { "Could not find property \"property\"."_L1 } } };
QTest::newRow("unresolvedType")
<< QStringLiteral("unresolvedType.qml")
- << Result { { Message { QStringLiteral(
- "UnresolvedType was not found. "
- "Did you add all imports and dependencies?")
- } },
- { Message { QStringLiteral("incompatible type") } } };
+ << Result{ { { "UnresolvedType was not found. Did you add all imports and dependencies"_L1 } },
+ { { "incompatible type"_L1 } } };
// We want to see the warning about the missing type only once.
QTest::newRow("unresolvedType2")
<< QStringLiteral("unresolvedType2.qml")
- << Result { { Message { QStringLiteral(
- "QQC2.Label was not found. Did you add all imports and dependencies?") } },
- { Message { QStringLiteral(
- "'QQC2.Label' is used but it is not resolved") },
- Message { QStringLiteral(
- "Type QQC2.Label is used but it is not resolved") } },
- };
+ << Result{ { { "QQC2.Label was not found. Did you add all imports and dependencies?"_L1 } },
+ { { "'QQC2.Label' is used but it is not resolved"_L1 },
+ { "Type QQC2.Label is used but it is not resolved"_L1 } } };
QTest::newRow("unresolvedTypeAnnotation")
<< QStringLiteral("unresolvedTypeAnnotations.qml")
<< Result{{
@@ -1384,23 +1200,36 @@ void TestQmllint::dirtyQmlSnippet_data()
const CallQmllintOptions defaultOptions;
- QTest::newRow("color-hex") << u"property color myColor: \"#12345\""_s
- << Result{ { { "Invalid color"_L1, 1, 25 } } } << defaultOptions;
- QTest::newRow("color-hex2") << u"property color myColor: \"#123456789\""_s
- << Result{ { { "Invalid color"_L1, 1, 25 } } } << defaultOptions;
- QTest::newRow("color-hex3") << u"property color myColor: \"##123456\""_s
- << Result{ { { "Invalid color"_L1, 1, 25 } } } << defaultOptions;
- QTest::newRow("color-hex4") << u"property color myColor: \"#123456#\""_s
- << Result{ { { "Invalid color"_L1, 1, 25 } } } << defaultOptions;
- QTest::newRow("color-hex5") << u"property color myColor: \"#HELLOL\""_s
- << Result{ { { "Invalid color"_L1, 1, 25 } } } << defaultOptions;
- QTest::newRow("color-hex6") << u"property color myColor: \"#1234567\""_s
- << Result{ { { "Invalid color"_L1, 1, 25 } } } << defaultOptions;
- QTest::newRow("color-name") << u"property color myColor: \"lbue\""_s
- << Result{ { { "Invalid color \"lbue\""_L1, 1, 25 } },
- {},
- { { "Did you mean \"blue\"?", 1, 25 } } }
- << defaultOptions;
+ QTest::newRow("color-hex")
+ << u"property color myColor: \"#12345\""_s
+ << Result{ { { "Invalid color"_L1, 1, 25 } } }
+ << defaultOptions;
+ QTest::newRow("color-hex2")
+ << u"property color myColor: \"#123456789\""_s
+ << Result{ { { "Invalid color"_L1, 1, 25 } } }
+ << defaultOptions;
+ QTest::newRow("color-hex3")
+ << u"property color myColor: \"##123456\""_s
+ << Result{ { { "Invalid color"_L1, 1, 25 } } }
+ << defaultOptions;
+ QTest::newRow("color-hex4")
+ << u"property color myColor: \"#123456#\""_s
+ << Result{ { { "Invalid color"_L1, 1, 25 } } }
+ << defaultOptions;
+ QTest::newRow("color-hex5")
+ << u"property color myColor: \"#HELLOL\""_s
+ << Result{ { { "Invalid color"_L1, 1, 25 } } }
+ << defaultOptions;
+ QTest::newRow("color-hex6")
+ << u"property color myColor: \"#1234567\""_s
+ << Result{ { { "Invalid color"_L1, 1, 25 } } }
+ << defaultOptions;
+ QTest::newRow("color-name")
+ << u"property color myColor: \"lbue\""_s
+ << Result{ { { "Invalid color \"lbue\""_L1, 1, 25 } },
+ {},
+ { { "Did you mean \"blue\"?", 1, 25 } } }
+ << defaultOptions;
QTest::newRow("duplicateBinding")
<< u"property int i; i: 42; i: 43;"_s
<< Result{ { { "Duplicate binding on property 'i'"_L1, 1, 27 },
@@ -1436,11 +1265,12 @@ void TestQmllint::dirtyQmlSnippet_data()
<< Result{ { { "Duplicate binding on property 'i'"_L1, 1, 26 },
{ "Note: previous binding on 'i' here"_L1, 1, 15 } } }
<< defaultOptions;
- QTest::newRow("enum") << u"enum Hello { World, Kitty, World, dlrow }"_s
- << Result{ { { "Enum key 'World' has already been declared"_L1, 1, 28 },
- { "Note: previous declaration of 'World' here"_L1, 1, 14 },
- { "Enum keys should start with an uppercase"_L1, 1, 35 } } }
- << defaultOptions;
+ QTest::newRow("enum")
+ << u"enum Hello { World, Kitty, World, dlrow }"_s
+ << Result{ { { "Enum key 'World' has already been declared"_L1, 1, 28 },
+ { "Note: previous declaration of 'World' here"_L1, 1, 14 },
+ { "Enum keys should start with an uppercase"_L1, 1, 35 } } }
+ << defaultOptions;
QTest::newRow("requiredInInlineComponent")
<< u"Item { component Foo: Item { required property var bla; } } Foo {}"_s
<< Result{ { { "Component is missing required property bla from Foo"_L1, 1, 61 } } }
@@ -1454,7 +1284,8 @@ void TestQmllint::dirtyQmlSnippet_data()
<< defaultOptions;
QTest::newRow("testSnippet")
<< u"property int qwer: \"Hello\""_s
- << Result{ { { "Cannot assign literal of type string to int"_L1 } } } << defaultOptions;
+ << Result{ { { "Cannot assign literal of type string to int"_L1 } } }
+ << defaultOptions;
QTest::newRow("upperCaseId")
<< u"id: Root"_s
<< Result{ { { "Id must start with a lower case letter or an '_'"_L1, 1, 5 } } }
@@ -1535,16 +1366,20 @@ void TestQmllint::dirtyJsSnippet_data()
<< Result{ { { "Unqualified access"_L1, 1, 13 } } }
<< defaultOptions;
QTest::newRow("codeAfterBreak")
- << u"for (;;) { break; return 1;}"_s << Result{ { { "Unreachable code"_L1, 1, 19 } } }
+ << u"for (;;) { break; return 1;}"_s
+ << Result{ { { "Unreachable code"_L1, 1, 19 } } }
<< defaultOptions;
QTest::newRow("codeAfterContinue")
<< u"for (;;) { continue; return 1;}"_s
- << Result{ { { "Unreachable code"_L1, 1, 22 } } } << defaultOptions;
+ << Result{ { { "Unreachable code"_L1, 1, 22 } } }
+ << defaultOptions;
QTest::newRow("codeAfterReturn")
- << u"return 1; return 2;"_s << Result{ { { "Unreachable code"_L1, 1, 11 } } }
+ << u"return 1; return 2;"_s
+ << Result{ { { "Unreachable code"_L1, 1, 11 } } }
<< defaultOptions;
QTest::newRow("codeAfterThrow")
- << u"for (;;) { throw 1; return 1;}"_s << Result{ { { "Unreachable code"_L1, 1, 21 } } }
+ << u"for (;;) { throw 1; return 1;}"_s
+ << Result{ { { "Unreachable code"_L1, 1, 21 } } }
<< defaultOptions;
QTest::newRow("doubleConst")
<< u"const x = 4; const x = 4;"_s
@@ -1556,41 +1391,39 @@ void TestQmllint::dirtyJsSnippet_data()
<< Result{ { { "Identifier 'x' has already been declared"_L1, 1, 16 },
{ "Note: previous declaration of 'x' here"_L1, 1, 5 } } }
<< defaultOptions;
- QTest::newRow("eval") << u"let x = eval();"_s << Result{ { { "Do not use 'eval'"_L1, 1, 9 } } }
- << defaultOptions;
- QTest::newRow("eval2") << u"let x = eval(\"1 + 1\");"_s
- << Result{ { { "Do not use 'eval'"_L1, 1, 9 } } } << defaultOptions;
+ QTest::newRow("eval")
+ << u"let x = eval();"_s
+ << Result{ { { "Do not use 'eval'"_L1, 1, 9 } } }
+ << defaultOptions;
+ QTest::newRow("eval2")
+ << u"let x = eval(\"1 + 1\");"_s
+ << Result{ { { "Do not use 'eval'"_L1, 1, 9 } } }
+ << defaultOptions;
QTest::newRow("functionAfterThrow")
<< u"throw 1; function f() {}; let x = 1; function g() {}; let y = 1;"_s
- << Result{ {
- { "Unreachable code"_L1, 1, 27 },
- { "Unreachable code"_L1, 1, 55 },
- } }
+ << Result{ { { "Unreachable code"_L1, 1, 27 },
+ { "Unreachable code"_L1, 1, 55 } } }
<< defaultOptions;
QTest::newRow("functionAfterThrow2")
<< u"throw 1; if (x) { function f() {}; } let x = 1; if (x) { function g() {};} let y = 1;"_s
- << Result{ {
- { "Unreachable code"_L1, 1, 38 },
- { "Unreachable code"_L1, 1, 76 },
- } }
+ << Result{ { { "Unreachable code"_L1, 1, 38 },
+ { "Unreachable code"_L1, 1, 76 } } }
<< defaultOptions;
{
CallQmllintOptions options;
options.enableCategories.append("function-used-before-declaration"_L1);
QTest::newRow("functionUsedBeforeDeclaration")
<< u"fff(); function fff() {}"_s
- << Result{ {
- { "Function 'fff' is used here before its declaration"_L1, 1, 1 },
- { "Note: declaration of 'fff' here"_L1, 1, 17 },
- },
- }
+ << Result{ { { "Function 'fff' is used here before its declaration"_L1, 1, 1 },
+ { "Note: declaration of 'fff' here"_L1, 1, 17 } } }
<< options;
}
QTest::newRow("indirectEval") << u"let x = (1, eval)();"_s
<< Result{ { { "Do not use 'eval'"_L1, 1, 13 } } }
<< defaultOptions;
QTest::newRow("indirectEval2")
- << u"let x = (1, eval)(\"1 + 1\");"_s << Result{ { { "Do not use 'eval'"_L1, 1, 13 } } }
+ << u"let x = (1, eval)(\"1 + 1\");"_s
+ << Result{ { { "Do not use 'eval'"_L1, 1, 13 } } }
<< defaultOptions;
QTest::newRow("redundantOptionalChainingNonVoidableBase")
<< u"/a/?.flags"_s