From cc02a7a580968125717fe682c738a2dfc7adc471 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 28 Apr 2016 16:03:40 +0200 Subject: A new QGeoPositionInfoSourceCL should be initialized with NoError. Change-Id: Ide4ccacd9d7d6a8fe86d190723fcd94ddab9f6d6 Task-number: QTBUG-53059 Reviewed-by: Alex Blasche --- src/plugins/position/corelocation/qgeopositioninfosource_cl.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm b/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm index 0e5e261b..07b595eb 100644 --- a/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm +++ b/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm @@ -103,7 +103,7 @@ QGeoPositionInfoSourceCL::QGeoPositionInfoSourceCL(QObject *parent) , m_started(false) , m_updateTimer(0) , m_updateTimeout(0) - , m_positionError(QGeoPositionInfoSource::UnknownSourceError) + , m_positionError(QGeoPositionInfoSource::NoError) { } -- cgit v1.2.3 From 683b36f957d10e1282b81247681f81f49f46e2d2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 20 Apr 2016 20:43:56 +0200 Subject: fix example installs Change-Id: Ie482e84b0552608239a032ec95b44665997a0c01 Reviewed-by: Alex Blasche --- examples/positioning/geoflickr/geoflickr.pro | 2 +- examples/positioning/satelliteinfo/satelliteinfo.pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/positioning/geoflickr/geoflickr.pro b/examples/positioning/geoflickr/geoflickr.pro index 97e8b57f..4bbb7959 100644 --- a/examples/positioning/geoflickr/geoflickr.pro +++ b/examples/positioning/geoflickr/geoflickr.pro @@ -11,5 +11,5 @@ OTHER_FILES += flickr.qml \ flickrcommon/* \ flickrmobile/* -target.path = $$[QT_INSTALL_EXAMPLES]/positioning/flickr +target.path = $$[QT_INSTALL_EXAMPLES]/positioning/geoflickr INSTALLS += target diff --git a/examples/positioning/satelliteinfo/satelliteinfo.pro b/examples/positioning/satelliteinfo/satelliteinfo.pro index fe4f728e..4aef9d0e 100644 --- a/examples/positioning/satelliteinfo/satelliteinfo.pro +++ b/examples/positioning/satelliteinfo/satelliteinfo.pro @@ -15,7 +15,7 @@ OTHER_FILES += \ RESOURCES += \ satelliteinfo.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtpositioning/satelliteinfo +target.path = $$[QT_INSTALL_EXAMPLES]/positioning/satelliteinfo INSTALLS += target -- cgit v1.2.3 From e4d81901b3dcbd6ce4a9ea4fc4bd32d75d9e0aef Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 22 Apr 2016 20:54:25 +0200 Subject: make use of COPIES Change-Id: Ie1fe505d7b07a66e41ed7968275feaa98abe46d2 Reviewed-by: Joerg Bornemann --- tests/plugins/imports.pri | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/plugins/imports.pri b/tests/plugins/imports.pri index e7ff1d42..00f93330 100644 --- a/tests/plugins/imports.pri +++ b/tests/plugins/imports.pri @@ -1,8 +1,5 @@ !contains(DESTDIR, $$[QT_INSTALL_QML]/$$TARGETPATH) { - copyimportfiles.input = IMPORT_FILES - copyimportfiles.output = $$DESTDIR/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT} - copyimportfiles.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} - copyimportfiles.CONFIG += no_link_no_clean - copyimportfiles.variable_out = PRE_TARGETDEPS - QMAKE_EXTRA_COMPILERS += copyimportfiles + importfiles.files = $$IMPORT_FILES + importfiles.path = $$DESTDIR + COPIES += importfiles } -- cgit v1.2.3 From f95a7f44afa0c0fe3c3a3edb498f2d8281ff22e7 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Fri, 29 Apr 2016 09:30:22 +0200 Subject: Map.copyrightsVisible is a new property since 5.7 Mark it accordingly in the documentation Change-Id: Ia5a57fe0bdf290deb39ef914d4e23cf646a06848 Reviewed-by: Sami Makkonen Reviewed-by: Leena Miettinen --- src/imports/location/qdeclarativegeomap.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp index c72e5666..a685a0f7 100644 --- a/src/imports/location/qdeclarativegeomap.cpp +++ b/src/imports/location/qdeclarativegeomap.cpp @@ -799,6 +799,8 @@ QGeoShape QDeclarativeGeoMap::visibleRegion() const \note Many map providers require the notice to be visible as part of the terms and conditions. Please consult the relevant provider documentation before turning this notice off. + + \since 5.7 */ void QDeclarativeGeoMap::setCopyrightsVisible(bool visible) { -- cgit v1.2.3 From 15ae3f80592d64aa27d5774b2496c33f4ae4cce0 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Fri, 29 Apr 2016 11:24:38 +0200 Subject: Update QML version to 5.7 for QtPositioning and QtLocation Change-Id: Ibbd06c3bc6c2c745a8e2fc6ee12a974bb40bf80a Reviewed-by: Laszlo Agocs --- src/imports/location/location.cpp | 6 +++--- src/imports/location/plugins.qmltypes | 14 +++++++++++--- src/imports/positioning/plugins.qmltypes | 4 ++-- src/imports/positioning/positioning.cpp | 2 +- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp index f299d153..b42933f0 100644 --- a/src/imports/location/location.cpp +++ b/src/imports/location/location.cpp @@ -153,9 +153,6 @@ public: // Introduction of 5.3 version; existing 5.0 exports automatically become available under 5.3 as well // 5.3 is committed QML API despite missing release of QtLocation 5.3 - // Register the 5.5 types - // Implicitly registers 5.3 & 5.4 - minor = 5; //TODO: this is broken QTBUG-50990 qmlRegisterUncreatableType(uri, major, minor, "MapType", @@ -165,6 +162,9 @@ public: qmlRegisterUncreatableType(uri, major, minor, "MapGestureArea", QStringLiteral("(Map)GestureArea is not intended instantiable by developer.")); + // Register the 5.7 types + minor = 7; + qmlRegisterType(uri, major, minor, "RouteManeuver"); //registrations below are version independent qRegisterMetaType(); diff --git a/src/imports/location/plugins.qmltypes b/src/imports/location/plugins.qmltypes index 61a1cd28..4e8749da 100644 --- a/src/imports/location/plugins.qmltypes +++ b/src/imports/location/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable QtLocation 5.6' +// 'qmlplugindump -nonrelocatable QtLocation 5.7' Module { dependencies: ["QtQuick 2.0"] @@ -93,8 +93,11 @@ Module { Component { name: "QDeclarativeGeoManeuver" prototype: "QObject" - exports: ["QtLocation/RouteManeuver 5.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtLocation/RouteManeuver 5.0", + "QtLocation/RouteManeuver 5.7" + ] + exportMetaObjectRevisions: [0, 0] Enum { name: "Direction" values: { @@ -144,6 +147,7 @@ Module { Property { name: "error"; type: "QGeoServiceProvider::Error"; isReadonly: true } Property { name: "errorString"; type: "string"; isReadonly: true } Property { name: "visibleRegion"; type: "QGeoShape" } + Property { name: "copyrightsVisible"; type: "bool" } Property { name: "color"; type: "QColor" } Signal { name: "pluginChanged" @@ -161,6 +165,10 @@ Module { name: "copyrightLinkActivated" Parameter { name: "link"; type: "string" } } + Signal { + name: "copyrightsVisibleChanged" + Parameter { name: "visible"; type: "bool" } + } Signal { name: "colorChanged" Parameter { name: "color"; type: "QColor" } diff --git a/src/imports/positioning/plugins.qmltypes b/src/imports/positioning/plugins.qmltypes index c3451c2a..55fcbba2 100644 --- a/src/imports/positioning/plugins.qmltypes +++ b/src/imports/positioning/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable QtPositioning 5.6' +// 'qmlplugindump -nonrelocatable QtPositioning 5.7' Module { dependencies: ["QtQuick 2.0"] @@ -106,7 +106,7 @@ Module { "QtPositioning/Position 5.0", "QtPositioning/Position 5.3", "QtPositioning/Position 5.4", - "QtPositioning/Position 5.6" + "QtPositioning/Position 5.7" ] exportMetaObjectRevisions: [0, 1, 2, 2] Property { name: "latitudeValid"; type: "bool"; isReadonly: true } diff --git a/src/imports/positioning/positioning.cpp b/src/imports/positioning/positioning.cpp index 8a4fef47..5137da22 100644 --- a/src/imports/positioning/positioning.cpp +++ b/src/imports/positioning/positioning.cpp @@ -553,7 +553,7 @@ public: minor = 4; qmlRegisterType(uri, major, minor, "Position"); - minor = 6; + minor = 7; qmlRegisterType(uri, major, minor, "Position"); } else { qDebug() << "Unsupported URI given to load positioning QML plugin: " << QLatin1String(uri); -- cgit v1.2.3 From 5dcd3d8526c7b8c7ac59a743f82130008d254d14 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 3 May 2016 19:44:46 +0200 Subject: decruft project file the "created by qt creator" header is not supposed to be checked in. Change-Id: Ib5cc25c57d3d096f818d67169ec98c9f3cb75c47 Reviewed-by: Joerg Bornemann --- tests/auto/qmlinterface/qmlinterface.pro | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/auto/qmlinterface/qmlinterface.pro b/tests/auto/qmlinterface/qmlinterface.pro index 882ef737..dbe3f7d9 100644 --- a/tests/auto/qmlinterface/qmlinterface.pro +++ b/tests/auto/qmlinterface/qmlinterface.pro @@ -1,9 +1,3 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2011-11-09T15:45:51 -# -#------------------------------------------------- - QT += location qml testlib #QT -= gui -- cgit v1.2.3 From 761331ddc841809a4bdc6ca2f2b84c148cb9b19a Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 10 May 2016 15:04:45 +0200 Subject: Fix build c6c0d730b7a88fa22f40d597183e91b73d9d165d in qtdeclarative changed private API. Hence adapt to those changes. Change-Id: I6acd948b0a1257e8836d5e5f6ebfd3b4b6d8e07b Reviewed-by: Erik Verbruggen --- src/imports/location/qdeclarativegeomapcopyrightsnotice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imports/location/qdeclarativegeomapcopyrightsnotice.cpp b/src/imports/location/qdeclarativegeomapcopyrightsnotice.cpp index 8e0f3b1e..289ea3d9 100644 --- a/src/imports/location/qdeclarativegeomapcopyrightsnotice.cpp +++ b/src/imports/location/qdeclarativegeomapcopyrightsnotice.cpp @@ -50,8 +50,8 @@ QDeclarativeGeoMapCopyrightNotice::QDeclarativeGeoMapCopyrightNotice(QQuickItem { QQuickAnchors *anchors = property("anchors").value(); if (anchors) { - anchors->setLeft(QQuickAnchorLine(parent, QQuickAnchorLine::Left)); - anchors->setBottom(QQuickAnchorLine(parent, QQuickAnchorLine::Bottom)); + anchors->setLeft(QQuickAnchorLine(parent, QQuickAnchors::LeftAnchor)); + anchors->setBottom(QQuickAnchorLine(parent, QQuickAnchors::BottomAnchor)); } } -- cgit v1.2.3 From ee6a7e5da5f2f7423beeb9de8150ae1be3a7b309 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 18 May 2016 09:53:04 +0200 Subject: Windows: Skip flaky tests in declarative_ui. Task-number: QTBUG-53455 Change-Id: Ib65496de7e59341fe4ed8a443aed10fe4b2a63d4 Reviewed-by: Liang Qi Reviewed-by: Alex Blasche --- tests/auto/declarative_ui/tst_map_item_details.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/declarative_ui/tst_map_item_details.qml b/tests/auto/declarative_ui/tst_map_item_details.qml index 20849079..b29b3a82 100644 --- a/tests/auto/declarative_ui/tst_map_item_details.qml +++ b/tests/auto/declarative_ui/tst_map_item_details.qml @@ -412,6 +412,8 @@ Item { */ function test_yz_dateline() { + if (Qt.platform.os === "windows") + skip("QTBUG-53455"); map.clearMapItems() clear_data() map.center = datelineCoordinate @@ -593,6 +595,8 @@ Item { */ function test_zz_border_drag() { + if (Qt.platform.os === "windows") + skip("QTBUG-53455"); map.clearMapItems() clear_data() map.center = datelineCoordinate -- cgit v1.2.3 From 95aba99a384728c9deaa349929508bcafb898505 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 10 May 2016 14:54:27 +0200 Subject: Doc: Remove repository name from examplesinstallpath Examples in binary packages now directly match the install path. Change-Id: I9315d395c4546adfa58e264f66d98fb443ab1e72 Task-number: QTBUG-52953 Reviewed-by: Antti Kokko --- src/location/doc/qtlocation.qdocconf | 2 +- src/positioning/doc/qtpositioning.qdocconf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/location/doc/qtlocation.qdocconf b/src/location/doc/qtlocation.qdocconf index abe48974..695860a0 100644 --- a/src/location/doc/qtlocation.qdocconf +++ b/src/location/doc/qtlocation.qdocconf @@ -41,7 +41,7 @@ sourcedirs += .. \ ../../imports/location \ ../../plugins/geoservices/nokia -examplesinstallpath = qtlocation/location +examplesinstallpath = location exampledirs += ../../../examples/location \ snippets/ diff --git a/src/positioning/doc/qtpositioning.qdocconf b/src/positioning/doc/qtpositioning.qdocconf index 1645c092..608b30a1 100644 --- a/src/positioning/doc/qtpositioning.qdocconf +++ b/src/positioning/doc/qtpositioning.qdocconf @@ -40,7 +40,7 @@ headerdirs += .. \ sourcedirs += .. \ ../../imports/positioning -examplesinstallpath = qtlocation/positioning +examplesinstallpath = positioning exampledirs += ../../../examples/positioning \ snippets/ -- cgit v1.2.3 From 1ca6bf3bdef8c95e12a5ee93ed69e4983a1df017 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 17 May 2016 11:01:39 +0200 Subject: winrt: Enable compilation with desktop mkspec The GeoPosition API is functional for desktop builds as well, running on Windows 8 and later. While the plugin builds for desktop, do not enable its compilation by default as support is experimental. Change-Id: I5ccd3f857ff3f0cfd1e220875c39883b89f5f2ce Reviewed-by: Friedemann Kleint Reviewed-by: Oliver Wolff Reviewed-by: Alex Blasche --- .../position/winrt/qgeopositioninfosource_winrt.cpp | 14 +++++++++++++- src/plugins/position/winrt/winrt.pro | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp b/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp index 5dbbacb5..245d855e 100644 --- a/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp +++ b/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp @@ -39,7 +39,9 @@ #include #include #include +#ifdef Q_OS_WINRT #include +#endif #include #include @@ -64,6 +66,16 @@ QT_BEGIN_NAMESPACE Q_DECLARE_METATYPE(QGeoPositionInfo) +#ifndef Q_OS_WINRT +namespace QEventDispatcherWinRT { +HRESULT runOnXamlThread(const std::function &delegate, bool waitForRun = true) +{ + Q_UNUSED(waitForRun); + return delegate(); +} +} +#endif + class QGeoPositionInfoSourceWinRTPrivate { public: ComPtr locator; @@ -490,7 +502,7 @@ HRESULT QGeoPositionInfoSourceWinRT::onStatusChanged(IGeolocator*, IStatusChange bool QGeoPositionInfoSourceWinRT::requestAccess() const { -#if _MSC_VER >= 1900 +#if _MSC_VER >= 1900 && defined(Q_OS_WINRT) static GeolocationAccessStatus accessStatus = GeolocationAccessStatus_Unspecified; static ComPtr statics; diff --git a/src/plugins/position/winrt/winrt.pro b/src/plugins/position/winrt/winrt.pro index bc740671..5e02ec9a 100644 --- a/src/plugins/position/winrt/winrt.pro +++ b/src/plugins/position/winrt/winrt.pro @@ -12,4 +12,5 @@ OTHER_FILES += \ PLUGIN_TYPE = position PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryWinRT +win32-msvc201*: LIBS += runtimeobject.lib load(qt_plugin) -- cgit v1.2.3 From 24b373f7fabb6263648324304e9d98a4838eedd7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 19 May 2016 13:26:55 +0200 Subject: Bump version Change-Id: I883d4601a05a9e07b101af10c1301e77085966b6 --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 9450b838..4d3d5bff 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,4 +1,4 @@ load(qt_build_config) CONFIG += qt_example_installs -MODULE_VERSION = 5.6.1 +MODULE_VERSION = 5.6.2 -- cgit v1.2.3 From d1b708cde9428928b9f5c59c099f2deb584efd5f Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Fri, 20 May 2016 10:29:17 +0200 Subject: Add change log for 5.7.0 release Change-Id: I8050c15aaea19f79d39f8b177b1f5aff87d61129 Reviewed-by: Maurice Kalinowski --- dist/changes-5.7.0 | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 dist/changes-5.7.0 diff --git a/dist/changes-5.7.0 b/dist/changes-5.7.0 new file mode 100644 index 00000000..23947c4e --- /dev/null +++ b/dist/changes-5.7.0 @@ -0,0 +1,37 @@ +Qt 5.7 introduces many new features and improvements as well as bugfixes +over the 5.6.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + + http://doc.qt.io/qt-5/index.html + +The Qt version 5.7 series is binary compatible with the 5.6.x series. +Applications compiled for 5.6 will continue to run with 5.7. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Library * +**************************************************************************** + +QtPositioning +------------- + + - Added support for tvOs to iOS/OS X positioning engine + - Added qHash() function for QGeoCoordinate + - Fixed negative QGeoCoordinate.azimuthTo results + - Added experimental support for GeoPosition API on Windows desktop + running Windows 8 or later + +QtLocation +---------- + + - [QTBUG-47025] Added option to hide map data copyright information + - Adjusted minimum map zoom level to prevent gray bounds. It prevents the map + from being smaller than the canvas size. + - Fixed several internal performance issues -- cgit v1.2.3 From 59a419adbdb02eaa19c0a716a79ba78b8ff465e6 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Fri, 20 May 2016 15:42:42 +0200 Subject: QtLocation autotest fix Apparently this test passed until now for mysterious reasons Change-Id: I9597c13bc7b3d8fee148d6e1095b7a09ea3b37dc Reviewed-by: Alex Blasche --- tests/auto/declarative_geoshape/tst_locationsingleton.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative_geoshape/tst_locationsingleton.qml b/tests/auto/declarative_geoshape/tst_locationsingleton.qml index 5e37d9eb..933517b1 100644 --- a/tests/auto/declarative_geoshape/tst_locationsingleton.qml +++ b/tests/auto/declarative_geoshape/tst_locationsingleton.qml @@ -209,7 +209,7 @@ Item { function test_path_operations() { compare(mapPolyline.path[1].latitude, -27) compare(mapPolyline.path[1].longitude, 154.1) - compare(mapPolyline.coordinateAt(1), QtPositioning.coordinate(27, 154.1)) + compare(mapPolyline.coordinateAt(1), QtPositioning.coordinate(-27, 154.1)) compare(mapPolyline.path.length, mapPolyline.pathLength()) mapPolyline.removeCoordinate(1); -- cgit v1.2.3 From 55414e7ff710b5ca43f248d0609a15fc6cbe24ff Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 20 Apr 2016 21:23:03 +0200 Subject: do not enable example installs explicitly any more it's done centrally now. Change-Id: Idbf9bf3cf304240ef6c28217199b2a32c68d581d Reviewed-by: Alex Blasche --- .qmake.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 4d3d5bff..21c63db3 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,4 +1,3 @@ load(qt_build_config) -CONFIG += qt_example_installs MODULE_VERSION = 5.6.2 -- cgit v1.2.3 From f897775850dfbe0e668e9c8b428537e8bb096c01 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 23 May 2016 19:15:10 +0200 Subject: Replace waitForRendering calls in qml unit tests Changes eea315187d1add70aaf69745c031b8d6342b2303 moved map items final position calculation to "polish" call of sg. In unit testing "waitForRendering" was introduced to sync between input events processing and items being polished. Unfortunately this approach is race condition prone, since render can run in separate thread and frame swapped signals are emitted from render thread. Replace waitForRendering with waitForPolished instead. Improve test execution by providing init() and intTestCase() functions for map items unit tests, so test can be run "out of order" manner. Add missing namespace macros for location test qml plugin. Task-number: QTBUG-31797 Task-number: QTBUG-53455 Change-Id: Iec083143ae621e5be603d03f43d6ef260b056d0f Reviewed-by: Paolo Angelelli Reviewed-by: Simon Hausmann Reviewed-by: Alex Blasche --- tests/auto/declarative_ui/tst_map_flick.qml | 1 - tests/auto/declarative_ui/tst_map_item.qml | 176 ++++++++++----------- tests/auto/declarative_ui/tst_map_item_details.qml | 88 +++++------ .../declarative_ui/tst_map_item_fit_viewport.qml | 2 - .../declarativetestplugin.pro | 16 +- .../plugins/declarativetestplugin/locationtest.cpp | 10 ++ .../qdeclarativelocationtestmodel.cpp | 4 + .../qdeclarativelocationtestmodel_p.h | 4 + .../qdeclarativepinchgenerator.cpp | 4 + .../qdeclarativepinchgenerator_p.h | 4 + tests/plugins/declarativetestplugin/testhelper.h | 58 +++++++ 11 files changed, 215 insertions(+), 152 deletions(-) create mode 100644 tests/plugins/declarativetestplugin/testhelper.h diff --git a/tests/auto/declarative_ui/tst_map_flick.qml b/tests/auto/declarative_ui/tst_map_flick.qml index e225480d..4094a7c7 100644 --- a/tests/auto/declarative_ui/tst_map_flick.qml +++ b/tests/auto/declarative_ui/tst_map_flick.qml @@ -288,7 +288,6 @@ Item { { map.center.latitude = 50 map.center.longitude = 50 - waitForRendering(map) mousePress(page, 0, 0) for (var i = 0; i < 50; i += 5) { wait(20) diff --git a/tests/auto/declarative_ui/tst_map_item.qml b/tests/auto/declarative_ui/tst_map_item.qml index 5be8896f..09657f78 100644 --- a/tests/auto/declarative_ui/tst_map_item.qml +++ b/tests/auto/declarative_ui/tst_map_item.qml @@ -35,6 +35,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtLocation 5.6 import QtPositioning 5.5 +import QtLocation.Test 5.6 /* @@ -67,7 +68,6 @@ Item { height: 240 Plugin { id: testPlugin; name : "qmlgeo.test.plugin"; allowExperimental: true } - property variant mapDefaultCenter: QtPositioning.coordinate(20, 20) property variant someCoordinate1: QtPositioning.coordinate(15, 15) property variant someCoordinate2: QtPositioning.coordinate(16, 16) @@ -115,21 +115,10 @@ Item { id: map; x: 20; y: 20; width: 200; height: 200 zoomLevel: 9 - center: mapDefaultCenter plugin: testPlugin; MapRectangle { id: preMapRect - color: 'darkcyan' - border.width: 0 - topLeft { - latitude: 20 - longitude: 20 - } - bottomRight { - latitude: 10 - longitude: 30 - } MouseArea { id: preMapRectMa anchors.fill: parent @@ -144,13 +133,6 @@ Item { } MapCircle { id: preMapCircle - color: 'darkmagenta' - border.width: 0 - center { - latitude: 10 - longitude: 30 - } - radius: 10000 MouseArea { id: preMapCircleMa anchors.fill: parent @@ -175,11 +157,8 @@ Item { SignalSpy { id: preMapQuickItemClicked; target: parent; signalName: "clicked" } SignalSpy { id: preMapQuickItemActiveChanged; target: parent.drag; signalName: "activeChanged" } } - coordinate { - latitude: 35 - longitude: 3 - } sourceItem: Rectangle { + id: preMapQuickItemSource color: 'darkgreen' width: 20 height: 20 @@ -240,21 +219,69 @@ Item { name: "MapItems" when: windowShown - function test_aa_items_on_map() { // aa et al. for execution order - wait(10) + function initTestCase() + { // sanity check that the coordinate conversion works, as // rest of the case relies on it. for robustness cut // a little slack with fuzzy compare var mapcenter = map.fromCoordinate(map.center) verify (fuzzy_compare(mapcenter.x, 100, 2)) verify (fuzzy_compare(mapcenter.y, 100, 2)) + } - // precondition - compare(preMapRectClicked.count, 0) - compare(preMapCircleClicked.count, 0) + function init() + { + map.center = QtPositioning.coordinate(20, 20) + preMapCircle.center = QtPositioning.coordinate(10,30) + preMapCircle.border.width = 0 + preMapCircle.color = 'red' + preMapCircle.radius = 10000 + preMapCircleClicked.clear() + preMapCircleCenterChanged.clear() + preMapCircleColorChanged.clear() + preMapCircleRadiusChanged.clear() + preMapCircleBorderColorChanged.clear() + preMapCircleBorderWidthChanged.clear() + + preMapRect.color = 'red' + preMapRect.border.width = 0 + preMapRect.topLeft = QtPositioning.coordinate(20, 20) + preMapRect.bottomRight = QtPositioning.coordinate(10, 30) + preMapRectTopLeftChanged.clear() + preMapRectBottomRightChanged.clear() + preMapRectColorChanged.clear() + preMapRectClicked.clear() + preMapRectActiveChanged.clear() + + preMapQuickItem.sourceItem = preMapQuickItemSource + preMapQuickItem.zoomLevel = 0 + preMapQuickItem.coordinate = QtPositioning.coordinate(35, 3) + preMapQuickItemClicked.clear() + preMapQuickItem.anchorPoint = Qt.point(0,0) + preMapQuickItemCoordinateChanged.clear() + preMapQuickItemAnchorPointChanged.clear() + preMapQuickItemZoomLevelChanged.clear() + preMapQuickItemSourceItemChanged.clear() + + preMapPolygonClicked.clear() + preMapPolylineColorChanged.clear() + preMapPolylineWidthChanged.clear() + preMapPolylinePathChanged.clear() + preMapPolygonPathChanged.clear() + preMapPolygonColorChanged.clear() + preMapPolygonBorderColorChanged.clear() + preMapPolygonBorderWidthChanged.clear() + preMapRouteRouteChanged.clear() + preMapRouteLineColorChanged.clear() + preMapRouteLineWidthChanged.clear() + verify(LocationTestHelper.waitForPolished(map)) + } + function test_items_on_map() + { // click rect map.center = preMapRect.topLeft + verify(LocationTestHelper.waitForPolished(map)) var point = map.fromCoordinate(preMapRect.topLeft) mouseClick(map, point.x + 5, point.y + 5) tryCompare(preMapRectClicked, "count", 1) @@ -264,11 +291,11 @@ Item { // click circle, overlaps and is above rect map.center = preMapCircle.center - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(preMapCircle.center) mouseClick(map, point.x - 5, point.y - 5) - tryCompare(preMapRectClicked, "count", 1) - compare(preMapCircleClicked.count, 1) + tryCompare(preMapCircleClicked, "count", 1) + compare(preMapRectClicked.count, 1) // click within circle bounding rect but not inside the circle geometry map.center = preMapCircle.center.atDistanceAndAzimuth(preMapCircle.radius, -45) @@ -279,7 +306,7 @@ Item { // click quick item compare(preMapQuickItemClicked.count, 0) map.center = preMapQuickItem.coordinate - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(preMapQuickItem.coordinate) mouseClick(map, point.x + 5, point.y + 5) tryCompare(preMapQuickItemClicked, "count", 1) @@ -287,20 +314,22 @@ Item { // click polygon compare (preMapPolygonClicked.count, 0) map.center = preMapPolygon.path[1] - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(preMapPolygon.path[1]) mouseClick(map, point.x - 5, point.y) tryCompare(preMapPolygonClicked, "count", 1) + } + function test_no_items_on_map() + { // remove items and repeat clicks to verify they are gone map.clearMapItems() - clear_data() compare (map.mapItems.length, 0) map.center = preMapRect.topLeft - point = map.fromCoordinate(preMapRect.topLeft) + var point = map.fromCoordinate(preMapRect.topLeft) mouseClick(map, point.x + 5, point.y + 5) compare(preMapRectClicked.count, 0) - visualInspectionPoint() + verify(LocationTestHelper.waitForPolished(map)) map.center = preMapCircle.center point = map.fromCoordinate(preMapCircle.center) mouseClick(map, point.x - 5, point.y - 5) @@ -329,30 +358,31 @@ Item { map.addMapItem(preMapPolyline) map.addMapItem(preMapRoute) compare (map.mapItems.length, 6) - visualInspectionPoint() + map.center = preMapRect.topLeft - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(preMapRect.topLeft) mouseClick(map, point.x + 5, point.y + 5) tryCompare(preMapRectClicked, "count", 1) map.center = preMapCircle.center - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(preMapCircle.center) mouseClick(map, point.x - 5, point.y - 5) tryCompare(preMapRectClicked, "count", 1) compare(preMapCircleClicked.count, 1) map.center = preMapCircle.center.atDistanceAndAzimuth(preMapCircle.radius, -45) + verify(LocationTestHelper.waitForPolished(map)) mouseClick(map, preMapCircle.x + 4, preMapCircle.y + 4) tryCompare(preMapRectClicked, "count", 2) compare(preMapCircleClicked.count, 1) compare(preMapQuickItemClicked.count, 0) map.center = preMapQuickItem.coordinate - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(preMapQuickItem.coordinate) mouseClick(map, point.x + 5, point.y + 5) tryCompare(preMapQuickItemClicked, "count", 1) map.center = preMapPolygon.path[1] - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(preMapPolygon.path[1]) mouseClick(map, point.x - 5, point.y) tryCompare(preMapPolygonClicked, "count", 1) @@ -361,8 +391,7 @@ Item { // item clips to map. not sure if this is sensible test map.addMapItem(extMapCircle) map.center = extMapCircle.center - verify(waitForRendering(map)) - visualInspectionPoint(); + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(extMapCircle.center) mouseClick(map, point.x, point.y) tryCompare(extMapCircleClicked, "count", 1) @@ -372,8 +401,7 @@ Item { map.addMapItem(extMapQuickItem) map.center = extMapQuickItem.coordinate - verify(waitForRendering(map)) - visualInspectionPoint(); + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(extMapQuickItem.coordinate) mouseClick(map, point.x + 5, point.y + 5) tryCompare(extMapQuickItemClicked, "count", 1) @@ -382,13 +410,12 @@ Item { map.removeMapItem(extMapQuickItem) } - function test_ab_drag() { - clear_data() + function test_drag() + { // basic drags, drag rectangle compare (preMapRectActiveChanged.count, 0) map.center = preMapRect.topLeft - verify(waitForRendering(map)) - + verify(LocationTestHelper.waitForPolished(map)) var i var point = map.fromCoordinate(preMapRect.topLeft) var targetCoordinate = map.toCoordinate(51, 51) @@ -411,7 +438,7 @@ Item { // drag circle compare (preMapCircleActiveChanged.count, 0) map.center = preMapCircle.center - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(preMapCircle.center) targetCoordinate = map.toCoordinate(51, 51) mousePress(map, point.x, point.y) @@ -420,7 +447,7 @@ Item { mouseMove(map, point.x - i, point.y - i) } mouseRelease(map, point.x - i, point.y - i) - visualInspectionPoint() + verify(LocationTestHelper.waitForPolished(map)) compare(preMapRectActiveChanged.count, 2) compare(preMapCircleActiveChanged.count, 2) verify(preMapCircleCenterChanged.count > 1) @@ -430,7 +457,7 @@ Item { // drag quick item compare (preMapQuickItemActiveChanged.count, 0) map.center = preMapQuickItem.coordinate - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(preMapQuickItem.coordinate) targetCoordinate = map.toCoordinate(51, 51) mousePress(map, point.x + 5, point.y + 5) @@ -439,15 +466,15 @@ Item { mouseMove(map, point.x - i, point.y - i) } mouseRelease(map, point.x - i, point.y - i) - visualInspectionPoint() + verify(LocationTestHelper.waitForPolished(map)) compare(preMapQuickItemActiveChanged.count, 2) verify(preMapQuickItemCoordinateChanged.count > 1) verify(fuzzy_compare(preMapQuickItem.coordinate.latitude, targetCoordinate.latitude, 0.2)) verify(fuzzy_compare(preMapQuickItem.coordinate.longitude, targetCoordinate.longitude, 0.2)) } - function test_ac_basic_properties() { - clear_data() + function test_basic_items_properties() + { // circle preMapCircle.center = someCoordinate1 compare (preMapCircleCenterChanged.count, 1) @@ -563,35 +590,6 @@ Item { compare (preMapQuickItemSourceItemChanged.count, 1) } - function clear_data() { - preMapRectClicked.clear() - preMapCircleClicked.clear() - preMapQuickItemClicked.clear() - preMapPolygonClicked.clear() - preMapCircleCenterChanged.clear() - preMapCircleColorChanged.clear() - preMapCircleRadiusChanged.clear() - preMapCircleBorderColorChanged.clear() - preMapCircleBorderWidthChanged.clear() - preMapRectTopLeftChanged.clear() - preMapRectBottomRightChanged.clear() - preMapRectColorChanged.clear() - preMapPolylineColorChanged.clear() - preMapPolylineWidthChanged.clear() - preMapPolylinePathChanged.clear() - preMapPolygonPathChanged.clear() - preMapPolygonColorChanged.clear() - preMapPolygonBorderColorChanged.clear() - preMapPolygonBorderWidthChanged.clear() - preMapRouteRouteChanged.clear() - preMapRouteLineColorChanged.clear() - preMapRouteLineWidthChanged.clear() - preMapQuickItemCoordinateChanged.clear() - preMapQuickItemAnchorPointChanged.clear() - preMapQuickItemZoomLevelChanged.clear() - preMapQuickItemSourceItemChanged.clear() - } - function fuzzy_compare(val, ref, tol) { var tolerance = 2 if (tol !== undefined) @@ -602,16 +600,6 @@ Item { return false; } - // call to visualInspectionPoint testcase (for dev time visual inspection) - function visualInspectionPoint(time) { - var waitTime = 0 // 300 - if (time !== undefined) - waitTime = time - if (waitTime > 0) { - console.log('halting for ' + waitTime + ' milliseconds') - wait (waitTime) - } - } // these 'real_' prefixed functions do sequences as // it would occur on real app (e.g. doubleclick is in fact // a sequence of press, release, doubleclick, release). diff --git a/tests/auto/declarative_ui/tst_map_item_details.qml b/tests/auto/declarative_ui/tst_map_item_details.qml index b29b3a82..fd9b0064 100644 --- a/tests/auto/declarative_ui/tst_map_item_details.qml +++ b/tests/auto/declarative_ui/tst_map_item_details.qml @@ -35,6 +35,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtPositioning 5.5 import QtLocation 5.6 +import QtLocation.Test 5.6 Item { id: page @@ -308,22 +309,34 @@ Item { (0,240) ---------------------------------------------------- (240,240) */ - function test_aa_precondition() { - wait(10) + function initTestCase() + { // sanity check that the coordinate conversion works var mapcenter = map.fromCoordinate(map.center) verify (fuzzy_compare(mapcenter.x, 100, 2)) verify (fuzzy_compare(mapcenter.y, 100, 2)) } - function test_polygon() { + function init() + { map.clearMapItems() - clear_data() - compare (extMapPolygon.border.width, 1.0) - compare (extMapPolygonClicked.count, 0) + extMapPolygon.border.width = 1.0 + extMapPolygonClicked.clear() + extMapPolylineColorChanged.clear() + extMapPolylineWidthChanged.clear() + extMapPolylinePathChanged.clear() + extMapPolygonPathChanged.clear() + extMapPolygonColorChanged.clear() + extMapPolygonBorderColorChanged.clear() + extMapPolygonBorderWidthChanged.clear() + } + + function test_polygon() + { map.center = extMapPolygon.path[1] var point = map.fromCoordinate(extMapPolygon.path[1]) map.addMapItem(extMapPolygon) + verify(LocationTestHelper.waitForPolished(map)) verify(extMapPolygon.path.length == 2) mouseClick(map, point.x - 5, point.y) compare(extMapPolygonClicked.count, 0) @@ -331,7 +344,7 @@ Item { verify(extMapPolygon0.path.length == 0) extMapPolygon.addCoordinate(polyCoordinate) verify(extMapPolygon.path.length == 3) - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) mouseClick(map, point.x - 5, point.y) tryCompare(extMapPolygonClicked, "count", 1) @@ -352,9 +365,8 @@ Item { verify(extMapPolygon.path.length == 0) } - function test_polyline() { - map.clearMapItems() - clear_data() + function test_polyline() + { compare (extMapPolyline.line.width, 1.0) var point = map.fromCoordinate(extMapPolyline.path[1]) map.addMapItem(extMapPolyline0) // mustn't crash or ill-behave @@ -411,14 +423,9 @@ Item { (0,240) ---------------------------------------------------- (600,240) */ - function test_yz_dateline() { - if (Qt.platform.os === "windows") - skip("QTBUG-53455"); - map.clearMapItems() - clear_data() + function test_dateline() { map.center = datelineCoordinate map.zoomLevel = 2.2 - // rectangle // item spanning across dateline map.addMapItem(extMapRectDateline) @@ -434,10 +441,10 @@ Item { verify(point.x > map.width / 2.0) // move item edge onto dateline extMapRectDateline.topLeft.longitude = datelineCoordinate.longitude - verify(waitForRendering(map)) point = map.fromCoordinate(extMapRectDateline.topLeft) verify(point.x == map.width / 2.0) // drag item back onto dateline + verify(LocationTestHelper.waitForPolished(map)) mousePress(map, point.x + 5, point.y + 5) var i for (i=0; i < 20; i += 2) { @@ -445,6 +452,7 @@ Item { mouseMove(map, point.x + 5 - i, point.y + 5 ) } mouseRelease(map, point.x + 5 - i, point.y + 5) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(extMapRectDateline.topLeft) verify(point.x < map.width / 2.0) point = map.fromCoordinate(extMapRectDateline.bottomRight) @@ -458,15 +466,16 @@ Item { point = map.fromCoordinate(extMapCircleDateline.center) verify(point.x == map.width / 2.0) extMapCircleDateline.center.longitude = datelineCoordinateRight.longitude - verify(waitForRendering(map)) point = map.fromCoordinate(extMapCircleDateline.center) verify(point.x > map.width / 2.0) + verify(LocationTestHelper.waitForPolished(map)) mousePress(map, point.x, point.y) for (i=0; i < 40; i += 4) { wait(1) mouseMove(map, point.x - i, point.y) } mouseRelease(map, point.x - i, point.y) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(extMapCircleDateline.center) verify(point.x < map.width / 2.0) map.removeMapItem(extMapCircleDateline) @@ -478,15 +487,16 @@ Item { point = map.fromCoordinate(extMapQuickItemDateline.coordinate) verify(point.x < map.width / 2.0) extMapQuickItemDateline.coordinate.longitude = datelineCoordinateRight.longitude - verify(waitForRendering(map)) point = map.fromCoordinate(extMapQuickItemDateline.coordinate) verify(point.x > map.width / 2.0) + verify(LocationTestHelper.waitForPolished(map)) mousePress(map, point.x + 5, point.y + 5) for (i=0; i < 50; i += 5) { wait(1) mouseMove(map, point.x + 5 - i, point.y + 5 ) } mouseRelease(map, point.x + 5 - i, point.y + 5) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(extMapQuickItemDateline.coordinate) verify(point.x < map.width / 2.0) map.removeMapItem(extMapQuickItemDateline) @@ -520,16 +530,16 @@ Item { path = extMapPolygonDateline.path; path[3].longitude = datelineCoordinate.longitude; extMapPolygonDateline.path = path; - verify(waitForRendering(map)) point = map.fromCoordinate(extMapPolygonDateline.path[3]) verify(point.x == map.width / 2.0) + verify(LocationTestHelper.waitForPolished(map)) mousePress(map, point.x + 5, point.y - 5) for (i=0; i < 16; i += 2) { wait(1) mouseMove(map, point.x + 5 - i, point.y - 5 ) } mouseRelease(map, point.x + 5 - i, point.y - 5) - verify(waitForRendering(map,10000)) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(extMapPolygonDateline.path[0]) verify(point.x < map.width / 2.0) point = map.fromCoordinate(extMapPolygonDateline.path[1]) @@ -594,11 +604,7 @@ Item { (0,240) ---------------------------------------------------- (600,240) */ - function test_zz_border_drag() { - if (Qt.platform.os === "windows") - skip("QTBUG-53455"); - map.clearMapItems() - clear_data() + function test_border_drag() { map.center = datelineCoordinate // lower zoom level and change widths to reveal map border. @@ -607,10 +613,9 @@ Item { map.zoomLevel = 1 page.width = 600 map.width = 560 - // rectangle map.addMapItem(extMapRectEdge) - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) verify(extMapRectEdge.topLeft.longitude == -15) verify(extMapRectEdge.bottomRight.longitude == -5) var point = map.fromCoordinate(extMapRectEdge.topLeft) @@ -630,6 +635,7 @@ Item { mouseMove(map, point.x + 5 + i, point.y + 5) } mouseRelease(map, point.x + 5 + i, point.y + 5) + verify(LocationTestHelper.waitForPolished(map)) // currently the bottom right screen point is unwrapped and drawn // out of the map border, but in the future culling may take place // so tests for points outside the map border are ignored, @@ -643,6 +649,7 @@ Item { // circle map.addMapItem(extMapCircleEdge) map.center = datelineCoordinate + verify(LocationTestHelper.waitForPolished(map)) verify(extMapCircleEdge.center.longitude == -15) var point = map.fromCoordinate(extMapCircleEdge.center) verify(point.x < map.width) @@ -656,6 +663,7 @@ Item { mouseMove(map, point.x + i, point.y) } mouseRelease(map, point.x + i, point.y) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(extMapCircleEdge.center) verify(point.x < map.width) verify(point.x > map.width / 2.0) @@ -665,7 +673,7 @@ Item { // quickitem map.addMapItem(extMapQuickItemEdge) map.center = datelineCoordinate - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) verify(extMapQuickItemEdge.coordinate.longitude == -15) point = map.fromCoordinate(extMapQuickItemEdge.coordinate) verify(point.x < map.width) @@ -678,6 +686,7 @@ Item { mouseMove(map, point.x + 5 + i, point.y + 5) } mouseRelease(map, point.x + 5 + i, point.y + 5) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(extMapQuickItemEdge.coordinate) verify(point.x < map.width) verify(point.x > map.width / 2.0) @@ -687,7 +696,7 @@ Item { // polygon map.center = datelineCoordinate map.addMapItem(extMapPolygonEdge) - verify(waitForRendering(map)) + verify(LocationTestHelper.waitForPolished(map)) verify(extMapPolygonEdge.path[0].longitude == -15) verify(extMapPolygonEdge.path[1].longitude == -5) verify(extMapPolygonEdge.path[2].longitude == -5) @@ -712,6 +721,7 @@ Item { mouseMove(map, point.x + 5 + i, point.y - 5) } mouseRelease(map, point.x + 5 + i, point.y - 5) + verify(LocationTestHelper.waitForPolished(map)) point = map.fromCoordinate(extMapPolygonEdge.path[0]) verify(point.x < map.width) verify(point.x > map.width / 2.0) @@ -722,18 +732,6 @@ Item { map.removeMapItem(extMapPolygonEdge) } - - function clear_data() { - extMapPolygonClicked.clear() - extMapPolylineColorChanged.clear() - extMapPolylineWidthChanged.clear() - extMapPolylinePathChanged.clear() - extMapPolygonPathChanged.clear() - extMapPolygonColorChanged.clear() - extMapPolygonBorderColorChanged.clear() - extMapPolygonBorderWidthChanged.clear() - } - function fuzzy_compare(val, ref, tol) { var tolerance = 2 if (tol !== undefined) @@ -743,11 +741,5 @@ Item { console.log('map fuzzy cmp returns false for value, ref, tolerance: ' + val + ', ' + ref + ', ' + tolerance) return false; } - - // call to visualInspectionPoint testcase (only for development time visual inspection) - function visualInspectionPoint(text) { - progressText.text = text - //wait (500) - } } } 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 b3ac1d8f..8671d05d 100644 --- a/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml +++ b/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml @@ -240,7 +240,6 @@ Item { // normal case - fit viewport to items which are all already visible verify_visibility_all_items() map.fitViewportToMapItems() - verify(waitForRendering(map)) visualInspectionPoint() verify_visibility_all_items() } @@ -578,7 +577,6 @@ Item { map.addMapItem(preMapPolygon) map.addMapItem(preMapPolyline) map.addMapItem(preMapRoute) - verify(waitForRendering(map)) compare (map.mapItems.length, 6) calculate_bounds() } diff --git a/tests/plugins/declarativetestplugin/declarativetestplugin.pro b/tests/plugins/declarativetestplugin/declarativetestplugin.pro index a27267d7..0a99e7a7 100644 --- a/tests/plugins/declarativetestplugin/declarativetestplugin.pro +++ b/tests/plugins/declarativetestplugin/declarativetestplugin.pro @@ -7,13 +7,15 @@ QT += gui-private qml quick location testlib INCLUDEPATH += ../../../src/imports/location INCLUDEPATH += ../../../src/location -HEADERS += qdeclarativepinchgenerator_p.h \ - qdeclarativelocationtestmodel_p.h - - -SOURCES += locationtest.cpp \ - qdeclarativepinchgenerator.cpp \ - qdeclarativelocationtestmodel.cpp +HEADERS += \ + qdeclarativepinchgenerator_p.h \ + qdeclarativelocationtestmodel_p.h \ + testhelper.h + +SOURCES += \ + locationtest.cpp \ + qdeclarativepinchgenerator.cpp \ + qdeclarativelocationtestmodel.cpp IMPORT_FILES = \ qmldir diff --git a/tests/plugins/declarativetestplugin/locationtest.cpp b/tests/plugins/declarativetestplugin/locationtest.cpp index cde1d97f..7f579196 100644 --- a/tests/plugins/declarativetestplugin/locationtest.cpp +++ b/tests/plugins/declarativetestplugin/locationtest.cpp @@ -33,6 +33,7 @@ #include "qdeclarativepinchgenerator_p.h" #include "qdeclarativelocationtestmodel_p.h" +#include "testhelper.h" #include #include @@ -41,6 +42,14 @@ QT_BEGIN_NAMESPACE +static QObject *helper_factory(QQmlEngine *engine, QJSEngine *scriptEngine) +{ + Q_UNUSED(engine); + Q_UNUSED(scriptEngine); + TestHelper *helper = new TestHelper(); + return helper; +} + class QLocationDeclarativeTestModule: public QQmlExtensionPlugin { Q_OBJECT @@ -51,6 +60,7 @@ public: if (QLatin1String(uri) == QLatin1String("QtLocation.Test")) { qmlRegisterType(uri, 5, 5, "PinchGenerator"); qmlRegisterType(uri, 5, 5, "TestModel"); + qmlRegisterSingletonType(uri, 5, 6, "LocationTestHelper", helper_factory); } else { qWarning() << "Unsupported URI given to load location test QML plugin: " << QLatin1String(uri); } diff --git a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp index f0b03746..87e5c9f2 100644 --- a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp +++ b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp @@ -36,6 +36,8 @@ #include #include +QT_BEGIN_NAMESPACE + QDeclarativeLocationTestModel::QDeclarativeLocationTestModel(QObject *parent): QAbstractListModel(parent), delay_(0), @@ -247,3 +249,5 @@ QHash QDeclarativeLocationTestModel::roleNames() const roles.insert(TestDataRole, "modeldata"); return roles; } + +QT_END_NAMESPACE diff --git a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h index 19564336..91f152ac 100644 --- a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h +++ b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h @@ -41,6 +41,8 @@ #include #include +QT_BEGIN_NAMESPACE + class DataObject: public QObject { Q_OBJECT @@ -128,4 +130,6 @@ private: bool crazyMode_; }; +QT_END_NAMESPACE + #endif diff --git a/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp b/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp index 98da18d0..632f9fa9 100644 --- a/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp +++ b/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp @@ -38,6 +38,8 @@ #include #include +QT_BEGIN_NAMESPACE + QDeclarativePinchGenerator::QDeclarativePinchGenerator(): target_(0), state_(Invalid), @@ -381,3 +383,5 @@ int QDeclarativePinchGenerator::startDragDistance() { return qApp->styleHints()->startDragDistance(); } + +QT_END_NAMESPACE diff --git a/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator_p.h b/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator_p.h index b2a4e77c..db5c9131 100644 --- a/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator_p.h +++ b/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator_p.h @@ -46,6 +46,8 @@ #define SWIPES_REQUIRED 2 +QT_BEGIN_NAMESPACE + typedef struct { QList touchPoints; QList durations; @@ -137,4 +139,6 @@ private: QTouchDevice* device_; }; +QT_END_NAMESPACE + #endif diff --git a/tests/plugins/declarativetestplugin/testhelper.h b/tests/plugins/declarativetestplugin/testhelper.h new file mode 100644 index 00000000..c6d9f3b3 --- /dev/null +++ b/tests/plugins/declarativetestplugin/testhelper.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TESTHELPER_H +#define TESTHELPER_H + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class TestHelper: public QObject +{ + Q_OBJECT +public: + TestHelper(QObject *parent = Q_NULLPTR):QObject(parent){} + Q_INVOKABLE bool waitForPolished(QQuickItem *item, int timeout = 10000) const + { + QSignalSpy spy(item->window(), &QQuickWindow::afterAnimating); + return spy.wait(timeout); + } +}; + +QT_END_NAMESPACE + +#endif // TESTHELPER_H -- cgit v1.2.3 From 73f7665a7f78c59c55e31905609d7718eab08a01 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 30 May 2016 13:59:08 +0200 Subject: Remove test_border_drag test Since change 820f79284248e5fcc9910282055e67f07c918559 map can not have "borders", remove test which tries to drag items in/out of map borders, moreover particular test tries to drag items which are not visible, which gives anyway false results. Add missing zoomLevel setting to init(). Change-Id: I4932e767fe1b9e3d213ef7b2f654a9bbe857de78 Reviewed-by: Alex Blasche --- tests/auto/declarative_ui/tst_map_item_details.qml | 153 +-------------------- 1 file changed, 1 insertion(+), 152 deletions(-) diff --git a/tests/auto/declarative_ui/tst_map_item_details.qml b/tests/auto/declarative_ui/tst_map_item_details.qml index 4b1af61b..ef11ba6c 100644 --- a/tests/auto/declarative_ui/tst_map_item_details.qml +++ b/tests/auto/declarative_ui/tst_map_item_details.qml @@ -270,7 +270,6 @@ Item { Map { id: map; x: 20; y: 20; width: 200; height: 200 - zoomLevel: 3 center: mapDefaultCenter plugin: testPlugin; } @@ -315,6 +314,7 @@ Item { function init() { map.clearMapItems() + map.zoomLevel = 3 extMapPolygon.border.width = 1.0 extMapPolygonClicked.clear() extMapPolylineColorChanged.clear() @@ -576,157 +576,6 @@ Item { map.removeMapItem(extMapRouteDateline) } - /* - - (0,0) ---------------------------------------------------- (600,0) - | no map | - | (20,20) | - (0,20) | ------------------------------------------ | (600,20) - | | | | - | | map | | - | | | | - | | | | - | | | | - | | (lat 20, lon 180) | | - | | x | | - | | | | - | | | | - | | | | - | | | | - | | | | - | ------------------------------------------ | - | | - (0,240) ---------------------------------------------------- (600,240) - - */ - function test_border_drag() { - map.center = datelineCoordinate - - // lower zoom level and change widths to reveal map border. - // Note: items are not visible at zoom level < 2.0, - // but for testing it's ok - map.zoomLevel = 1 - page.width = 600 - map.width = 560 - // rectangle - map.addMapItem(extMapRectEdge) - verify(LocationTestHelper.waitForPolished(map)) - verify(extMapRectEdge.topLeft.longitude == -15) - verify(extMapRectEdge.bottomRight.longitude == -5) - var point = map.fromCoordinate(extMapRectEdge.topLeft) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - point = map.fromCoordinate(extMapRectEdge.bottomRight) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - var originalWidth = extMapRectEdge.width; - verify(originalWidth < map.width / 2.0) - // drag item onto map border - point = map.fromCoordinate(extMapRectEdge.topLeft) - mousePress(map, point.x + 5, point.y + 5) - var i - for (i=0; i < 20; i += 2) { - wait(1) - mouseMove(map, point.x + 5 + i, point.y + 5) - } - mouseRelease(map, point.x + 5 + i, point.y + 5) - verify(LocationTestHelper.waitForPolished(map)) - // currently the bottom right screen point is unwrapped and drawn - // out of the map border, but in the future culling may take place - // so tests for points outside the map border are ignored, - // instead we check the item width - point = map.fromCoordinate(extMapRectEdge.topLeft) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - compare(extMapRectEdge.width, originalWidth) - map.removeMapItem(extMapRectEdge) - - // circle - map.addMapItem(extMapCircleEdge) - map.center = datelineCoordinate - verify(LocationTestHelper.waitForPolished(map)) - verify(extMapCircleEdge.center.longitude == -15) - var point = map.fromCoordinate(extMapCircleEdge.center) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - originalWidth = extMapCircleEdge.width; - verify(originalWidth < map.width / 2.0) - point = map.fromCoordinate(extMapCircleEdge.center) - mousePress(map, point.x, point.y) - for (i=0; i < 20; i += 2) { - wait(1) - mouseMove(map, point.x + i, point.y) - } - mouseRelease(map, point.x + i, point.y) - verify(LocationTestHelper.waitForPolished(map)) - point = map.fromCoordinate(extMapCircleEdge.center) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - fuzzy_compare(extMapCircleEdge.width, originalWidth) - map.removeMapItem(extMapCircleEdge) - - // quickitem - map.addMapItem(extMapQuickItemEdge) - map.center = datelineCoordinate - verify(LocationTestHelper.waitForPolished(map)) - verify(extMapQuickItemEdge.coordinate.longitude == -15) - point = map.fromCoordinate(extMapQuickItemEdge.coordinate) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - originalWidth = extMapQuickItemEdge.width; - verify(originalWidth < map.width / 2.0) - mousePress(map, point.x + 5, point.y + 5) - for (i=0; i < 20; i += 2) { - wait(1) - mouseMove(map, point.x + 5 + i, point.y + 5) - } - mouseRelease(map, point.x + 5 + i, point.y + 5) - verify(LocationTestHelper.waitForPolished(map)) - point = map.fromCoordinate(extMapQuickItemEdge.coordinate) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - compare(extMapQuickItemEdge.width, originalWidth) - map.removeMapItem(extMapQuickItemEdge) - - // polygon - map.center = datelineCoordinate - map.addMapItem(extMapPolygonEdge) - verify(LocationTestHelper.waitForPolished(map)) - verify(extMapPolygonEdge.path[0].longitude == -15) - verify(extMapPolygonEdge.path[1].longitude == -5) - verify(extMapPolygonEdge.path[2].longitude == -5) - verify(extMapPolygonEdge.path[3].longitude == -15) - point = map.fromCoordinate(extMapPolygonEdge.path[0]) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - point = map.fromCoordinate(extMapPolygonEdge.path[1]) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - point = map.fromCoordinate(extMapPolygonEdge.path[2]) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - point = map.fromCoordinate(extMapPolygonEdge.path[3]) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - originalWidth = extMapPolygonEdge.width; - verify(originalWidth < map.width / 2.0) - mousePress(map, point.x + 5, point.y - 5) - for (i=0; i < 20; i += 2) { - wait(1) - mouseMove(map, point.x + 5 + i, point.y - 5) - } - mouseRelease(map, point.x + 5 + i, point.y - 5) - verify(LocationTestHelper.waitForPolished(map)) - point = map.fromCoordinate(extMapPolygonEdge.path[0]) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - point = map.fromCoordinate(extMapPolygonEdge.path[3]) - verify(point.x < map.width) - verify(point.x > map.width / 2.0) - compare(extMapPolygonEdge.width, originalWidth) - map.removeMapItem(extMapPolygonEdge) - } - function fuzzy_compare(val, ref, tol) { var tolerance = 2 if (tol !== undefined) -- cgit v1.2.3 From f46abef02cf5c883deba753afeff0042fa36b6e4 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Wed, 25 May 2016 14:46:00 +0200 Subject: Fix setZoomLevel and setCenter when called before initialization setZoomLevel and setCenter must not do value clamping before the map has been fully initialized. Initialize() will take care of adjusting these values when called. Task-number: QTBUG-52030 Change-Id: I1b2004668c8482a4a0f54b00cbd8efb2dce1feca Reviewed-by: Alex Blasche --- src/imports/location/qdeclarativegeomap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp index a685a0f7..545ef608 100644 --- a/src/imports/location/qdeclarativegeomap.cpp +++ b/src/imports/location/qdeclarativegeomap.cpp @@ -684,7 +684,7 @@ void QDeclarativeGeoMap::setZoomLevel(qreal zoomLevel) //small optiomatization to avoid double setCameraData bool centerHasChanged = false; - if (m_map) { + if (m_initialized) { m_cameraData.setZoomLevel(qBound(minimumZoomLevel(), zoomLevel, maximumZoomLevel())); m_maximumViewportLatitude = m_map->maximumLatitudeForZoom(m_cameraData.zoomLevel()); QGeoCoordinate coord = m_cameraData.center(); @@ -724,7 +724,7 @@ void QDeclarativeGeoMap::setCenter(const QGeoCoordinate ¢er) if (!center.isValid()) return; - if (m_map) { + if (m_initialized) { QGeoCoordinate coord(center); coord.setLatitude(qBound(-m_maximumViewportLatitude, center.latitude(), m_maximumViewportLatitude)); m_cameraData.setCenter(coord); -- cgit v1.2.3