diff options
author | Luca Di Sera <luca.disera@qt.io> | 2024-04-30 13:44:20 +0200 |
---|---|---|
committer | Luca Di Sera <luca.disera@qt.io> | 2024-05-08 11:15:08 +0200 |
commit | d73409cd3e9c0ac770d76494250dcf065910384d (patch) | |
tree | d82e825954e3fe57286f1a29692bd7601999d613 /tests | |
parent | 92f6d22db96a28e5dfc8a8a9e510ce8aada8c2f5 (diff) |
QtQml: Add a wrapper builtin for QJsonObject
Calling `qmllint` can produce warning for usages of the `QJsonObject`
type, due to it not being found.
Make `QJsonObject` a builtin type so that calls to `qmllint` will import
and recognize the type.
Add a test-case to ensure that the type is now recognized.
Task-number: QTBUG-111015
Change-Id: I09afa006036059b826f6d76adb76fe802ba18f70
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests')
4 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/Qtbug111015/qmldir b/tests/auto/qml/qmllint/data/Qtbug111015/qmldir new file mode 100644 index 0000000000..3bf1d48e13 --- /dev/null +++ b/tests/auto/qml/qmllint/data/Qtbug111015/qmldir @@ -0,0 +1,3 @@ +module Qtbug111015 +typeinfo qtbug111015.qmltypes +import QtQml diff --git a/tests/auto/qml/qmllint/data/Qtbug111015/qtbug111015.qmltypes b/tests/auto/qml/qmllint/data/Qtbug111015/qtbug111015.qmltypes new file mode 100644 index 0000000000..cad6d88cc3 --- /dev/null +++ b/tests/auto/qml/qmllint/data/Qtbug111015/qtbug111015.qmltypes @@ -0,0 +1,12 @@ +import QtQuick.tooling 1.2 + +Module { + Component { + file: "typewithjsonobjectlist.h" + name: "TypeWithJsonObjectList" + exports: ["QmlLintTestLib/TypeWithJsonObjectList 1.0"] + accessSemantics: "reference" + prototype: "QObject" + Property { name: "jsonObjectList"; type: "QJsonObject"; isList: true; read: "getJsonObjectList"; index: 0; isReadonly: true } + } +} diff --git a/tests/auto/qml/qmllint/data/jsonObjectIsRecognized.qml b/tests/auto/qml/qmllint/data/jsonObjectIsRecognized.qml new file mode 100644 index 0000000000..0a96fa9f92 --- /dev/null +++ b/tests/auto/qml/qmllint/data/jsonObjectIsRecognized.qml @@ -0,0 +1,8 @@ +import QtQuick +import Qtbug111015 1.0 + +Item { + TypeWithJsonObjectList { + jsonObjectList: [] + } +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 57cb7228d8..a9b5f8d732 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -1345,6 +1345,7 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("locale") << QStringLiteral("locale.qml"); QTest::newRow("constInvokable") << QStringLiteral("useConstInvokable.qml"); QTest::newRow("dontCheckJSTypes") << QStringLiteral("dontCheckJSTypes.qml"); + QTest::newRow("jsonObjectIsRecognized") << QStringLiteral("jsonObjectIsRecognized.qml"); } void TestQmllint::cleanQmlCode() |