diff options
-rw-r--r-- | examples/location/mapviewer/forms/LocaleForm.ui.qml | 1 | ||||
-rw-r--r-- | src/imports/location/plugins.qmltypes | 434 | ||||
-rw-r--r-- | src/imports/location/qdeclarativegeomap.cpp | 12 | ||||
-rw-r--r-- | src/imports/positioning/plugins.qmltypes | 84 | ||||
-rw-r--r-- | src/positioning/doc/src/qtpositioning.qdoc | 2 | ||||
-rw-r--r-- | src/positioning/qgeoprojection.cpp | 3 | ||||
-rw-r--r-- | tests/auto/declarative_ui/tst_map_geocoding.qml | 4 | ||||
-rw-r--r-- | tests/auto/declarative_ui/tst_map_maptype.qml | 111 | ||||
-rw-r--r-- | tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h | 6 |
9 files changed, 576 insertions, 81 deletions
diff --git a/examples/location/mapviewer/forms/LocaleForm.ui.qml b/examples/location/mapviewer/forms/LocaleForm.ui.qml index a146aed4..91a08471 100644 --- a/examples/location/mapviewer/forms/LocaleForm.ui.qml +++ b/examples/location/mapviewer/forms/LocaleForm.ui.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.5 +import QtQuick.Controls 1.4 import QtQuick.Layouts 1.2 Item { diff --git a/src/imports/location/plugins.qmltypes b/src/imports/location/plugins.qmltypes index b8daa8d0..5b2a72ea 100644 --- a/src/imports/location/plugins.qmltypes +++ b/src/imports/location/plugins.qmltypes @@ -1,4 +1,4 @@ -import QtQuick.tooling 1.1 +import QtQuick.tooling 1.2 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. @@ -7,6 +7,272 @@ import QtQuick.tooling 1.1 // 'qmlplugindump -nonrelocatable QtLocation 5.5' Module { + dependencies: [] + Component { + name: "QAbstractItemModel" + prototype: "QObject" + Enum { + name: "LayoutChangeHint" + values: { + "NoLayoutChangeHint": 0, + "VerticalSortHint": 1, + "HorizontalSortHint": 2 + } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + Parameter { name: "roles"; type: "QVector<int>" } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + } + Signal { + name: "headerDataChanged" + Parameter { name: "orientation"; type: "Qt::Orientation" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + } + Signal { name: "layoutChanged" } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + } + Signal { name: "layoutAboutToBeChanged" } + Signal { + name: "rowsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { name: "modelAboutToBeReset" } + Signal { name: "modelReset" } + Signal { + name: "rowsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationRow"; type: "int" } + } + Signal { + name: "rowsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "row"; type: "int" } + } + Signal { + name: "columnsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationColumn"; type: "int" } + } + Signal { + name: "columnsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "column"; type: "int" } + } + Method { name: "submit"; type: "bool" } + Method { name: "revert" } + Method { + name: "hasIndex" + type: "bool" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "hasIndex" + type: "bool" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + } + Method { + name: "index" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "index" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + } + Method { + name: "parent" + type: "QModelIndex" + Parameter { name: "child"; type: "QModelIndex" } + } + Method { + name: "sibling" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "idx"; type: "QModelIndex" } + } + Method { + name: "rowCount" + type: "int" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "rowCount"; type: "int" } + Method { + name: "columnCount" + type: "int" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "columnCount"; type: "int" } + Method { + name: "hasChildren" + type: "bool" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "hasChildren"; type: "bool" } + Method { + name: "data" + type: "QVariant" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "data" + type: "QVariant" + Parameter { name: "index"; type: "QModelIndex" } + } + Method { + name: "setData" + type: "bool" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "setData" + type: "bool" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "value"; type: "QVariant" } + } + Method { + name: "headerData" + type: "QVariant" + Parameter { name: "section"; type: "int" } + Parameter { name: "orientation"; type: "Qt::Orientation" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "headerData" + type: "QVariant" + Parameter { name: "section"; type: "int" } + Parameter { name: "orientation"; type: "Qt::Orientation" } + } + Method { + name: "fetchMore" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "canFetchMore" + type: "bool" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "flags" + type: "Qt::ItemFlags" + Parameter { name: "index"; type: "QModelIndex" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "hits"; type: "int" } + Parameter { name: "flags"; type: "Qt::MatchFlags" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "hits"; type: "int" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + } + } + Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" } Component { name: "QDeclarativeCategory" prototype: "QObject" @@ -147,6 +413,7 @@ Module { Property { name: "mapItems"; type: "QList<QObject*>"; isReadonly: true } Property { name: "error"; type: "QGeoServiceProvider::Error"; isReadonly: true } Property { name: "errorString"; type: "string"; isReadonly: true } + Property { name: "visibleRegion"; type: "QGeoShape" } Signal { name: "pluginChanged" Parameter { name: "plugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true } @@ -197,7 +464,7 @@ Module { Parameter { name: "dx"; type: "int" } Parameter { name: "dy"; type: "int" } } - Method { name: "cameraStopped" } + Method { name: "prefetchData" } } Component { name: "QDeclarativeGeoMapGestureArea" @@ -249,7 +516,6 @@ Module { Signal { name: "panFinished" } Signal { name: "flickStarted" } Signal { name: "flickFinished" } - Signal { name: "movementStopped" } } Component { name: "QDeclarativeGeoMapItemBase" @@ -1017,16 +1283,10 @@ Module { Component { name: "QDeclarativeRouteMapItem" defaultProperty: "data" - prototype: "QDeclarativeGeoMapItemBase" + prototype: "QDeclarativePolylineMapItem" exports: ["QtLocation/MapRoute 5.0"] exportMetaObjectRevisions: [0] Property { name: "route"; type: "QDeclarativeGeoRoute"; isPointer: true } - Property { - name: "line" - type: "QDeclarativeMapLineProperties" - isReadonly: true - isPointer: true - } Signal { name: "routeChanged" Parameter { name: "route"; type: "const QDeclarativeGeoRoute"; isPointer: true } @@ -1165,4 +1425,158 @@ Module { } Method { name: "keys"; type: "QStringList" } } + Component { + name: "QQuickItem" + defaultProperty: "data" + prototype: "QObject" + Enum { + name: "TransformOrigin" + values: { + "TopLeft": 0, + "Top": 1, + "TopRight": 2, + "Left": 3, + "Center": 4, + "Right": 5, + "BottomLeft": 6, + "Bottom": 7, + "BottomRight": 8 + } + } + Property { name: "parent"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + Property { name: "z"; type: "double" } + Property { name: "width"; type: "double" } + Property { name: "height"; type: "double" } + Property { name: "opacity"; type: "double" } + Property { name: "enabled"; type: "bool" } + Property { name: "visible"; type: "bool" } + Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } + Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } + Property { name: "state"; type: "string" } + Property { name: "childrenRect"; type: "QRectF"; isReadonly: true } + Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true } + Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baselineOffset"; type: "double" } + Property { name: "clip"; type: "bool" } + Property { name: "focus"; type: "bool" } + Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } + Property { name: "rotation"; type: "double" } + Property { name: "scale"; type: "double" } + Property { name: "transformOrigin"; type: "TransformOrigin" } + Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true } + Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true } + Property { name: "smooth"; type: "bool" } + Property { name: "antialiasing"; type: "bool" } + Property { name: "implicitWidth"; type: "double" } + Property { name: "implicitHeight"; type: "double" } + Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true } + Signal { + name: "childrenRectChanged" + Parameter { type: "QRectF" } + } + Signal { + name: "baselineOffsetChanged" + Parameter { type: "double" } + } + Signal { + name: "stateChanged" + Parameter { type: "string" } + } + Signal { + name: "focusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } + Signal { + name: "parentChanged" + Parameter { type: "QQuickItem"; isPointer: true } + } + Signal { + name: "transformOriginChanged" + Parameter { type: "TransformOrigin" } + } + Signal { + name: "smoothChanged" + Parameter { type: "bool" } + } + Signal { + name: "antialiasingChanged" + Parameter { type: "bool" } + } + Signal { + name: "clipChanged" + Parameter { type: "bool" } + } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } + Method { name: "update" } + Method { + name: "grabToImage" + revision: 2 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + Parameter { name: "targetSize"; type: "QSize" } + } + Method { + name: "grabToImage" + revision: 2 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + } + Method { + name: "contains" + type: "bool" + Parameter { name: "point"; type: "QPointF" } + } + Method { + name: "mapFromItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { name: "forceActiveFocus" } + Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + revision: 1 + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" } + Method { + name: "childAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } } diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp index b00d46b7..53c40a6e 100644 --- a/src/imports/location/qdeclarativegeomap.cpp +++ b/src/imports/location/qdeclarativegeomap.cpp @@ -192,6 +192,9 @@ QDeclarativeGeoMap::QDeclarativeGeoMap(QQuickItem *parent) // Create internal flickable and pinch area. m_gestureArea = new QDeclarativeGeoMapGestureArea(this, this); + m_activeMapType = new QDeclarativeGeoMapType(QGeoMapType(QGeoMapType::NoMap, + tr("No Map"), + tr("No Map"), false, false, 0), this); } QDeclarativeGeoMap::~QDeclarativeGeoMap() @@ -1123,9 +1126,12 @@ void QDeclarativeGeoMap::clearMapItems() */ void QDeclarativeGeoMap::setActiveMapType(QDeclarativeGeoMapType *mapType) { - m_activeMapType = mapType; - m_map->setActiveMapType(mapType->mapType()); - emit activeMapTypeChanged(); + if (m_activeMapType->mapType() != mapType->mapType()) { + m_activeMapType = mapType; + if (m_map) + m_map->setActiveMapType(mapType->mapType()); + emit activeMapTypeChanged(); + } } QDeclarativeGeoMapType * QDeclarativeGeoMap::activeMapType() const diff --git a/src/imports/positioning/plugins.qmltypes b/src/imports/positioning/plugins.qmltypes index 9ea738f4..853c55cb 100644 --- a/src/imports/positioning/plugins.qmltypes +++ b/src/imports/positioning/plugins.qmltypes @@ -1,4 +1,4 @@ -import QtQuick.tooling 1.1 +import QtQuick.tooling 1.2 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. @@ -7,6 +7,7 @@ import QtQuick.tooling 1.1 // 'qmlplugindump -nonrelocatable QtPositioning 5.5' Module { + dependencies: [] Component { name: "LocationSingleton" prototype: "QObject" @@ -60,6 +61,16 @@ Module { type: "QGeoCircle" Parameter { name: "center"; type: "QGeoCoordinate" } } + Method { + name: "shapeToCircle" + type: "QGeoCircle" + Parameter { name: "shape"; type: "QGeoShape" } + } + Method { + name: "shapeToRectangle" + type: "QGeoRectangle" + Parameter { name: "shape"; type: "QGeoShape" } + } } Component { name: "QDeclarativeGeoAddress" @@ -201,4 +212,75 @@ Module { } Method { name: "toString"; type: "string" } } + Component { + name: "QQuickAbstractAnimation" + prototype: "QObject" + Enum { + name: "Loops" + values: { + "Infinite": -2 + } + } + Property { name: "running"; type: "bool" } + Property { name: "paused"; type: "bool" } + Property { name: "alwaysRunToEnd"; type: "bool" } + Property { name: "loops"; type: "int" } + Signal { name: "started" } + Signal { name: "stopped" } + Signal { + name: "runningChanged" + Parameter { type: "bool" } + } + Signal { + name: "pausedChanged" + Parameter { type: "bool" } + } + Signal { + name: "alwaysRunToEndChanged" + Parameter { type: "bool" } + } + Signal { + name: "loopCountChanged" + Parameter { type: "int" } + } + Method { name: "restart" } + Method { name: "start" } + Method { name: "pause" } + Method { name: "resume" } + Method { name: "stop" } + Method { name: "complete" } + } + Component { + name: "QQuickPropertyAnimation" + prototype: "QQuickAbstractAnimation" + Property { name: "duration"; type: "int" } + Property { name: "from"; type: "QVariant" } + Property { name: "to"; type: "QVariant" } + Property { name: "easing"; type: "QEasingCurve" } + Property { name: "target"; type: "QObject"; isPointer: true } + Property { name: "property"; type: "string" } + Property { name: "properties"; type: "string" } + Property { name: "targets"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "exclude"; type: "QObject"; isList: true; isReadonly: true } + Signal { + name: "durationChanged" + Parameter { type: "int" } + } + Signal { + name: "fromChanged" + Parameter { type: "QVariant" } + } + Signal { + name: "toChanged" + Parameter { type: "QVariant" } + } + Signal { + name: "easingChanged" + Parameter { type: "QEasingCurve" } + } + Signal { + name: "propertiesChanged" + Parameter { type: "string" } + } + } } diff --git a/src/positioning/doc/src/qtpositioning.qdoc b/src/positioning/doc/src/qtpositioning.qdoc index 73ec24bc..c2d6912d 100644 --- a/src/positioning/doc/src/qtpositioning.qdoc +++ b/src/positioning/doc/src/qtpositioning.qdoc @@ -62,7 +62,7 @@ The Qt Positioning API provides positioning information via QML and C++ interfaces. Currently the API is supported on \l{Qt for Android}{Android}, -\l{Qt for BlackBerry}{BlackBerry 10}, \l{Qt for iOS}{iOS}, +\l{Qt for iOS}{iOS}, \l{Qt for Linux/X11}{Linux} (using \l{http://www.freedesktop.org/wiki/Software/GeoClue}{GeoClue}) and \l {Qt for WinRT} {WinRT}. diff --git a/src/positioning/qgeoprojection.cpp b/src/positioning/qgeoprojection.cpp index 0d3543e4..a2e087b0 100644 --- a/src/positioning/qgeoprojection.cpp +++ b/src/positioning/qgeoprojection.cpp @@ -51,8 +51,7 @@ QDoubleVector2D QGeoProjection::coordToMercator(const QGeoCoordinate &coord) double lat = coord.latitude(); lat = 0.5 - (std::log(std::tan((pi / 4.0) + (pi / 2.0) * lat / 180.0)) / pi) / 2.0; - lat = qMax(0.0, lat); - lat = qMin(1.0, lat); + lat = qBound(0.0, lat, 1.0); return QDoubleVector2D(lon, lat); } diff --git a/tests/auto/declarative_ui/tst_map_geocoding.qml b/tests/auto/declarative_ui/tst_map_geocoding.qml index 93fbf831..1828c1ba 100644 --- a/tests/auto/declarative_ui/tst_map_geocoding.qml +++ b/tests/auto/declarative_ui/tst_map_geocoding.qml @@ -138,7 +138,7 @@ Item { compare(emptyModel.bounds.center.latitude, dynamicCircle.center.latitude) // status - compare (emptyModel.status, RouteModel.Null) + compare (emptyModel.status, GeocodeModel.Null) // error compare (emptyModel.errorString, "") @@ -296,7 +296,7 @@ Item { immediateModel.query = errorAddress1 immediateModel.update() compare (immediateModel.errorString, errorAddress1.street) - compare (immediateModel.error, RouteModel.CommunicationError) + compare (immediateModel.error, GeocodeModel.CommunicationError) compare (immediateModel.count, 0) compare (statusImmediateSpy.count, 2) compare (immediateModel.status, GeocodeModel.Error) diff --git a/tests/auto/declarative_ui/tst_map_maptype.qml b/tests/auto/declarative_ui/tst_map_maptype.qml index 26290399..a20241fc 100644 --- a/tests/auto/declarative_ui/tst_map_maptype.qml +++ b/tests/auto/declarative_ui/tst_map_maptype.qml @@ -33,78 +33,65 @@ import QtQuick 2.0 import QtTest 1.0 -import QtLocation 5.3 +import QtLocation 5.5 -TestCase { - id: testCase +Item{ + id: page + x: 0; y: 0; + width: 100 + height: 100 - name: "MapType" + Plugin { id: testPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true } + Map { id: map; anchors.fill: parent } + SignalSpy { id: supportedMapTypesSpy; target: map; signalName: "supportedMapTypesChanged" } + SignalSpy { id: activeMapTypeChangedSpy; target: map; signalName: "activeMapTypeChanged" } - Plugin { - id: herePlugin - name: "here" - parameters: [ - PluginParameter { - name: "here.app_id" - value: "stub" - }, - PluginParameter { - name: "here.token" - value: "stub" - } - ] - } + TestCase { + id: testCase + name: "MapType" + when: windowShown - Map { - id: map; - plugin: herePlugin - center { - latitude: 62.240501 - longitude: 25.757014 + function initTestCase() + { + compare(map.supportedMapTypes.length, 0) + compare(map.activeMapType.style, MapType.NoMap) + map.plugin = testPlugin + tryCompare(supportedMapTypesSpy, "count", 1) + compare(map.supportedMapTypes.length,3) + compare(map.supportedMapTypes[0].style, MapType.StreetMap) + compare(map.supportedMapTypes[0].name, "StreetMap") + compare(map.supportedMapTypes[0].description, "StreetMap") + compare(map.supportedMapTypes[1].style, MapType.SatelliteMapDay) + compare(map.supportedMapTypes[1].name, "SatelliteMapDay") + compare(map.supportedMapTypes[1].description, "SatelliteMapDay") + compare(map.supportedMapTypes[2].style, MapType.CycleMap) + compare(map.supportedMapTypes[2].name, "CycleMap") + compare(map.supportedMapTypes[2].description, "CycleMap") + //default + compare(map.activeMapType.style, MapType.StreetMap) } - width: 100 - height: 100 - } - SignalSpy {id: supportedSetSpy; target: map; signalName: "supportedMapTypesChanged"} - SignalSpy {id: activeMapTypeChangedSpy; target: map; signalName: "activeMapTypeChanged"} - - function initTestCase() { - if (map.supportedMapTypes.length == 0 && supportedSetSpy.count == 0) { - wait(1000) - if (supportedSetSpy.count == 0) - wait(2000) - compare(supportedSetSpy.count, 1, - "supportedMapTypesChanged signal didn't arrive") + function init() + { + supportedMapTypesSpy.clear() + activeMapTypeChangedSpy.clear() + map.activeMapType = map.supportedMapTypes[0] } - } - function test_supported_types() { - var count = map.supportedMapTypes.length - console.log('Number of supported map types: ' + count) - - console.log('Supported map types:') - for (var i = 0; i < count; i++) { - console.log('style: ' + map.supportedMapTypes[i].style - + ', name: ' + map.supportedMapTypes[i].name - + ', desc: ' + map.supportedMapTypes[i].description - + ', mobile: ' + map.supportedMapTypes[i].mobile) - } - } + function test_setting_types() + { + map.activeMapType = map.supportedMapTypes[0] + tryCompare(activeMapTypeChangedSpy, "count", 0) - function test_setting_types() { - var count = map.supportedMapTypes.length - console.log('Number of supported map types: ' - + map.supportedMapTypes.length) + map.activeMapType = map.supportedMapTypes[1] + tryCompare(activeMapTypeChangedSpy, "count", 1) + compare(map.supportedMapTypes[1].name, map.activeMapType.name) + compare(map.supportedMapTypes[1].style, map.activeMapType.style) - activeMapTypeChangedSpy.clear(); - for (var i = 0; i < count; i++) { - console.log('setting ' + map.supportedMapTypes[i].name) - map.activeMapType = map.supportedMapTypes[i] - compare(map.supportedMapTypes[i].name, map.activeMapType.name, - "Error setting the active maptype (or getting it after)") + map.activeMapType = map.supportedMapTypes[2] + tryCompare(activeMapTypeChangedSpy, "count", 2) + compare(map.supportedMapTypes[2].name, map.activeMapType.name) + compare(map.supportedMapTypes[2].style, map.activeMapType.style) } - console.log('change count: ' + activeMapTypeChangedSpy.count) - compare(activeMapTypeChangedSpy.count, count) } } diff --git a/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h b/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h index 3751a845..2750dfea 100644 --- a/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h +++ b/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h @@ -66,6 +66,12 @@ public: 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); + setSupportedMapTypes(mapTypes); + QGeoTileFetcherTest *fetcher = new QGeoTileFetcherTest(this); fetcher->setParams(parameters); fetcher->setTileSize(QSize(256, 255)); |