summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@jollamobile.com>2014-02-04 17:09:30 +1000
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-04 22:06:36 +0100
commit9b78a26acd384ee9d2bb7895e60cd182110297bf (patch)
tree1477cb5cdaea186c44df3f03df6f799f63d47db2
parent53cdda75a98b1d307294b7d773f61b1809b8ac0e (diff)
downloadqtlocation-9b78a26acd384ee9d2bb7895e60cd182110297bf.tar.gz
Fix QGeoRouteXmlParser test.
The TravelTime element is a double, which was failing to be parsed by QString::toInt(). Fixed by using QString::toDouble() and rounding the result. Change-Id: I012c277f1efdb3811a50eff96519a4d0d9959a67 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r--src/plugins/geoservices/nokia/qgeoroutexmlparser.cpp2
-rw-r--r--tests/auto/qgeoroutexmlparser/tst_qgeoroutexmlparser.cpp2
2 files changed, 1 insertions, 3 deletions
diff --git a/src/plugins/geoservices/nokia/qgeoroutexmlparser.cpp b/src/plugins/geoservices/nokia/qgeoroutexmlparser.cpp
index cd8a4bad..60840ec6 100644
--- a/src/plugins/geoservices/nokia/qgeoroutexmlparser.cpp
+++ b/src/plugins/geoservices/nokia/qgeoroutexmlparser.cpp
@@ -435,7 +435,7 @@ bool QGeoRouteXmlParser::parseManeuver()
} else if (m_reader->name() == "ToLink") {
maneuverContainter.toId = m_reader->readElementText();
} else if (m_reader->name() == "TravelTime") {
- maneuverContainter.maneuver.setTimeToNextInstruction(m_reader->readElementText().toInt());
+ maneuverContainter.maneuver.setTimeToNextInstruction(qRound(m_reader->readElementText().toDouble()));
} else if (m_reader->name() == "Length") {
maneuverContainter.maneuver.setDistanceToNextInstruction(m_reader->readElementText().toDouble());
} else if (m_reader->name() == "Direction") {
diff --git a/tests/auto/qgeoroutexmlparser/tst_qgeoroutexmlparser.cpp b/tests/auto/qgeoroutexmlparser/tst_qgeoroutexmlparser.cpp
index 64aa4ff5..9fb51cc6 100644
--- a/tests/auto/qgeoroutexmlparser/tst_qgeoroutexmlparser.cpp
+++ b/tests/auto/qgeoroutexmlparser/tst_qgeoroutexmlparser.cpp
@@ -96,7 +96,6 @@ private slots:
QCOMPARE(first.instructionText(), QLatin1String("Head toward Logan Rd (95) on Padstow Rd (56). Go for 0.3 miles."));
QCOMPARE(first.position(), QGeoCoordinate(-27.5752144, 153.0879669));
- QEXPECT_FAIL("", "Maneuver timeToNextInstruction is not populated", Continue);
QCOMPARE(first.timeToNextInstruction(), 24);
QCOMPARE(first.distanceToNextInstruction(), 403.0);
@@ -105,7 +104,6 @@ private slots:
QVERIFY(secondLast.instructionText().contains("Turn right onto Bartley St"));
QCOMPARE(secondLast.position(), QGeoCoordinate(-27.4655991, 153.0231628));
QCOMPARE(secondLast.distanceToNextInstruction(), 181.0);
- QEXPECT_FAIL("", "Maneuver timeToNextInstruction is not populated", Continue);
QCOMPARE(secondLast.timeToNextInstruction(), 41);
QGeoManeuver last = segments.at(7).maneuver();