diff options
Diffstat (limited to 'tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp')
-rw-r--r-- | tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp | 115 |
1 files changed, 61 insertions, 54 deletions
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) |