summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-10-12 17:27:15 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-10-25 17:17:30 +0200
commit1fa828b7aba04fa0c2449b490894ddb409a4e2d9 (patch)
tree4f72f0de4e5833e0f66a74580e21d7336b97eed8 /tests
parentddc494d287e3f5b82b363ef1b962aa00ffa7c13c (diff)
downloadqtlocation-1fa828b7aba04fa0c2449b490894ddb409a4e2d9.tar.gz
Disable Esri/Nokia/MapBox plugins
As a first step, put them behind feature flags that are always false. Remove mapbox-gl-native as a submodule - there's no reason why people wanting to build that can't clone and build that repo themselves. Don't test the respective providers unless they are available, and use the osm plugin when testing the basic plugin framework. Change-Id: I53429878e53294dce52ee830a4b4613f372898c6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/CMakeLists.txt8
-rw-r--r--tests/auto/declarative_location_core/tst_plugin.qml43
-rw-r--r--tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp115
3 files changed, 90 insertions, 76 deletions
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
index ed347367..af916073 100644
--- a/tests/auto/CMakeLists.txt
+++ b/tests/auto/CMakeLists.txt
@@ -39,7 +39,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)
@@ -51,7 +53,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)