diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-09-09 13:38:48 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-09-14 13:20:08 +0200 |
commit | 1d8897b32148057246a779ad7cf18aeed1c2acc3 (patch) | |
tree | 6d5b7d1a1e1a5209683564338e7e5b969b989dc5 /tests | |
parent | e96f4fc0957d936385a086cf9b0882b62bcebad3 (diff) | |
download | qtlocation-1d8897b32148057246a779ad7cf18aeed1c2acc3.tar.gz |
Register QPlaceAttribute as a value type
Make QPlaceAttribute a gadget, and register it as a value type with the
QML engine. Remove declarative wrapper, and consolidate the
documentation. Keep documentation for the ExtendedAttributes QML type
together with the placeAttribute QML value type for now.
Adjust the tests and remove tests that verify that the type behaves like
an object. Initialize placeAttribute properties as a grouped property.
Task-number: QTBUG-106482
Change-Id: Ia514ba4b2ae7f7af56dc0bcee19dca6dddbfd9cf
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative_location_core/tst_place.qml | 7 | ||||
-rw-r--r-- | tests/auto/declarative_location_core/tst_placeattribute.qml | 22 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestPlaceAttribute.qml | 10 |
3 files changed, 25 insertions, 14 deletions
diff --git a/tests/auto/declarative_location_core/tst_place.qml b/tests/auto/declarative_location_core/tst_place.qml index 8f60f8c0..871f10c1 100644 --- a/tests/auto/declarative_location_core/tst_place.qml +++ b/tests/auto/declarative_location_core/tst_place.qml @@ -416,10 +416,15 @@ TestCase { signalSpy.destroy(); } + property placeAttribute fooAttribute + fooAttribute { + label: "Foo label" + text: "Foo" + } function test_extendedAttributes() { verify(testPlace.extendedAttributes); - testPlace.extendedAttributes["foo"] = Qt.createQmlObject('import QtLocation 5.3; PlaceAttribute { text: "Foo"; label: "Foo label" }', testCase, 'PlaceAttribute'); + testPlace.extendedAttributes["foo"] = fooAttribute; verify(testPlace.extendedAttributes.foo); compare(testPlace.extendedAttributes.foo.text, "Foo"); diff --git a/tests/auto/declarative_location_core/tst_placeattribute.qml b/tests/auto/declarative_location_core/tst_placeattribute.qml index 66180524..7308023c 100644 --- a/tests/auto/declarative_location_core/tst_placeattribute.qml +++ b/tests/auto/declarative_location_core/tst_placeattribute.qml @@ -29,25 +29,27 @@ import QtQuick import QtTest import QtLocation -import "utils.js" as Utils TestCase { id: testCase name: "PlaceAttribute" - PlaceAttribute { - id: testAttribute + property placeAttribute testAttribute + + function test_default() { + compare(testAttribute.label, "") + compare(testAttribute.text, "") } - function test_setAndGet_data() { - return [ - { tag: "label", property: "label", signal: "labelChanged", value: "Test Label", reset: "" }, - { tag: "text", property: "text", signal: "textChanged", value: "Test Text", reset: "" }, - ]; + property placeAttribute qmlAttribute + qmlAttribute { + label: "Label" + text: "Text" } - function test_setAndGet(data) { - Utils.testObjectProperties(testCase, testAttribute, data); + function test_initialized() { + compare(qmlAttribute.label, "Label") + compare(qmlAttribute.text, "Text") } } diff --git a/tests/auto/qmlinterface/data/TestPlaceAttribute.qml b/tests/auto/qmlinterface/data/TestPlaceAttribute.qml index 6a2cef20..cab47537 100644 --- a/tests/auto/qmlinterface/data/TestPlaceAttribute.qml +++ b/tests/auto/qmlinterface/data/TestPlaceAttribute.qml @@ -27,8 +27,12 @@ ****************************************************************************/ import QtLocation +import QtQuick -PlaceAttribute { - label: "Test Attribute" - text: "Test attribute text" +Item { + property placeAttribute attribute + attribute { + label: "Test Attribute" + text: "Test attribute text" + } } |