summaryrefslogtreecommitdiff
path: root/tests/auto/geotestplugin
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/geotestplugin')
-rw-r--r--tests/auto/geotestplugin/geotestplugin.pro3
-rw-r--r--tests/auto/geotestplugin/qgeocodingmanagerengine_test.h5
-rw-r--r--tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h6
-rw-r--r--tests/auto/geotestplugin/qgeotiledmap_test.cpp88
-rw-r--r--tests/auto/geotestplugin/qgeotiledmap_test.h14
-rw-r--r--tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h25
6 files changed, 126 insertions, 15 deletions
diff --git a/tests/auto/geotestplugin/geotestplugin.pro b/tests/auto/geotestplugin/geotestplugin.pro
index fb3f1b39..f4fe25b3 100644
--- a/tests/auto/geotestplugin/geotestplugin.pro
+++ b/tests/auto/geotestplugin/geotestplugin.pro
@@ -14,7 +14,8 @@ HEADERS += qgeocodingmanagerengine_test.h \
qgeotiledmap_test.h \
qgeotilefetcher_test.h
-SOURCES += qgeoserviceproviderplugin_test.cpp
+SOURCES += qgeoserviceproviderplugin_test.cpp \
+ qgeotiledmap_test.cpp
OTHER_FILES += \
geotestplugin.json \
diff --git a/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h b/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h
index 1d9f0792..ecbb60d1 100644
--- a/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h
+++ b/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h
@@ -57,11 +57,6 @@ public:
void callSetOffset ( int offset ) {setOffset(offset);}
void callSetLocations ( const QList<QGeoLocation> & locations ) {setLocations(locations);}
void callSetViewport ( const QGeoShape &viewport ) {setViewport(viewport);}
- void abort() {
- emit aborted();
- }
-Q_SIGNALS:
- void aborted();
};
class QGeoCodingManagerEngineTest: public QGeoCodingManagerEngine
diff --git a/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h b/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
index 8ae58042..0a1e7ce6 100644
--- a/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
+++ b/tests/auto/geotestplugin/qgeoroutingmanagerengine_test.h
@@ -52,12 +52,6 @@ public:
void callSetError ( Error error, const QString & errorString ) {setError(error, errorString);}
void callSetFinished ( bool finished ) {setFinished(finished);}
void callSetRoutes(const QList<QGeoRoute> &routes) {setRoutes(routes);}
-
- void abort() {
- emit aborted();
- }
-Q_SIGNALS:
- void aborted();
};
class QGeoRoutingManagerEngineTest: public QGeoRoutingManagerEngine
diff --git a/tests/auto/geotestplugin/qgeotiledmap_test.cpp b/tests/auto/geotestplugin/qgeotiledmap_test.cpp
new file mode 100644
index 00000000..ef2af7db
--- /dev/null
+++ b/tests/auto/geotestplugin/qgeotiledmap_test.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeotiledmap_test.h"
+#include <QtLocation/private/qgeotiledmap_p_p.h>
+#include <QtLocation/private/qgeomapparameter_p.h>
+
+QT_USE_NAMESPACE
+
+class QGeoTiledMapTestPrivate: public QGeoTiledMapPrivate
+{
+ Q_DECLARE_PUBLIC(QGeoTiledMapTest)
+public:
+ QGeoTiledMapTestPrivate(QGeoTiledMappingManagerEngine *engine)
+ : QGeoTiledMapPrivate(engine)
+ {
+
+ }
+
+ ~QGeoTiledMapTestPrivate()
+ {
+
+ }
+
+ void addParameter(QGeoMapParameter *param) override
+ {
+ Q_Q(QGeoTiledMapTest);
+ if (param->type() == QStringLiteral("cameraCenter_test")) {
+ // We assume that cameraCenter_test parameters have a QGeoCoordinate property named "center"
+ // Handle the parameter
+ QGeoCameraData cameraData = m_cameraData;
+ QGeoCoordinate newCenter = param->property("center").value<QGeoCoordinate>();
+ cameraData.setCenter(newCenter);
+ q->setCameraData(cameraData);
+ // Connect for further changes handling
+ q->connect(param, SIGNAL(propertyUpdated(QGeoMapParameter *, const char *)),
+ q, SLOT(onCameraCenter_testChanged(QGeoMapParameter*, const char*)));
+
+ }
+ }
+ void removeParameter(QGeoMapParameter *param) override
+ {
+ Q_Q(QGeoTiledMapTest);
+ param->disconnect(q);
+ }
+};
+
+QGeoTiledMapTest::QGeoTiledMapTest(QGeoTiledMappingManagerEngine *engine, QObject *parent)
+: QGeoTiledMap(*new QGeoTiledMapTestPrivate(engine), engine, parent), m_engine(engine)
+{
+}
+
+void QGeoTiledMapTest::onCameraCenter_testChanged(QGeoMapParameter *param, const char *propertyName)
+{
+ Q_D(QGeoTiledMapTest);
+ if (strcmp(propertyName, "center") == 0) {
+ QGeoCameraData cameraData = d->m_cameraData;
+ // Not testing for propertyName as this param has only one allowed property
+ QGeoCoordinate newCenter = param->property(propertyName).value<QGeoCoordinate>();
+ cameraData.setCenter(newCenter);
+ setCameraData(cameraData);
+ }
+}
diff --git a/tests/auto/geotestplugin/qgeotiledmap_test.h b/tests/auto/geotestplugin/qgeotiledmap_test.h
index 27ff7164..19c7620e 100644
--- a/tests/auto/geotestplugin/qgeotiledmap_test.h
+++ b/tests/auto/geotestplugin/qgeotiledmap_test.h
@@ -33,17 +33,25 @@
#include <QtLocation/private/qgeotiledmap_p.h>
QT_USE_NAMESPACE
+
class QGeoTiledMappingManagerEngineTest;
+class QGeoTiledMapTestPrivate;
+
class QGeoTiledMapTest: public QGeoTiledMap
{
Q_OBJECT
+ Q_DECLARE_PRIVATE(QGeoTiledMapTest)
public:
- QGeoTiledMapTest(QGeoTiledMappingManagerEngine *engine, QObject *parent = 0):
- QGeoTiledMap(engine, parent),
- m_engine(engine){}
+ QGeoTiledMapTest(QGeoTiledMappingManagerEngine *engine, QObject *parent = 0);
+
+protected slots:
+ void onCameraCenter_testChanged(QGeoMapParameter *param, const char *propertyName);
+
public:
using QGeoTiledMap::setCameraData;
QGeoTiledMappingManagerEngine *m_engine;
};
#endif
+
+
diff --git a/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h b/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h
index 2765c268..df729392 100644
--- a/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h
+++ b/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h
@@ -57,12 +57,16 @@ public:
capabilities.setMinimumZoomLevel(0.0);
capabilities.setMaximumZoomLevel(20.0);
capabilities.setSupportsBearing(true);
+ capabilities.setSupportsTilting(true);
+ capabilities.setMinimumTilt(0);
+ capabilities.setMaximumTilt(60);
setTileSize(QSize(256, 256));
QList<QGeoMapType> mapTypes;
mapTypes << QGeoMapType(QGeoMapType::StreetMap, tr("StreetMap"), tr("StreetMap"), false, false, 1);
mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("SatelliteMapDay"), tr("SatelliteMapDay"), false, false, 2);
mapTypes << QGeoMapType(QGeoMapType::CycleMap, tr("CycleMap"), tr("CycleMap"), false, false, 3);
+ mapTypes << QGeoMapType(QGeoMapType::CustomMap, tr("AlternateCameraCapabilities"), tr("AlternateCameraCapabilities"), false, false, 4);
setSupportedMapTypes(mapTypes);
QGeoTileFetcherTest *fetcher = new QGeoTileFetcherTest(this);
@@ -87,6 +91,27 @@ public:
return new QGeoTiledMapTest(this);
}
+ QGeoCameraCapabilities cameraCapabilities(const QGeoMapType &mapType) const Q_DECL_OVERRIDE
+ {
+ switch (mapType.mapId()) {
+ case 4:
+ {
+ QGeoCameraCapabilities capabilities;
+ capabilities.setMinimumZoomLevel(0.0);
+ capabilities.setMaximumZoomLevel(19.0);
+ capabilities.setSupportsBearing(true);
+ capabilities.setSupportsTilting(true);
+ capabilities.setMinimumTilt(0);
+ capabilities.setMaximumTilt(80);
+ capabilities.setMinimumFieldOfView(1);
+ capabilities.setMaximumFieldOfView(179);
+ return capabilities;
+ }
+ default:
+ return QGeoMappingManagerEngine::cameraCapabilities(mapType);
+ }
+ }
+
};
#endif