diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-09-09 16:23:30 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-09-15 18:22:10 +0200 |
commit | 38fb82bfef8f5a599ee374958a20b9d271002c88 (patch) | |
tree | 9038b1be13017be3276bda52b0f4c9911690c22c /tests/auto/declarative_location_core/tst_place.qml | |
parent | 6af3cc27235a67420d32dbe0146d94ada6b25028 (diff) | |
download | qtlocation-38fb82bfef8f5a599ee374958a20b9d271002c88.tar.gz |
Register QPlaceSupplier as a QML value type
Make QPlaceSupplier a gadget, and register it as a value type with the
QML engine. Remove declarative wrapper, and consolidate the
documentation.
Adjust the tests and remove tests that verify that the type behaves like
an object. Initialize placeSupplier properties as a grouped property, or
via a converter from QJSValue.
Change-Id: Id35ac1d9f03ce831013e4a7231302abd7b6cd7c8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/declarative_location_core/tst_place.qml')
-rw-r--r-- | tests/auto/declarative_location_core/tst_place.qml | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/tests/auto/declarative_location_core/tst_place.qml b/tests/auto/declarative_location_core/tst_place.qml index ef0baa93..916b036e 100644 --- a/tests/auto/declarative_location_core/tst_place.qml +++ b/tests/auto/declarative_location_core/tst_place.qml @@ -84,13 +84,12 @@ TestCase { ratings: ({ average: 3.5, count: 10 }) - supplier: Supplier { - name: "Supplier 1" - supplierId: "supplier-id-1" - url: "http://www.example.com/supplier-id-1/" - icon: ({ parameters: { singleUrl: "http://www.example.com/supplier-id-1/icon" }}) - } - + supplier: ({ + name: "Supplier 1", + supplierId: "supplier-id-1", + url: "http://www.example.com/supplier-id-1/", + icon: ({ parameters : { singleUrl: "http://www.example.com/supplier-id-1/icon" }}) + }) categories: [ Category { name: "Category 1" @@ -136,22 +135,8 @@ TestCase { } // check supplier - if (place1.supplier === null && place2.supplier !== null) - return false; - if (place1.supplier !== null && place2.supplier === null) + if (place1.supplier !== place2.supplier) { return false; - if (place1.supplier !== null && place2.supplier !== null) { - if (place1.supplier.supplierId !== place2.supplier.supplierId) - return false; - if (place1.supplier.name !== place2.supplier.name) - return false; - if (place1.supplier.url !== place2.supplier.url) - return false; - - // check supplier icon - if (place1.supplier.icon !== place2.supplier.icon) { - return false; - } } // check ratings @@ -289,7 +274,7 @@ TestCase { } function test_supplier() { - var supplier = Qt.createQmlObject('import QtLocation 5.3; Supplier { supplierId: "sup-id-1"; name: "Category 1" }', testCase, "Supplier1"); + var supplier = savePlace.supplier; var signalSpy = Qt.createQmlObject('import QtTest 1.0; SignalSpy {}', testCase, "SignalSpy"); signalSpy.target = testPlace; @@ -314,8 +299,8 @@ TestCase { compare(signalSpy.count, 1); // reset by assignment - testPlace.supplier = null; - compare(testPlace.supplier, null); + testPlace.supplier = emptyPlace.supplier; + compare(testPlace.supplier, emptyPlace.supplier); compare(signalSpy.count, 2); signalSpy.destroy(); |