1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the test suite of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29#ifndef QGEOTILEDMAPPINGMANAGERENGINE_TEST_H
30#define QGEOTILEDMAPPINGMANAGERENGINE_TEST_H
31
32#include <QtCore/QLocale>
33#include <QtLocation/QGeoServiceProvider>
34#include <QtLocation/private/qgeotiledmappingmanagerengine_p.h>
35#include <QtLocation/private/qgeotiledmapreply_p.h>
36#include <QtLocation/private/qgeomaptype_p.h>
37#include <QtLocation/private/qgeocameracapabilities_p.h>
38
39#include "qgeotiledmap_test.h"
40#include "qgeotilefetcher_test.h"
41
42QT_USE_NAMESPACE
43
44class QGeoTiledMappingManagerEngineTest: public QGeoTiledMappingManagerEngine
45{
46Q_OBJECT
47public:
48 QGeoTiledMappingManagerEngineTest(const QVariantMap &parameters,
49 QGeoServiceProvider::Error *error, QString *errorString) :
50 QGeoTiledMappingManagerEngine()
51 {
52 Q_UNUSED(error);
53 Q_UNUSED(errorString);
54
55 setLocale(QLocale (QLocale::German, QLocale::Germany));
56 QGeoCameraCapabilities capabilities;
57 capabilities.setMinimumZoomLevel(0.0);
58 capabilities.setMaximumZoomLevel(20.0);
59 capabilities.setSupportsBearing(true);
60 capabilities.setSupportsTilting(true);
61 capabilities.setMinimumTilt(0);
62 capabilities.setMaximumTilt(60);
63 setTileSize(QSize(256, 256));
64
65 const QByteArray pluginName = "qmlgeo.test.plugin";
66 QList<QGeoMapType> mapTypes;
67
68 mapTypes << QGeoMapType(QGeoMapType::StreetMap, tr(s: "StreetMap"), tr(s: "StreetMap"), false, false, 1, pluginName, capabilities);
69 mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, tr(s: "SatelliteMapDay"), tr(s: "SatelliteMapDay"), false, false, 2, pluginName, capabilities);
70 mapTypes << QGeoMapType(QGeoMapType::CycleMap, tr(s: "CycleMap"), tr(s: "CycleMap"), false, false, 3, pluginName, capabilities);
71
72 QGeoCameraCapabilities capabilities4;
73 capabilities4.setMinimumZoomLevel(0.0);
74 capabilities4.setMaximumZoomLevel(19.0);
75 capabilities4.setSupportsBearing(true);
76 capabilities4.setSupportsTilting(true);
77 capabilities4.setMinimumTilt(0);
78 capabilities4.setMaximumTilt(80);
79 capabilities4.setMinimumFieldOfView(1);
80 capabilities4.setMaximumFieldOfView(179);
81 QVariantMap meta;
82 meta["foo"] = 42;
83 mapTypes << QGeoMapType(QGeoMapType::CustomMap, tr(s: "AlternateCameraCapabilities"), tr(s: "AlternateCameraCapabilities"), false, false, 4, pluginName, capabilities4, meta);
84
85 if (parameters.contains(QStringLiteral("extraMapTypeName"))) {
86 QString extraMapTypeName = parameters.value(QStringLiteral("extraMapTypeName")).toString();
87 mapTypes << QGeoMapType(QGeoMapType::CustomMap, extraMapTypeName, extraMapTypeName, false, false, 5, pluginName, capabilities);
88 }
89
90 setSupportedMapTypes(mapTypes);
91
92 QGeoTileFetcherTest *fetcher = new QGeoTileFetcherTest(this);
93 if (parameters.contains(QStringLiteral("finishRequestImmediately")))
94 fetcher->setFinishRequestImmediately(parameters.value(QStringLiteral("finishRequestImmediately")).toBool());
95 if (parameters.contains(QStringLiteral("tileSize"))) {
96 int tileSize = parameters.value(QStringLiteral("tileSize")).toInt();
97 setTileSize(QSize(tileSize, tileSize));
98 }
99 if (parameters.contains(QStringLiteral("maxZoomLevel"))) {
100 double maxZoomLevel = parameters.value(QStringLiteral("maxZoomLevel")).toDouble();
101 capabilities.setMaximumZoomLevel(maxZoomLevel);
102 }
103 if (parameters.contains(QStringLiteral("supportVisibleArea"))) {
104 bool supportVisibleArea = parameters.value(QStringLiteral("supportVisibleArea")).toBool();
105 m_supportVisibleArea = supportVisibleArea;
106 }
107
108 setCameraCapabilities(capabilities);
109 fetcher->setTileSize(tileSize());
110 setTileFetcher(fetcher);
111 }
112
113 QGeoMap *createMap() override
114 {
115 QGeoTiledMapTestOptions opts;
116 opts.supportVisibleArea = m_supportVisibleArea;
117 return new QGeoTiledMapTest(this, opts);
118 }
119
120 bool m_supportVisibleArea = true;
121};
122
123#endif
124

source code of qtlocation/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h