From d22e6d09f1607e694694d2ae5b2f447605a8782e Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Mon, 21 Aug 2017 14:44:34 +0200 Subject: Fix PluginParameter not working with script as property values This patch introduces the undocumented QDeclarativeGeoServiceProviderParameter::initialized signal, to signal to the parent when a parameter becomes fully initialized, so that the parent QDeclarativeGeoServiceProvider can attach. Task-number: QTBUG-62075 Change-Id: Ie3615abf31d19f39587c5e54b202f8f2c4a711cc Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/declarative_core/tst_plugin.qml | 7 ++++++- tests/auto/declarative_ui/tst_map.qml | 24 ++++++++++++++++++++++ .../qgeotiledmappingmanagerengine_test.h | 6 ++++++ 3 files changed, 36 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/declarative_core/tst_plugin.qml b/tests/auto/declarative_core/tst_plugin.qml index 3dabba07..7b880f1d 100644 --- a/tests/auto/declarative_core/tst_plugin.qml +++ b/tests/auto/declarative_core/tst_plugin.qml @@ -99,9 +99,14 @@ Item { verify(invalidPlugin.supportsRouting()) verify(invalidPlugin.supportsPlaces()) - invalidPlugin.name = '' + invalidPlugin.name = 'here' compare(invalidAttachedSpy.count, 2) + verify(invalidPlugin.supportsMapping(Plugin.OnlineMappingFeature)) + verify(invalidPlugin.supportsGeocoding(Plugin.OnlineGeocodingFeature)) + verify(invalidPlugin.supportsRouting(Plugin.OnlineRoutingFeature)) + invalidPlugin.name = '' + compare(invalidAttachedSpy.count, 2) verify(!invalidPlugin.supportsMapping()) verify(!invalidPlugin.supportsGeocoding()) verify(!invalidPlugin.supportsRouting()) diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml index 408bf96e..5c9deca2 100644 --- a/tests/auto/declarative_ui/tst_map.qml +++ b/tests/auto/declarative_ui/tst_map.qml @@ -50,6 +50,20 @@ Item { } ] } + Plugin { + id: testPluginLazyParameter; + name: "qmlgeo.test.plugin" + allowExperimental: true + property string extraTypeName : undefined + PluginParameter { name: "supported"; value: true} + PluginParameter { name: "finishRequestImmediately"; value: true} + PluginParameter { name: "validateWellKnownValues"; value: true} + PluginParameter { name: "extraMapTypeName"; value: testPluginLazyParameter.extraTypeName} + + Component.onCompleted: { + extraTypeName = "SomeString" + } + } property variant coordinate1: QtPositioning.coordinate(10, 11) property variant coordinate2: QtPositioning.coordinate(12, 13) @@ -106,6 +120,11 @@ Item { Map {id: mapTiltBearingHere; plugin: herePlugin; center: coordinate1; width: 1000; height: 1000; zoomLevel: 4; bearing: 45.0; tilt: 25.0 } + Map { + id: mapWithLazyPlugin + plugin: testPluginLazyParameter + } + MapParameter { id: testParameter type: "cameraCenter_test" @@ -129,6 +148,11 @@ Item { mapCenterSpy.clear(); } + function test_lazy_parameter() { + compare(mapWithLazyPlugin.supportedMapTypes.length, 5) + compare(mapWithLazyPlugin.supportedMapTypes[4].name, "SomeString") + } + function test_map_center() { // coordinate is set at map element declaration compare(map.center.latitude, 10) diff --git a/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h b/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h index 5f6f0116..2fcf654d 100644 --- a/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h +++ b/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h @@ -68,6 +68,12 @@ public: mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("SatelliteMapDay"), tr("SatelliteMapDay"), false, false, 2, pluginName); mapTypes << QGeoMapType(QGeoMapType::CycleMap, tr("CycleMap"), tr("CycleMap"), false, false, 3, pluginName); mapTypes << QGeoMapType(QGeoMapType::CustomMap, tr("AlternateCameraCapabilities"), tr("AlternateCameraCapabilities"), false, false, 4, pluginName); + + if (parameters.contains(QStringLiteral("extraMapTypeName"))) { + QString extraMapTypeName = parameters.value(QStringLiteral("extraMapTypeName")).toString(); + mapTypes << QGeoMapType(QGeoMapType::CustomMap, extraMapTypeName, extraMapTypeName, false, false, 5, pluginName); + } + setSupportedMapTypes(mapTypes); QGeoTileFetcherTest *fetcher = new QGeoTileFetcherTest(this); -- cgit v1.2.1