summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-03-07 17:40:23 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2018-03-08 20:50:06 +0000
commitd7df0fa2952e3a00032ff50b0dc10ad93be57f54 (patch)
treecc00e7b778f233810a36a081dedd01962698bcba /tests
parent86a406fd6b705d75567286f1b6c5a09d79a0a0cc (diff)
API Fix: change QGeoRouteRequest::extraParameters into QVariantMapv5.11.0-beta2
Needed as it turns out the QGeoRouteRequest associated with a QGeoRoute has to be exposed also through the declarative API (so QDeclarativeGeoRoute must expose an associated QDeclarativeGeoRouteRequest). QDeclarativeGeoRouteRequest was, until now, intended to be only a one-way API (to feed data into the plugin). Now that it has also to expose data coming from the plugin, including the associated extraParameters that do would come anymore from nested MapParameters but from the QGeoRouteRequest itself. For this reason the type has to be a QML-friently type. Change-Id: I083e0fe97ad1088f6084665037003e24edb54371 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h2
-rw-r--r--tests/auto/qgeorouterequest/tst_qgeorouterequest.cpp14
2 files changed, 9 insertions, 7 deletions
diff --git a/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h b/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
index 0a0ec463..303015b7 100644
--- a/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
+++ b/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
@@ -169,7 +169,7 @@ public:
QList<QGeoRoute> routes;
int travelTime = 0;
if (request.extraParameters().contains("test-traveltime"))
- travelTime = request.extraParameters().value("test-traveltime").value("requestedTime").toInt();
+ travelTime = request.extraParameters().value("test-traveltime").toMap().value("requestedTime").toInt();
for (int i = 0; i < request.numberAlternativeRoutes(); ++i) {
QGeoRoute route;
diff --git a/tests/auto/qgeorouterequest/tst_qgeorouterequest.cpp b/tests/auto/qgeorouterequest/tst_qgeorouterequest.cpp
index 508571c3..d29e3d49 100644
--- a/tests/auto/qgeorouterequest/tst_qgeorouterequest.cpp
+++ b/tests/auto/qgeorouterequest/tst_qgeorouterequest.cpp
@@ -321,25 +321,27 @@ void tst_QGeoRouteRequest::featureWeight()
void tst_QGeoRouteRequest::extraParameters_data()
{
- QTest::addColumn<QMap<QString, QVariantMap>>("extraParameters");
+ QTest::addColumn<QVariantMap>("extraParameters");
- QMap<QString, QVariantMap> params;
+ QVariantMap params;
QTest::newRow("Empty") << params;
- params["param1"] = {{"property1", QVariant(42)} , {"property2", QVariant("42")} , {"property3", QVariant("42.0")}};
+ const QVariantMap param1 = {{"property1", QVariant(42)} , {"property2", QVariant("42")} , {"property3", QVariant("42.0")}};
+ params["param1"] = param1;
QTest::newRow("One param") << params;
- params["param2"] = {{"property1", QVariant(43)} , {"property2", QVariant("43")} , {"property3", QVariant("43.0")}};
+ const QVariantMap param2 = {{"property1", QVariant(43)} , {"property2", QVariant("43")} , {"property3", QVariant("43.0")}};
+ params["param2"] = param2;
QTest::newRow("Two params") << params;
}
void tst_QGeoRouteRequest::extraParameters()
{
- typedef QMap<QString, QVariantMap> ParameterType;
+ typedef QVariantMap ParameterType;
QFETCH(ParameterType , extraParameters);
- QMap<QString, QVariantMap> emptyParams;
+ QVariantMap emptyParams;
qgeorouterequest->setExtraParameters(extraParameters);
QCOMPARE(qgeorouterequest->extraParameters(), extraParameters);
qgeorouterequest->setExtraParameters(emptyParams);