summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@theqtcompany.com>2016-04-08 10:41:23 +0200
committerPaolo Angelelli <paolo.angelelli@theqtcompany.com>2016-04-11 13:36:46 +0000
commit4528d53b7429e48c51988002bf35e3615a152cb5 (patch)
treea0365c4b2be0c0fc71e54374e6183ccd55c9df16 /tests
parent46bef1bf9b00727832cad35440c554f26e7457b9 (diff)
downloadqtlocation-4528d53b7429e48c51988002bf35e3615a152cb5.tar.gz
Fix for negative QGeoCoordinate.azimuthTo results in range ]360, 359[
QGeoCoordinate.azimuthTo() currently returns negative value (between 0 and -1) for azimuths that should instead be in the range between 360 and 359. This patch should bring all returned values in the range [0, 360[ (360 excluded). Change-Id: I0b5ee7c3fc2bbeb80ca8167a53c7c16d9e067e29 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp b/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp
index 413fa071..fa9fd5c5 100644
--- a/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp
+++ b/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp
@@ -469,7 +469,10 @@ private slots:
QFETCH(QGeoCoordinate, c2);
QFETCH(qreal, azimuth);
- QCOMPARE(QString::number(c1.azimuthTo(c2)), QString::number(azimuth));
+ qreal result = c1.azimuthTo(c2);
+ QVERIFY(result >= 0.0);
+ QVERIFY(result < 360.0);
+ QCOMPARE(QString::number(result), QString::number(azimuth));
}
void azimuthTo_data()
@@ -488,6 +491,8 @@ private slots:
<< LONDON << NEW_YORK << qreal(288.3388804508);
QTest::newRow("north pole -> south pole")
<< NORTH_POLE << SOUTH_POLE << qreal(180.0);
+ QTest::newRow("Almost 360degrees bearing")
+ << QGeoCoordinate(0.5,45.0,0.0) << QGeoCoordinate(0.5,-134.9999651,0.0) << qreal(359.998);
}
void atDistanceAndAzimuth()