diff options
author | Aaron McCarthy <aaron.mccarthy@jollamobile.com> | 2013-09-09 15:38:46 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-16 10:25:59 +0200 |
commit | 87ce030b7b7336e561779dc9516d5ae2242a5d5f (patch) | |
tree | 465f162de1948064b992faad80fc7bcda903bd76 /tests/auto/qgeopositioninfo | |
parent | 74a27699c7f474266fac98818c73f91e68220a87 (diff) | |
download | qtlocation-87ce030b7b7336e561779dc9516d5ae2242a5d5f.tar.gz |
Return NaN if position info source doesn't have an attribute.
The previous returned value of -1 could be a valid value for some
attributes. Returning NaN has the advantage that calculations done with
an attribute that has not been set will have the final result evaluate
to NaN as well.
Change-Id: I42fd3512453910efd78f3be66acba46a1e829ee0
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'tests/auto/qgeopositioninfo')
-rw-r--r-- | tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp b/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp index 91e3b14d..21417f84 100644 --- a/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp +++ b/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp @@ -47,6 +47,7 @@ #include <QObject> #include <QDebug> #include <QTest> +#include <QtCore/QtNumeric> #include <float.h> @@ -271,13 +272,13 @@ private slots: QFETCH(qreal, value); QGeoPositionInfo info; - QCOMPARE(info.attribute(attribute), qreal(-1.0)); + QVERIFY(qIsNaN(info.attribute(attribute))); info.setAttribute(attribute, value); QCOMPARE(info.attribute(attribute), value); info.removeAttribute(attribute); - QCOMPARE(info.attribute(attribute), qreal(-1.0)); + QVERIFY(qIsNaN(info.attribute(attribute))); } void attribute_data() |