diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-10-08 14:42:22 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-11-02 10:06:01 +0200 |
commit | 4cb1cbe5e0b8fab5a8145a00d6d79205148d8971 (patch) | |
tree | bf417bf03f8e2127436560f39d4bf3f8543c9fef /tests | |
parent | c032c91ee9776568d5593a3619ce0ac355e3135e (diff) | |
download | qtlocation-4cb1cbe5e0b8fab5a8145a00d6d79205148d8971.tar.gz |
Remove parameterization functionality
The abstraction of plugin-specific parameters makes little sense if
we don't want to provide a cross-backend API. So remove this for
now.
If in the future we want to attach meta-data or backend-specific
properties to values or element types, then we might be able to use
existing QVariantMap type properties (like QGeoRouteRequest's
extraParameters, via QDeclarativeGeoRouteQuery::extraParameters),
or register backend specific QML types that applications can opt in
to use.
This requires a bit of research and experimenting based on specific
use cases. If we can't come up with anything better, then bringing
back a, perhaps simplified, version of the infrastructure removed
here will still be an option.
Change-Id: If590a35f2ffb80b0c918d866e88913a9caf75d2b
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative_location_core/tst_routing.qml | 86 | ||||
-rw-r--r-- | tests/auto/declarative_ui/tst_map.qml | 54 | ||||
-rw-r--r-- | tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h | 9 | ||||
-rw-r--r-- | tests/auto/geotestplugin/qgeotiledmap_test.cpp | 34 | ||||
-rw-r--r-- | tests/auto/geotestplugin/qgeotiledmap_test.h | 3 |
5 files changed, 17 insertions, 169 deletions
diff --git a/tests/auto/declarative_location_core/tst_routing.qml b/tests/auto/declarative_location_core/tst_routing.qml index faf68328..6b1778f8 100644 --- a/tests/auto/declarative_location_core/tst_routing.qml +++ b/tests/auto/declarative_location_core/tst_routing.qml @@ -572,12 +572,6 @@ Item { id: waypoint2 coordinate: QtPositioning.coordinate(71, 71) bearing: 43 - - DynamicMapParameter { - id: param1 - type: "user_distance" - property real distance: 10 - } } RouteQuery {id: routeQuery} @@ -852,95 +846,50 @@ Item { tryCompare (spy, "count", 4) compare(model.get(0).path[0].latitude, fcoordinate1.latitude + 1) // new value should be echoed - // Extra parameter - var param = Qt.createQmlObject ('import QtLocation 5.9; DynamicMapParameter { type : "test-traveltime"; property var requestedTime : 42}', root) - var initialParams = cloneArray(filledRouteQuery.quickChildren) - var modifiedParams = cloneArray(initialParams) - modifiedParams.push(param) - - filledRouteQuery.quickChildren = modifiedParams - tryCompare (spy, "count", 5) - if (label === "routeModelAutomaticAltImpl") - compare(model.get(0).travelTime, 123456) - else - compare(model.get(0).travelTime, 42) - param.requestedTime = 43 - tryCompare (spy, "count", 6) - if (label === "routeModelAutomaticAltImpl") - compare(model.get(0).travelTime, 123456) - else - compare(model.get(0).travelTime, 43) - filledRouteQuery.quickChildren = initialParams - tryCompare (spy, "count", 7) - if (label === "routeModelAutomaticAltImpl") - compare(model.get(0).travelTime, 123456) - else - compare(model.get(0).travelTime, 0) - var secondParam = Qt.createQmlObject ('import QtLocation 5.9; DynamicMapParameter { type : "foo"; property var bar : 42}', root) - modifiedParams.push(secondParam) - param.requestedTime = 44 - filledRouteQuery.quickChildren = modifiedParams - tryCompare (spy, "count", 8) - if (label === "routeModelAutomaticAltImpl") - compare(model.get(0).travelTime, 123456) - else - compare(model.get(0).travelTime, 44) - filledRouteQuery.quickChildren = initialParams - tryCompare (spy, "count", 9) - if (label === "routeModelAutomaticAltImpl") - compare(model.get(0).travelTime, 123456) - else - compare(model.get(0).travelTime, 0) - /* Test waypoints */ // Verify that bearing is NaN for coordinates verify(isNaN(filledRouteQuery.waypointObjects()[0].bearing)) var numWaypoints = filledRouteQuery.waypoints.length // Add a waypoint with bearing filledRouteQuery.addWaypoint(waypoint1) - tryCompare (spy, "count", 10) + tryCompare (spy, "count", 5) compare(filledRouteQuery.waypointObjects()[numWaypoints].bearing, 42) // testing Waypoint to coordinate conversion compare(filledRouteQuery.waypoints[numWaypoints], filledRouteQuery.waypointObjects()[numWaypoints].coordinate) waypoint1.latitude += 0.1 compare(model.get(0).distance, 0) - tryCompare (spy, "count", 11) + tryCompare (spy, "count", 6) numWaypoints++; - filledRouteQuery.addWaypoint(waypoint2) // waypoint2 contains a MapParameter with user_distance + filledRouteQuery.addWaypoint(waypoint2) numWaypoints++; - tryCompare (spy, "count", 12) + tryCompare (spy, "count", 7) compare(filledRouteQuery.waypointObjects()[numWaypoints-1].bearing, 43) - compare(model.get(0).distance, 10) + compare(model.get(0).distance, 0) waypoint1.latitude += 0.1 - tryCompare (spy, "count", 13) + tryCompare (spy, "count", 8) waypoint2.latitude += 0.1 - tryCompare (spy, "count", 14) + tryCompare (spy, "count", 9) filledRouteQuery.removeWaypoint(waypoint1) - tryCompare (spy, "count", 15) + tryCompare (spy, "count", 10) waypoint2.latitude += 0.1 - tryCompare (spy, "count", 16) + tryCompare (spy, "count", 11) waypoint1.latitude += 0.1 - tryCompare (spy, "count", 16) // No effect, now disconnected + tryCompare (spy, "count", 11) // No effect, now disconnected // test with other props waypoint2.longitude += 0.1 - tryCompare (spy, "count", 17) + tryCompare (spy, "count", 12) waypoint2.altitude = 42 - tryCompare (spy, "count", 18) + tryCompare (spy, "count", 13) waypoint2.bearing += 1 - tryCompare (spy, "count", 19) + tryCompare (spy, "count", 14) compare(waypoint2.longitude, 71.1) compare(waypoint2.altitude, 42) compare(waypoint2.bearing, 44) - // test with map parameters - param1.distance = 42 - tryCompare (spy, "count", 20) - compare(model.get(0).distance, 42) - // Change query model.query = filledRouteQuery2 filledRouteQuery2.numberAlternativeRoutes = 3 - tryCompare (spy, "count", 21) + tryCompare (spy, "count", 15) compare (model.get(0).path.length, 3) // Verify that the old query is disconnected internally ie. does not trigger update @@ -952,7 +901,7 @@ Item { { latitude: 67, longitude: 68 } ]; wait(800) // wait to hope no further updates comes through - compare (spy.count, 21) + compare (spy.count, 15) compare(model.get(0).path.length, 3); // departure time @@ -961,11 +910,11 @@ Item { var validDate = new Date("2011-02-07T11:05:00"); filledRouteQuery2.departureTime = validDate - tryCompare(spy, "count", 22) + tryCompare(spy, "count", 16) compare(model.get(0).extendedAttributes["tst_departureTime"], validDate) filledRouteQuery2.departureTime = invalidDate - tryCompare (spy, "count", 23) + tryCompare (spy, "count", 17) verify(!model.get(0).extendedAttributes["tst_departureTime"]) // ReSetting @@ -978,7 +927,6 @@ Item { waypoint2.bearing = 42 waypoint2.coordinate = QtPositioning.coordinate(71, 71) waypoint2.bearing = 43 - param1.distance = 10 } diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml index 290b8f25..71a19ac3 100644 --- a/tests/auto/declarative_ui/tst_map.qml +++ b/tests/auto/declarative_ui/tst_map.qml @@ -131,12 +131,6 @@ Item { height: 200 } - DynamicMapParameter { - id: testParameter - type: "cameraCenter_test" - property var center: QtPositioning.coordinate(-33.0, -47.0) - } - Map { id: mapVisibleArea width: 256; height: 256; @@ -231,54 +225,6 @@ Item { verify(mapVisibleRegion.visibleRegion.contains(coordinateVisible3)) } - function test_map_parameters() - { - // coordinate is set at map element declaration - var center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) - fuzzyCompare(center.latitude, 10, 0.1) - fuzzyCompare(center.longitude, 11, 0.1) - - compare(mapPar.mapParameters.length, 0) - - mapPar.addMapParameter(testParameter) - - compare(mapPar.mapParameters.length, 1) - - // Using toCoordinate, below, to verify the actual value of the center, and not what is in the map.center property - center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) - fuzzyCompare(center.latitude, -33, 0.1) - fuzzyCompare(center.longitude, -47, 0.1) - - mapPar.addMapParameter(testParameter) - compare(mapPar.mapParameters.length, 1) - - mapPar.removeMapParameter(testParameter) - compare(mapPar.mapParameters.length, 0) - - center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) - fuzzyCompare(center.latitude, -33, 0.1) - fuzzyCompare(center.longitude, -47, 0.1) - - testParameter.center = mapPar.center // map.center has been affected as the Declarative Map has received the QGeoMap::cameraDataChanged signal - mapPar.addMapParameter(testParameter) - compare(mapPar.mapParameters.length, 1) - - center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) - fuzzyCompare(center.latitude, -33, 0.1) - fuzzyCompare(center.longitude, -47, 0.1) - - testParameter.center = QtPositioning.coordinate(-30.0, -40.0) - - center = mapPar.toCoordinate(Qt.point((mapPar.width - 1) / 2.0, (mapPar.height - 1) / 2.0)) - fuzzyCompare(center.latitude, -30, 0.1) - fuzzyCompare(center.longitude, -40, 0.1) - fuzzyCompare(mapPar.center.latitude, -30, 0.1) - fuzzyCompare(mapPar.center.longitude, -40, 0.1) - - mapPar.removeMapParameter(testParameter) - compare(mapPar.mapParameters.length, 0) - } - function test_map_clamp() { //valid diff --git a/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h b/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h index a889c393..59cd8585 100644 --- a/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h +++ b/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h @@ -151,15 +151,6 @@ public: if (alternateGeoRouteImplementation_) route.setTravelTime(123456); - const QList<QVariantMap> metadata = request.waypointsMetadata(); - for (const auto &meta: metadata) { - if (meta.contains("extra")) { - QVariantMap extra = meta.value("extra").toMap(); - if (extra.contains("user_distance")) - route.setDistance(meta.value("extra").toMap().value("user_distance").toMap().value("distance").toDouble()); - } - } - if (request.departureTime().isValid()) { QVariantMap extendedAttributes = route.extendedAttributes(); extendedAttributes["tst_departureTime"] = request.departureTime(); diff --git a/tests/auto/geotestplugin/qgeotiledmap_test.cpp b/tests/auto/geotestplugin/qgeotiledmap_test.cpp index b4986b08..ea96035d 100644 --- a/tests/auto/geotestplugin/qgeotiledmap_test.cpp +++ b/tests/auto/geotestplugin/qgeotiledmap_test.cpp @@ -30,7 +30,6 @@ #include <QtCore/QMetaProperty> #include <QtPositioning/QGeoCoordinate> #include <QtLocation/private/qgeotiledmap_p_p.h> -#include <QtLocation/private/qgeomapparameter_p.h> QT_USE_NAMESPACE @@ -50,28 +49,6 @@ public: } - void addParameter(QGeoMapParameter *param) override - { - Q_Q(QGeoTiledMapTest); - if (param->type() == QStringLiteral("cameraCenter_test")) { - // We assume that cameraCenter_test parameters have a QGeoCoordinate property named "center" - // Handle the parameter - QGeoCameraData cameraData = m_cameraData; - QGeoCoordinate newCenter = param->property("center").value<QGeoCoordinate>(); - cameraData.setCenter(newCenter); - q->setCameraData(cameraData); - // Connect for further changes handling - q->connect(param, &QGeoMapParameter::propertyUpdated, - q, &QGeoTiledMapTest::onCameraCenter_testChanged); - - } - } - void removeParameter(QGeoMapParameter *param) override - { - Q_Q(QGeoTiledMapTest); - param->disconnect(q); - } - void setVisibleArea(const QRectF &visibleArea) override { if (m_options.supportVisibleArea) @@ -97,14 +74,3 @@ QGeoTiledMapTest::QGeoTiledMapTest(QGeoTiledMappingManagerEngine *engine, : QGeoTiledMap(*new QGeoTiledMapTestPrivate(engine, options), engine, parent), m_engine(engine) { } - -void QGeoTiledMapTest::onCameraCenter_testChanged(QGeoMapParameter *param, const QMetaProperty &property) -{ - if (strcmp(property.name(), "center") == 0) { - QGeoCameraData cameraData = this->cameraData(); - // Not testing for propertyName as this param has only one allowed property - QGeoCoordinate newCenter = property.read(param).value<QGeoCoordinate>(); - cameraData.setCenter(newCenter); - setCameraData(cameraData); - } -} diff --git a/tests/auto/geotestplugin/qgeotiledmap_test.h b/tests/auto/geotestplugin/qgeotiledmap_test.h index 7194e3d6..a1c7aa26 100644 --- a/tests/auto/geotestplugin/qgeotiledmap_test.h +++ b/tests/auto/geotestplugin/qgeotiledmap_test.h @@ -50,9 +50,6 @@ public: const QGeoTiledMapTestOptions &options, QObject *parent = nullptr); -protected slots: - void onCameraCenter_testChanged(QGeoMapParameter *param, const QMetaProperty &property); - public: using QGeoTiledMap::setCameraData; QGeoTiledMappingManagerEngine *m_engine; |