diff options
-rw-r--r-- | .gitmodules | 4 | ||||
m--------- | src/3rdparty/mapbox-gl-native | 0 | ||||
-rw-r--r-- | src/configure.cmake | 20 | ||||
-rw-r--r-- | src/plugins/geoservices/CMakeLists.txt | 12 | ||||
-rw-r--r-- | tests/auto/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tests/auto/declarative_location_core/tst_plugin.qml | 43 | ||||
-rw-r--r-- | tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp | 115 |
7 files changed, 113 insertions, 89 deletions
diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index a5343bfd..00000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "src/3rdparty/mapbox-gl-native"] - path = src/3rdparty/mapbox-gl-native - url = ../qtlocation-mapboxgl.git - branch = upstream/qt-staging diff --git a/src/3rdparty/mapbox-gl-native b/src/3rdparty/mapbox-gl-native deleted file mode 160000 -Subproject d3101bbc22edd41c9036ea487d4a71eabd97823 diff --git a/src/configure.cmake b/src/configure.cmake index 56f950b5..0f0364a8 100644 --- a/src/configure.cmake +++ b/src/configure.cmake @@ -1,11 +1,19 @@ -# TODO: figure out if we need any condition for that. -# Previously was: "condition": "config.opengl" -qt_feature("location-labs-plugin" PRIVATE - LABEL "Provides experimental QtLocation QML types" +qt_feature("geoservices_osm" PRIVATE + LABEL "Provides access to OpenStreetMap geoservices" CONDITION TRUE ) -qt_feature("geoservices_osm" PRIVATE +qt_feature("geoservices_esri" PRIVATE LABEL "Provides access to OpenStreetMap geoservices" - CONDITION TRUE + CONDITION FALSE +) + +qt_feature("geoservices_mapbox" PRIVATE + LABEL "Provides access to OpenStreetMap geoservices" + CONDITION FALSE +) + +qt_feature("geoservices_nokia" PRIVATE + LABEL "Provides access to OpenStreetMap geoservices" + CONDITION FALSE ) diff --git a/src/plugins/geoservices/CMakeLists.txt b/src/plugins/geoservices/CMakeLists.txt index 9235f3f1..efa1e7f6 100644 --- a/src/plugins/geoservices/CMakeLists.txt +++ b/src/plugins/geoservices/CMakeLists.txt @@ -1,7 +1,13 @@ -add_subdirectory(esri) add_subdirectory(itemsoverlay) -add_subdirectory(mapbox) -add_subdirectory(nokia) if(QT_FEATURE_geoservices_osm) add_subdirectory(osm) endif() +if(QT_FEATURE_geoservices_esri) + add_subdirectory(esri) +endif() +if(QT_FEATURE_geoservices_mapbox) + add_subdirectory(mapbox) +endif() +if(QT_FEATURE_geoservices_nokia) + add_subdirectory(nokia) +endif() diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt index 6a014f33..fd492549 100644 --- a/tests/auto/CMakeLists.txt +++ b/tests/auto/CMakeLists.txt @@ -42,7 +42,9 @@ if(TARGET Qt::Location) endif() if(TARGET Qt::Location AND NOT ANDROID) add_subdirectory(qgeojson) - add_subdirectory(qplacemanager_nokia) + if(QT_FEATURE_geoservices_nokia) + add_subdirectory(qplacemanager_nokia) + endif() add_subdirectory(placesplugin_unsupported) # add_subdirectory(cmake) if(QT6_IS_SHARED_LIBS_BUILD) @@ -54,7 +56,9 @@ if(TARGET Qt::Location AND NOT ANDROID) add_subdirectory(qgeocodingmanager) add_subdirectory(qgeotiledmap) endif() - add_subdirectory(nokia_services) + if(QT_FEATURE_geoservices_nokia) + add_subdirectory(nokia_services) + endif() endif() if (TARGET Qt::Location AND TARGET Qt::Quick AND QT6_IS_SHARED_LIBS_BUILD) diff --git a/tests/auto/declarative_location_core/tst_plugin.qml b/tests/auto/declarative_location_core/tst_plugin.qml index 869c61d6..3b0f4279 100644 --- a/tests/auto/declarative_location_core/tst_plugin.qml +++ b/tests/auto/declarative_location_core/tst_plugin.qml @@ -33,7 +33,7 @@ import QtLocation Item { Plugin { id: unattachedPlugin } - Plugin { id: herePlugin; name: "here"} + Plugin { id: osmPlugin; name: "osm"} Plugin { id: invalidPlugin; name: "invalid"; allowExperimental: true } Plugin { id: testPlugin; name: "qmlgeo.test.plugin" @@ -79,11 +79,11 @@ Item { verify(testPlugin.supportsRouting()) } - if (invalidPlugin.availableServiceProviders.indexOf('here')) { - verify(herePlugin.isAttached) - verify(herePlugin.supportsMapping(Plugin.OnlineMappingFeature)) - verify(herePlugin.supportsGeocoding(Plugin.OnlineGeocodingFeature)) - verify(herePlugin.supportsRouting(Plugin.OnlineRoutingFeature)) + if (invalidPlugin.availableServiceProviders.indexOf('osm') > -1) { + verify(osmPlugin.isAttached) + verify(osmPlugin.supportsMapping(Plugin.OnlineMappingFeature)) + verify(osmPlugin.supportsGeocoding(Plugin.OnlineGeocodingFeature)) + verify(osmPlugin.supportsRouting(Plugin.OnlineRoutingFeature)) } verify(!unattachedPlugin.isAttached) @@ -92,7 +92,8 @@ Item { invalidAttachedSpy.clear() compare(invalidAttachedSpy.count, 0) invalidPlugin.name = 'qmlgeo.test.plugin' - tryCompare(invalidAttachedSpy, 'count', 1) + let expectedAttachedSpy = 1 + tryCompare(invalidAttachedSpy, 'count', expectedAttachedSpy) verify(invalidPlugin.isAttached) verify(invalidPlugin.supportsMapping()) @@ -100,14 +101,16 @@ Item { verify(invalidPlugin.supportsRouting()) verify(invalidPlugin.supportsPlaces()) - invalidPlugin.name = 'here' - compare(invalidAttachedSpy.count, 2) - verify(invalidPlugin.supportsMapping(Plugin.OnlineMappingFeature)) - verify(invalidPlugin.supportsGeocoding(Plugin.OnlineGeocodingFeature)) - verify(invalidPlugin.supportsRouting(Plugin.OnlineRoutingFeature)) + if (invalidPlugin.availableServiceProviders.indexOf('osm') > -1) { + invalidPlugin.name = 'osm' + compare(invalidAttachedSpy.count, ++expectedAttachedSpy) + verify(invalidPlugin.supportsMapping(Plugin.OnlineMappingFeature)) + verify(invalidPlugin.supportsGeocoding(Plugin.OnlineGeocodingFeature)) + verify(invalidPlugin.supportsRouting(Plugin.OnlineRoutingFeature)) + } invalidPlugin.name = '' - compare(invalidAttachedSpy.count, 2) + compare(invalidAttachedSpy.count, expectedAttachedSpy) verify(!invalidPlugin.supportsMapping()) verify(!invalidPlugin.supportsGeocoding()) verify(!invalidPlugin.supportsRouting()) @@ -132,19 +135,19 @@ Item { } function test_locale() { - compare(herePlugin.locales, [Qt.locale().name]); + compare(osmPlugin.locales, [Qt.locale().name]); //try assignment of a single locale - herePlugin.locales = "fr_FR"; - compare(herePlugin.locales, ["fr_FR"]); + osmPlugin.locales = "fr_FR"; + compare(osmPlugin.locales, ["fr_FR"]); //try assignment of multiple locales - herePlugin.locales = ["fr_FR","en_US"]; - compare(herePlugin.locales, ["fr_FR","en_US"]); + osmPlugin.locales = ["fr_FR","en_US"]; + compare(osmPlugin.locales, ["fr_FR","en_US"]); //check that assignment of empty locale list defaults to system locale - herePlugin.locales = []; - compare(herePlugin.locales, [Qt.locale().name]); + osmPlugin.locales = []; + compare(osmPlugin.locales, [Qt.locale().name]); } } } diff --git a/tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp b/tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp index 0e7790ee..7561451f 100644 --- a/tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp +++ b/tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp @@ -44,6 +44,9 @@ private slots: void tst_features(); void tst_misc(); void tst_nokiaRename(); + +private: + QStringList providerList; }; void tst_QGeoServiceProvider::initTestCase() @@ -60,26 +63,21 @@ void tst_QGeoServiceProvider::initTestCase() + QStringLiteral("/../../../plugins")); #endif #endif + providerList = QGeoServiceProvider::availableServiceProviders(); + qInfo() << "Supported geoservice providers:" << providerList; } void tst_QGeoServiceProvider::tst_availableServiceProvider() { - const QStringList provider = QGeoServiceProvider::availableServiceProviders(); - // Currently provided plugins - if (provider.count() != 8) - qWarning() << provider; - QVERIFY(provider.count() >= 8); + QVERIFY(providerList.count() >= 5); // these providers are deployed - QVERIFY(provider.contains(QStringLiteral("mapbox"))); - QVERIFY(provider.contains(QStringLiteral("here"))); - QVERIFY(provider.contains(QStringLiteral("osm"))); - QVERIFY(provider.contains(QStringLiteral("esri"))); + QVERIFY(providerList.contains(QStringLiteral("osm"))); // these providers exist for unit tests only - QVERIFY(provider.contains(QStringLiteral("geocode.test.plugin"))); - QVERIFY(provider.contains(QStringLiteral("georoute.test.plugin"))); - QVERIFY(provider.contains(QStringLiteral("qmlgeo.test.plugin"))); - QVERIFY(provider.contains(QStringLiteral("test.places.unsupported"))); + QVERIFY(providerList.contains(QStringLiteral("geocode.test.plugin"))); + QVERIFY(providerList.contains(QStringLiteral("georoute.test.plugin"))); + QVERIFY(providerList.contains(QStringLiteral("qmlgeo.test.plugin"))); + QVERIFY(providerList.contains(QStringLiteral("test.places.unsupported"))); } @@ -102,43 +100,51 @@ void tst_QGeoServiceProvider::tst_features_data() << QGeoServiceProvider::RoutingFeatures(QGeoServiceProvider::NoRoutingFeatures) << QGeoServiceProvider::PlacesFeatures(QGeoServiceProvider::NoPlacesFeatures); - QTest::newRow("mapbox") << QString("mapbox") - << QGeoServiceProvider::MappingFeatures(QGeoServiceProvider::OnlineMappingFeature) - << QGeoServiceProvider::GeocodingFeatures(QGeoServiceProvider::OnlineGeocodingFeature - | QGeoServiceProvider::ReverseGeocodingFeature - | QGeoServiceProvider::LocalizedGeocodingFeature) - << QGeoServiceProvider::RoutingFeatures(QGeoServiceProvider::OnlineRoutingFeature) - << QGeoServiceProvider::PlacesFeatures(QGeoServiceProvider::OnlinePlacesFeature - | QGeoServiceProvider::PlaceRecommendationsFeature - | QGeoServiceProvider::SearchSuggestionsFeature - | QGeoServiceProvider::LocalizedPlacesFeature); - - QTest::newRow("here") << QString("here") - << QGeoServiceProvider::MappingFeatures(QGeoServiceProvider::OnlineMappingFeature) - << QGeoServiceProvider::GeocodingFeatures(QGeoServiceProvider::OnlineGeocodingFeature - | QGeoServiceProvider::ReverseGeocodingFeature) - << QGeoServiceProvider::RoutingFeatures(QGeoServiceProvider::OnlineRoutingFeature - | QGeoServiceProvider::RouteUpdatesFeature - | QGeoServiceProvider::AlternativeRoutesFeature - | QGeoServiceProvider::ExcludeAreasRoutingFeature) - << QGeoServiceProvider::PlacesFeatures(QGeoServiceProvider::OnlinePlacesFeature - | QGeoServiceProvider::PlaceRecommendationsFeature - | QGeoServiceProvider::SearchSuggestionsFeature - | QGeoServiceProvider::LocalizedPlacesFeature); - - QTest::newRow("osm") << QString("osm") - << QGeoServiceProvider::MappingFeatures(QGeoServiceProvider::OnlineMappingFeature) - << QGeoServiceProvider::GeocodingFeatures(QGeoServiceProvider::OnlineGeocodingFeature - | QGeoServiceProvider::ReverseGeocodingFeature) - << QGeoServiceProvider::RoutingFeatures(QGeoServiceProvider::OnlineRoutingFeature) - << QGeoServiceProvider::PlacesFeatures(QGeoServiceProvider::OnlinePlacesFeature); - - QTest::newRow("esri") << QString("esri") - << QGeoServiceProvider::MappingFeatures(QGeoServiceProvider::OnlineMappingFeature) - << QGeoServiceProvider::GeocodingFeatures(QGeoServiceProvider::OnlineGeocodingFeature - | QGeoServiceProvider::ReverseGeocodingFeature) - << QGeoServiceProvider::RoutingFeatures(QGeoServiceProvider::OnlineRoutingFeature) - << QGeoServiceProvider::PlacesFeatures(QGeoServiceProvider::OnlinePlacesFeature); + if (providerList.contains("mapbox")) { + QTest::newRow("mapbox") << QString("mapbox") + << QGeoServiceProvider::MappingFeatures(QGeoServiceProvider::OnlineMappingFeature) + << QGeoServiceProvider::GeocodingFeatures(QGeoServiceProvider::OnlineGeocodingFeature + | QGeoServiceProvider::ReverseGeocodingFeature + | QGeoServiceProvider::LocalizedGeocodingFeature) + << QGeoServiceProvider::RoutingFeatures(QGeoServiceProvider::OnlineRoutingFeature) + << QGeoServiceProvider::PlacesFeatures(QGeoServiceProvider::OnlinePlacesFeature + | QGeoServiceProvider::PlaceRecommendationsFeature + | QGeoServiceProvider::SearchSuggestionsFeature + | QGeoServiceProvider::LocalizedPlacesFeature); + } + + if (providerList.contains("here")) { + QTest::newRow("here") << QString("here") + << QGeoServiceProvider::MappingFeatures(QGeoServiceProvider::OnlineMappingFeature) + << QGeoServiceProvider::GeocodingFeatures(QGeoServiceProvider::OnlineGeocodingFeature + | QGeoServiceProvider::ReverseGeocodingFeature) + << QGeoServiceProvider::RoutingFeatures(QGeoServiceProvider::OnlineRoutingFeature + | QGeoServiceProvider::RouteUpdatesFeature + | QGeoServiceProvider::AlternativeRoutesFeature + | QGeoServiceProvider::ExcludeAreasRoutingFeature) + << QGeoServiceProvider::PlacesFeatures(QGeoServiceProvider::OnlinePlacesFeature + | QGeoServiceProvider::PlaceRecommendationsFeature + | QGeoServiceProvider::SearchSuggestionsFeature + | QGeoServiceProvider::LocalizedPlacesFeature); + } + + if (providerList.contains("osm")) { + QTest::newRow("osm") << QString("osm") + << QGeoServiceProvider::MappingFeatures(QGeoServiceProvider::OnlineMappingFeature) + << QGeoServiceProvider::GeocodingFeatures(QGeoServiceProvider::OnlineGeocodingFeature + | QGeoServiceProvider::ReverseGeocodingFeature) + << QGeoServiceProvider::RoutingFeatures(QGeoServiceProvider::OnlineRoutingFeature) + << QGeoServiceProvider::PlacesFeatures(QGeoServiceProvider::OnlinePlacesFeature); + } + + if (providerList.contains("esri")) { + QTest::newRow("esri") << QString("esri") + << QGeoServiceProvider::MappingFeatures(QGeoServiceProvider::OnlineMappingFeature) + << QGeoServiceProvider::GeocodingFeatures(QGeoServiceProvider::OnlineGeocodingFeature + | QGeoServiceProvider::ReverseGeocodingFeature) + << QGeoServiceProvider::RoutingFeatures(QGeoServiceProvider::OnlineRoutingFeature) + << QGeoServiceProvider::PlacesFeatures(QGeoServiceProvider::OnlinePlacesFeature); + } } void tst_QGeoServiceProvider::tst_features() @@ -221,10 +227,11 @@ void tst_QGeoServiceProvider::tst_nokiaRename() // It remains available under the name "nokia" for now // but is not advertised via QGeoServiceProvider::availableServiceProviders() - QVERIFY(!QGeoServiceProvider::availableServiceProviders().contains("nokia")); - QGeoServiceProvider provider(QStringLiteral("nokia")); - QCOMPARE(provider.error(), QGeoServiceProvider::NoError); - + if (providerList.contains("here")) { + QVERIFY(!QGeoServiceProvider::availableServiceProviders().contains("nokia")); + QGeoServiceProvider provider(QStringLiteral("nokia")); + QCOMPARE(provider.error(), QGeoServiceProvider::NoError); + } } QTEST_GUILESS_MAIN(tst_QGeoServiceProvider) |