summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2021-08-24 12:22:45 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-08-31 11:05:16 +0000
commitdd73e619e156a0681623419a65509fe2265a0ead (patch)
tree14f65646edd1ad9e164b250899a1264140880a46
parentc134d19585b5ec3e1cd241a9ba051d8f73ccb550 (diff)
downloadqtlocation-dd73e619e156a0681623419a65509fe2265a0ead.tar.gz
CoordinateAnimation: fix direction interpolation
The interpolation for the West and East directions were actually confused. When the CoordinateAnimaion.East direction was selected, the interpolation was done in West direction and vice versa. This patch fixes the issue. [ChangeLog][CoordinateAnimation][Important Behavior Change] The value of direction property for CoordinateAnimation is now handled correctly. Previously the values were confused, so specifying CoordinateAnimation.East direction was actually leading to moving West and vice versa. Change-Id: I8e73fc4ad5cabd80bca38c624c70919e54c55127 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 965c80c5db88dd94b666228d432b226c496c9d30) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/positioningquick/qquickgeocoordinateanimation.cpp4
-rw-r--r--tests/auto/declarative_positioning_core/tst_coordinate.qml12
2 files changed, 8 insertions, 8 deletions
diff --git a/src/positioningquick/qquickgeocoordinateanimation.cpp b/src/positioningquick/qquickgeocoordinateanimation.cpp
index a678c340..b5d1286c 100644
--- a/src/positioningquick/qquickgeocoordinateanimation.cpp
+++ b/src/positioningquick/qquickgeocoordinateanimation.cpp
@@ -121,7 +121,7 @@ QVariant q_coordinateShortestInterpolator(const QGeoCoordinate &from, const QGeo
return QVariant::fromValue(result);
}
-QVariant q_coordinateWestInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
+QVariant q_coordinateEastInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
{
const QGeoMercatorCoordinatePrivate* fromMercator =
static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&from));
@@ -151,7 +151,7 @@ QVariant q_coordinateWestInterpolator(const QGeoCoordinate &from, const QGeoCoor
return QVariant::fromValue(result);
}
-QVariant q_coordinateEastInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
+QVariant q_coordinateWestInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
{
const QGeoMercatorCoordinatePrivate* fromMercator =
static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&from));
diff --git a/tests/auto/declarative_positioning_core/tst_coordinate.qml b/tests/auto/declarative_positioning_core/tst_coordinate.qml
index b1c078c3..4b34f7a6 100644
--- a/tests/auto/declarative_positioning_core/tst_coordinate.qml
+++ b/tests/auto/declarative_positioning_core/tst_coordinate.qml
@@ -307,15 +307,15 @@ Item {
if (lastLongitude) {
var errorMessage = "movingEast: " + movingEast + "; From: " + from + "; To: " + to + "; i: " + i + "; crdList: " + coordinateItem.coordinateList
if (movingEast) {
- if (coordinate.longitude > 0 && lastLongitude < 0)
- verify(coordinate.longitude < lastLongitude + 360, errorMessage)
- else
- verify(coordinate.longitude < lastLongitude, errorMessage)
- } else {
if (coordinate.longitude < 0 && lastLongitude > 0)
verify(coordinate.longitude + 360 > lastLongitude, errorMessage)
else
verify(coordinate.longitude > lastLongitude, errorMessage)
+ } else {
+ if (coordinate.longitude > 0 && lastLongitude < 0)
+ verify(coordinate.longitude < lastLongitude + 360, errorMessage)
+ else
+ verify(coordinate.longitude < lastLongitude, errorMessage)
}
}
lastLongitude = coordinate.longitude
@@ -327,7 +327,7 @@ Item {
//shortest
coordinate_animation(QtPositioning.coordinate(58.0,12.0),
QtPositioning.coordinate(62.0,24.0),
- false)
+ true)
}
function test_east_direction_coordinate_animation(data)