diff options
author | Liang Qi <liang.qi@qt.io> | 2017-06-07 11:06:28 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-06-07 11:06:28 +0200 |
commit | f55629245259ba7364e258f92408823024423caa (patch) | |
tree | f73063cf02dc175fbe9f0bfb48b3ddd686ea0f72 /tests | |
parent | 22d980c8124026eb712f563326d5a5c1b180c671 (diff) | |
parent | d89701c5c8646dedb0ebb2e011c4da796a6ae8a1 (diff) | |
download | qtlocation-f55629245259ba7364e258f92408823024423caa.tar.gz |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
.qmake.conf
src/plugins/geoservices/geoservices.pro
Change-Id: Ie82dd22c588e5cba409fc1ef31a65968ce9f719b
Diffstat (limited to 'tests')
18 files changed, 99 insertions, 40 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index ba7dc523..5594b8b0 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -62,6 +62,9 @@ qtHaveModule(location) { declarative_geoshape !mac: SUBDIRS += declarative_ui + + # QTBUG-60268 + boot2qt: SUBDIRS -= declarative_ui } } diff --git a/tests/auto/declarative_geoshape/tst_locationsingleton.qml b/tests/auto/declarative_geoshape/tst_locationsingleton.qml index e38e4ec7..6ebee62a 100644 --- a/tests/auto/declarative_geoshape/tst_locationsingleton.qml +++ b/tests/auto/declarative_geoshape/tst_locationsingleton.qml @@ -71,6 +71,13 @@ Item { } } + property variant trace1 : [ QtPositioning.coordinate(43.773175, 11.255386), + QtPositioning.coordinate(43.773546 , 11.255372) ] + property variant trace2 : [ QtPositioning.coordinate(43.773175, 11.255386), + QtPositioning.coordinate(43.773546 , 11.255372), + QtPositioning.coordinate(43.77453 , 11.255734)] + + // coordinate unit square property variant bl: QtPositioning.coordinate(0, 0) property variant tl: QtPositioning.coordinate(1, 0) @@ -186,6 +193,28 @@ Item { rectangle = QtPositioning.shapeToRectangle(listBox) verify(rectangle.isValid) } + + function test_shape_path_conversions() { + var path = QtPositioning.shapeToPath(QtPositioning.shape()) + verify(!path.isValid) + path = QtPositioning.shapeToPath(QtPositioning.circle()) + verify(!path.isValid) + path = QtPositioning.shapeToPath(QtPositioning.circle(tl, 10000)) + verify(!path.isValid) + path = QtPositioning.shapeToPath(QtPositioning.rectangle()) + verify(!path.isValid) + path = QtPositioning.shapeToPath(QtPositioning.rectangle(tl, br)) + verify(!path.isValid) + + path = QtPositioning.shapeToPath(QtPositioning.path()) + verify(!path.isValid) + path = QtPositioning.shapeToPath(QtPositioning.path(trace1, 1)) + verify(path.isValid) + path = QtPositioning.shapeToPath(QtPositioning.path(trace2, 2)) + verify(path.isValid) + verify(path !== QtPositioning.shapeToPath(QtPositioning.path(trace1, 1))) + compare(path, QtPositioning.shapeToPath(QtPositioning.path(trace2, 2))) + } } diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml index 6691580e..846a621f 100644 --- a/tests/auto/declarative_ui/tst_map.qml +++ b/tests/auto/declarative_ui/tst_map.qml @@ -57,6 +57,14 @@ Item { property variant coordinate5: QtPositioning.coordinate(20, 180) property variant invalidCoordinate: QtPositioning.coordinate() property variant altitudelessCoordinate: QtPositioning.coordinate(50, 50) + property bool allMapsReady: mapZoomOnCompleted.mapReady + && mapZoomDefault.mapReady + && mapZoomUserInit.mapReady + && map.mapReady + && mapPar.mapReady + && coordinateMap.mapReady + && mapTiltBearing.mapReady + && mapTiltBearingHere.mapReady Map { id: mapZoomOnCompleted; width: 200; height: 200; zoomLevel: 3; center: coordinate1; plugin: testPlugin; @@ -98,7 +106,7 @@ Item { TestCase { - when: windowShown + when: windowShown && allMapsReady name: "MapProperties" function fuzzy_compare(val, ref) { diff --git a/tests/auto/declarative_ui/tst_map_coordinateanimation.qml b/tests/auto/declarative_ui/tst_map_coordinateanimation.qml index d9b71edd..20477509 100644 --- a/tests/auto/declarative_ui/tst_map_coordinateanimation.qml +++ b/tests/auto/declarative_ui/tst_map_coordinateanimation.qml @@ -79,7 +79,7 @@ Item { } TestCase { - when: windowShown + when: windowShown && map.mapReady name: "CoordinateAnimation" function test_coordinate_animation() { diff --git a/tests/auto/declarative_ui/tst_map_flick.qml b/tests/auto/declarative_ui/tst_map_flick.qml index 8da712b2..84ffa429 100644 --- a/tests/auto/declarative_ui/tst_map_flick.qml +++ b/tests/auto/declarative_ui/tst_map_flick.qml @@ -94,7 +94,7 @@ Item { SignalSpy {id: mouseAreaBottomSpy; target: mouseAreaBottom; signalName: 'onPressed'} TestCase { - when: windowShown + when: windowShown && map.mapReady name: "MapFlick" function init() diff --git a/tests/auto/declarative_ui/tst_map_item.qml b/tests/auto/declarative_ui/tst_map_item.qml index b75daf38..1646fdba 100644 --- a/tests/auto/declarative_ui/tst_map_item.qml +++ b/tests/auto/declarative_ui/tst_map_item.qml @@ -216,7 +216,7 @@ Item { } TestCase { name: "MapItems" - when: windowShown + when: windowShown && map.mapReady function initTestCase() { diff --git a/tests/auto/declarative_ui/tst_map_item_details.qml b/tests/auto/declarative_ui/tst_map_item_details.qml index 0c5f5c0b..80225c16 100644 --- a/tests/auto/declarative_ui/tst_map_item_details.qml +++ b/tests/auto/declarative_ui/tst_map_item_details.qml @@ -278,7 +278,7 @@ Item { TestCase { name: "MapItemDetails" - when: windowShown + when: windowShown && map.mapReady /* diff --git a/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml b/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml index 92b0bb6e..8d1ee42b 100644 --- a/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml +++ b/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml @@ -217,7 +217,7 @@ Item { TestCase { name: "MapItemsFitViewport" - when: windowShown + when: windowShown && map.mapReady function initTestCase() { diff --git a/tests/auto/declarative_ui/tst_map_itemview.qml b/tests/auto/declarative_ui/tst_map_itemview.qml index db788ace..bbd70c8e 100644 --- a/tests/auto/declarative_ui/tst_map_itemview.qml +++ b/tests/auto/declarative_ui/tst_map_itemview.qml @@ -40,6 +40,11 @@ Item { Plugin { id: testPlugin; name : "qmlgeo.test.plugin"; allowExperimental: true } property variant mapDefaultCenter: QtPositioning.coordinate(10, 30) + property bool allMapsReady: map.mapReady + && map3.mapReady + && mapForView.mapReady + && mapForTestingListModel.mapReady + && mapForTestingRouteModel.mapReady Map { id: map @@ -259,7 +264,7 @@ Item { TestCase { name: "MapItem" - when: windowShown + when: windowShown && allMapsReady function clear_data() { mapItemSpy.clear() } diff --git a/tests/auto/declarative_ui/tst_map_keepgrab.qml b/tests/auto/declarative_ui/tst_map_keepgrab.qml index fa47eec8..7690b78d 100644 --- a/tests/auto/declarative_ui/tst_map_keepgrab.qml +++ b/tests/auto/declarative_ui/tst_map_keepgrab.qml @@ -61,7 +61,7 @@ Item { TestCase { - when: windowShown + when: windowShown && map.mapReady name: "MapKeepGrabAndPreventSteal" function initTestCase() diff --git a/tests/auto/declarative_ui/tst_map_mouse.qml b/tests/auto/declarative_ui/tst_map_mouse.qml index 99aff03d..dd9de73a 100644 --- a/tests/auto/declarative_ui/tst_map_mouse.qml +++ b/tests/auto/declarative_ui/tst_map_mouse.qml @@ -161,7 +161,7 @@ Item { TestCase { name: "MouseArea" - when: windowShown + when: windowShown && map.mapReady SignalSpy {id: mouseUpperClickedSpy; target: mouseUpper; signalName: "clicked"} SignalSpy {id: mouseLowerClickedSpy; target: mouseLower; signalName: "clicked"} SignalSpy {id: mouseOverlapperClickedSpy; target: mouseOverlapper; signalName: "clicked"} diff --git a/tests/auto/declarative_ui/tst_map_pinch.qml.QTBUG-47970 b/tests/auto/declarative_ui/tst_map_pinch.qml.QTBUG-47970 index f80e44a1..6d913eab 100644 --- a/tests/auto/declarative_ui/tst_map_pinch.qml.QTBUG-47970 +++ b/tests/auto/declarative_ui/tst_map_pinch.qml.QTBUG-47970 @@ -102,7 +102,7 @@ Item { SignalSpy {id: mouseAreaBottomSpy; target: mouseAreaBottom; signalName: 'onPressed'} TestCase { - when: windowShown + when: windowShown && map.mapReady name: "MapPinch" function init() diff --git a/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h b/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h index df729392..5f6f0116 100644 --- a/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h +++ b/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h @@ -62,11 +62,12 @@ public: capabilities.setMaximumTilt(60); setTileSize(QSize(256, 256)); + const QByteArray pluginName = "qmlgeo.test.plugin"; 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); + mapTypes << QGeoMapType(QGeoMapType::StreetMap, tr("StreetMap"), tr("StreetMap"), false, false, 1, pluginName); + mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("SatelliteMapDay"), tr("SatelliteMapDay"), false, false, 2, pluginName); + mapTypes << QGeoMapType(QGeoMapType::CycleMap, tr("CycleMap"), tr("CycleMap"), false, false, 3, pluginName); + mapTypes << QGeoMapType(QGeoMapType::CustomMap, tr("AlternateCameraCapabilities"), tr("AlternateCameraCapabilities"), false, false, 4, pluginName); setSupportedMapTypes(mapTypes); QGeoTileFetcherTest *fetcher = new QGeoTileFetcherTest(this); @@ -86,14 +87,14 @@ public: setTileFetcher(fetcher); } - QGeoMap *createMap() + QGeoMap *createMap() override { return new QGeoTiledMapTest(this); } - QGeoCameraCapabilities cameraCapabilities(const QGeoMapType &mapType) const Q_DECL_OVERRIDE + QGeoCameraCapabilities cameraCapabilities(int mapId) const Q_DECL_OVERRIDE { - switch (mapType.mapId()) { + switch (mapId) { case 4: { QGeoCameraCapabilities capabilities; @@ -108,7 +109,7 @@ public: return capabilities; } default: - return QGeoMappingManagerEngine::cameraCapabilities(mapType); + return QGeoMappingManagerEngine::cameraCapabilities(mapId); } } diff --git a/tests/auto/geotestplugin/qgeotilefetcher_test.h b/tests/auto/geotestplugin/qgeotilefetcher_test.h index a25b0119..e108f484 100644 --- a/tests/auto/geotestplugin/qgeotilefetcher_test.h +++ b/tests/auto/geotestplugin/qgeotilefetcher_test.h @@ -32,6 +32,7 @@ #include <QtLocation/private/qgeotiledmapreply_p.h> #include <QtLocation/private/qgeotilefetcher_p.h> #include <QtLocation/private/qgeotilespec_p.h> +#include <QtLocation/private/qgeomappingmanagerengine_p.h> #include <QLocale> #include <QPainter> @@ -65,7 +66,7 @@ class QGeoTileFetcherTest: public QGeoTileFetcher { Q_OBJECT public: - QGeoTileFetcherTest(QObject *parent = 0) + QGeoTileFetcherTest(QGeoMappingManagerEngine *parent) : QGeoTileFetcher(parent), finishRequestImmediately_(false), errorCode_(QGeoTiledMapReply::NoError) { } diff --git a/tests/auto/maptype/tst_maptype.cpp b/tests/auto/maptype/tst_maptype.cpp index 9b7956fd..43d3175c 100644 --- a/tests/auto/maptype/tst_maptype.cpp +++ b/tests/auto/maptype/tst_maptype.cpp @@ -52,8 +52,9 @@ tst_MapType::tst_MapType() {} void tst_MapType::constructorTest() { + const QByteArray pluginName = "tst_MapType"; QGeoMapType *testObjPtr = new QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street map"), - QStringLiteral("map description"), true, true, 1); + QStringLiteral("map description"), true, true, 1, pluginName); QVERIFY(testObjPtr); QCOMPARE(testObjPtr->style(), QGeoMapType::StreetMap); QCOMPARE(testObjPtr->name(), QStringLiteral("street map")); @@ -61,6 +62,7 @@ void tst_MapType::constructorTest() QVERIFY(testObjPtr->mobile()); QVERIFY(testObjPtr->night()); QCOMPARE(testObjPtr->mapId(), 1); + QCOMPARE(testObjPtr->pluginName(), pluginName); delete testObjPtr; testObjPtr = new QGeoMapType(); @@ -70,6 +72,7 @@ void tst_MapType::constructorTest() QVERIFY2(!testObjPtr->mobile(), "Wrong default value"); QVERIFY2(!testObjPtr->night(), "Wrong default value"); QCOMPARE(testObjPtr->mapId(), 0); + QCOMPARE(testObjPtr->pluginName(), QByteArrayLiteral("")); delete testObjPtr; } @@ -79,50 +82,58 @@ void tst_MapType::comparison_data() QTest::addColumn<QGeoMapType>("type2"); QTest::addColumn<bool>("expected"); + const QByteArray pluginName = "tst_MapType"; + QTest::newRow("null") << QGeoMapType() << QGeoMapType() << true; QTest::newRow("equal") << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), - QStringLiteral("street desc"), false, false, 42) + QStringLiteral("street desc"), false, false, 42, pluginName) << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), - QStringLiteral("street desc"), false, false, 42) + QStringLiteral("street desc"), false, false, 42, pluginName) << true; QTest::newRow("style") << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), - QStringLiteral("street desc"), false, false, 42) + QStringLiteral("street desc"), false, false, 42, pluginName) << QGeoMapType(QGeoMapType::TerrainMap, QStringLiteral("street name"), - QStringLiteral("street desc"), false, false, 42) + QStringLiteral("street desc"), false, false, 42, pluginName) << false; QTest::newRow("name") << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), - QStringLiteral("street desc"), false, false, 42) + QStringLiteral("street desc"), false, false, 42, pluginName) << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("different name"), - QStringLiteral("street desc"), false, false, 42) + QStringLiteral("street desc"), false, false, 42, pluginName) << false; QTest::newRow("description") << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), - QStringLiteral("street desc"), false, false, 42) + QStringLiteral("street desc"), false, false, 42, pluginName) << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), - QStringLiteral("different desc"), false, false, 42) + QStringLiteral("different desc"), false, false, 42, pluginName) << false; QTest::newRow("mobile") << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), - QStringLiteral("street desc"), false, false, 42) + QStringLiteral("street desc"), false, false, 42, pluginName) << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), - QStringLiteral("street desc"), true, false, 42) + QStringLiteral("street desc"), true, false, 42, pluginName) << false; QTest::newRow("night") << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), - QStringLiteral("street desc"), false, false, 42) + QStringLiteral("street desc"), false, false, 42, pluginName) << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), - QStringLiteral("street desc"), false, true, 42) + QStringLiteral("street desc"), false, true, 42, pluginName) << false; QTest::newRow("id") << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), - QStringLiteral("street desc"), false, false, 42) + QStringLiteral("street desc"), false, false, 42, pluginName) + << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), + QStringLiteral("street desc"), false, false, 99, pluginName) + << false; + + QTest::newRow("plugin_name") << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), + QStringLiteral("street desc"), false, false, 42, pluginName) << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street name"), - QStringLiteral("street desc"), false, false, 99) + QStringLiteral("street desc"), false, false, 42, QByteArrayLiteral("abc")) << false; } diff --git a/tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp b/tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp index 1ac0abfa..0c664ba6 100644 --- a/tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp +++ b/tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp @@ -150,7 +150,7 @@ void tst_QGeoCameraTiles::tilesPlugin() ct.setTileSize(16); ct.setCameraData(camera); ct.setScreenSize(QSize(32, 32)); - ct.setMapType(QGeoMapType(QGeoMapType::StreetMap, "street map", "street map", false, false, 1)); + ct.setMapType(QGeoMapType(QGeoMapType::StreetMap, "street map", "street map", false, false, 1, QByteArrayLiteral(""))); QSet<QGeoTileSpec> tiles1 = ct.createTiles(); @@ -202,7 +202,7 @@ void tst_QGeoCameraTiles::tilesMapType() QSet<QGeoTileSpec> tiles1 = ct.createTiles(); - QGeoMapType mapType1 = QGeoMapType(QGeoMapType::StreetMap, "street map", "street map", false, false, 1); + QGeoMapType mapType1 = QGeoMapType(QGeoMapType::StreetMap, "street map", "street map", false, false, 1, QByteArrayLiteral("")); ct.setMapType(mapType1); QSet<QGeoTileSpec> tiles2 = ct.createTiles(); @@ -220,7 +220,7 @@ void tst_QGeoCameraTiles::tilesMapType() QCOMPARE(tiles2, tiles2_check); - QGeoMapType mapType2 = QGeoMapType(QGeoMapType::StreetMap, "satellite map", "satellite map", false, false, 2); + QGeoMapType mapType2 = QGeoMapType(QGeoMapType::StreetMap, "satellite map", "satellite map", false, false, 2, QByteArrayLiteral("")); ct.setMapType(mapType2); QSet<QGeoTileSpec> tiles3 = ct.createTiles(); diff --git a/tests/auto/qgeopath/tst_qgeopath.cpp b/tests/auto/qgeopath/tst_qgeopath.cpp index 8c4ac767..9244394a 100644 --- a/tests/auto/qgeopath/tst_qgeopath.cpp +++ b/tests/auto/qgeopath/tst_qgeopath.cpp @@ -275,8 +275,8 @@ void tst_QGeoPath::contains_data() c.append(QGeoCoordinate(3,0)); QTest::newRow("One of the points") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(2, 2) << true; - QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(0, 0) << false; - QTest::newRow("Not so far away and large line") << c[0] << c[1] << c[2] << 100000.0 << QGeoCoordinate(0, 0) << true; + QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(0.8, 0.8) << false; + QTest::newRow("Not so far away and large line") << c[0] << c[1] << c[2] << 100000.0 << QGeoCoordinate(0.8, 0.8) << true; } void tst_QGeoPath::contains() @@ -378,7 +378,7 @@ void tst_QGeoPath::extendShape_data() QTest::newRow("One of the points") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(2, 2) << true << true; QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(0, 0) << false << true; - QTest::newRow("Not so far away and large line") << c[0] << c[1] << c[2] << 100000.0 << QGeoCoordinate(0, 0) << true << true; + QTest::newRow("Not so far away and large line") << c[0] << c[1] << c[2] << 100000.0 << QGeoCoordinate(0.8, 0.8) << true << true; } QTEST_MAIN(tst_QGeoPath) diff --git a/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp b/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp index 3026cd92..b8866b48 100644 --- a/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp +++ b/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp @@ -218,6 +218,7 @@ void QDeclarativePinchGenerator::itemChange(ItemChange change, const ItemChangeD void QDeclarativePinchGenerator::timerEvent(QTimerEvent *event) { Q_ASSERT(replayTimer_ == event->timerId()); + Q_UNUSED(event); Q_ASSERT(state_ == Replaying); int slaveSwipe = masterSwipe_ ^ 1; |