diff options
Diffstat (limited to 'tests/auto/qml/qmllint')
5 files changed, 23 insertions, 6 deletions
diff --git a/tests/auto/qml/qmllint/data/Qtbug111015/qtbug111015.qmltypes b/tests/auto/qml/qmllint/data/Qtbug111015/qtbug111015.qmltypes index cad6d88cc3..7de521a379 100644 --- a/tests/auto/qml/qmllint/data/Qtbug111015/qtbug111015.qmltypes +++ b/tests/auto/qml/qmllint/data/Qtbug111015/qtbug111015.qmltypes @@ -9,4 +9,12 @@ Module { prototype: "QObject" Property { name: "jsonObjectList"; type: "QJsonObject"; isList: true; read: "getJsonObjectList"; index: 0; isReadonly: true } } + Component { + file: "typewithjsonarray.h" + name: "TypeWithJsonArray" + exports: ["QmlLintTestLib/TypeWithJsonArray 1.0"] + accessSemantics: "reference" + prototype: "QObject" + Property { name: "jsonArray"; type: "QJsonArray"; read: "getJsonArray"; index: 0; isReadonly: true } + } } diff --git a/tests/auto/qml/qmllint/data/Things/plugins.qmltypes b/tests/auto/qml/qmllint/data/Things/plugins.qmltypes index 47ae34cc00..3b0da602ac 100644 --- a/tests/auto/qml/qmllint/data/Things/plugins.qmltypes +++ b/tests/auto/qml/qmllint/data/Things/plugins.qmltypes @@ -112,6 +112,6 @@ Module { prototype: "QObject" exports: ["Things/ConstInvokable 1.0"] exportMetaObjectRevisions: [256] - Method { name: "getObject"; type: "QObject"; isPointer: true; isConstant: true } + Method { name: "getObject"; type: "QObject"; isPointer: true; isTypeConstant: true } } } diff --git a/tests/auto/qml/qmllint/data/jsonArrayIsRecognized.qml b/tests/auto/qml/qmllint/data/jsonArrayIsRecognized.qml new file mode 100644 index 0000000000..89c52e0e52 --- /dev/null +++ b/tests/auto/qml/qmllint/data/jsonArrayIsRecognized.qml @@ -0,0 +1,8 @@ +import QtQuick +import Qtbug111015 1.0 + +Item { + TypeWithJsonArray { + jsonArray: [] + } +} diff --git a/tests/auto/qml/qmllint/lintplugin.cpp b/tests/auto/qml/qmllint/lintplugin.cpp index 65795c103c..58b174cb6b 100644 --- a/tests/auto/qml/qmllint/lintplugin.cpp +++ b/tests/auto/qml/qmllint/lintplugin.cpp @@ -23,7 +23,7 @@ public: void run(const QQmlSA::Element &element) override { auto property = element.property(u"radius"_s); - if (!property.isValid() || element.property(u"radius"_s).typeName() != u"qreal") { + if (!property.isValid() || element.property(u"radius"_s).typeName() != u"double") { emitWarning(u"Failed to verify radius property", plugin, element.sourceLocation()); return; } diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index bcccd5f1f0..02b0ea69d2 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -1028,7 +1028,7 @@ expression: \${expr} \${expr} \\\${expr} \\\${expr}`)", { Message { QStringLiteral("Ready") } } } }; QTest::newRow("nullBinding") << QStringLiteral("nullBinding.qml") << Result{ { Message{ QStringLiteral( - "Cannot assign literal of type null to qreal") } } }; + "Cannot assign literal of type null to double") } } }; QTest::newRow("missingRequiredAlias") << QStringLiteral("missingRequiredAlias.qml") << Result { { Message { @@ -1348,6 +1348,7 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("constInvokable") << QStringLiteral("useConstInvokable.qml"); QTest::newRow("dontCheckJSTypes") << QStringLiteral("dontCheckJSTypes.qml"); QTest::newRow("jsonObjectIsRecognized") << QStringLiteral("jsonObjectIsRecognized.qml"); + QTest::newRow("jsonArrayIsRecognized") << QStringLiteral("jsonArrayIsRecognized.qml"); } void TestQmllint::cleanQmlCode() @@ -1802,7 +1803,7 @@ void TestQmllint::settingsFile() .arg(testFile("settings/unusedImportWarning/unused.qml")))); QVERIFY(runQmllint("settings/bare/bare.qml", false, {}, false, false) .contains(QStringLiteral("Failed to find the following builtins: " - "builtins.qmltypes, jsroot.qmltypes"))); + "jsroot.qmltypes, builtins.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()); @@ -1910,7 +1911,7 @@ void TestQmllint::missingBuiltinsNoCrash() checkResult(warnings, Result { { Message { QStringLiteral("Failed to find the following builtins: " - "builtins.qmltypes, jsroot.qmltypes") } } }); + "jsroot.qmltypes, builtins.qmltypes") } } }); } void TestQmllint::absolutePath() @@ -2123,7 +2124,7 @@ void TestQmllint::quickPlugin() Message { u"SplitView attached property only works with Items"_s }, Message { u"ScrollIndicator must be attached to a Flickable"_s }, Message { u"ScrollBar must be attached to a Flickable or ScrollView"_s }, - Message { u"Accessible must be attached to an Item"_s }, + Message { u"Accessible must be attached to an Item or an Action"_s }, Message { u"EnterKey attached property only works with Items"_s }, Message { u"LayoutDirection attached property only works with Items and Windows"_s }, |