summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shachnev <mitya57@gmail.com>2014-06-08 19:17:00 +0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-12 19:46:43 +0200
commit036c51c6841a207921a8d2dff3971e74f71201e9 (patch)
treedd6d2ab32a5ce549dd40d2a5fd0626323445953d
parentf90f40de7006c4204df6aa414776616dc6f47f57 (diff)
Fix wrong qreal architecture checksv5.3.1
Since Qt 5.2, qreal is double on all architectures by default, but some vendors (like Jolla) still use qreal = float. Instead of old (and broken) architecture checks, use runtime check sizeof(qreal) == sizeof(double). Remove the compile-time checks between DBL_MIN/DBL_MAX checks, these are sufficient on their own. Change-Id: Iae0c6486afaed0f0653fb3338c048c8f22d1e587 Reviewed-by: Alex Blasche <alexander.blasche@digia.com> Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <perezmeyer@gmail.com>
-rw-r--r--tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp63
-rw-r--r--tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp6
-rw-r--r--tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp6
3 files changed, 33 insertions, 42 deletions
diff --git a/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp b/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp
index b3c2d020..581f5c00 100644
--- a/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp
+++ b/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp
@@ -516,36 +516,39 @@ private slots:
<< qreal(1000.0)
<< qreal(10.0)
<< QGeoCoordinate();
- QTest::newRow("brisbane -> melbourne")
- << BRISBANE
- << qreal(1374820.1618767744)
- << qreal(211.1717286649)
-// the following platforms use float for qreal
-#if !defined(QT_NO_FPU) && !defined(Q_PROCESSOR_ARM) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
- << MELBOURNE;
-#else
- << QGeoCoordinate(-37.8142515084775, 144.963170622944);
-#endif
- QTest::newRow("london -> new york")
- << LONDON
- << qreal(5570538.4987236429)
- << qreal(288.3388804508)
-// the following platforms use float for qreal
-#if !defined(QT_NO_FPU) && !defined(Q_PROCESSOR_ARM) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
- << NEW_YORK;
-#else
- << QGeoCoordinate(40.7145220608416, -74.0071216045375);
-#endif
- QTest::newRow("north pole -> south pole")
- << NORTH_POLE
- << qreal(20015109.4154876769)
- << qreal(180.0)
-// the following platforms use float for qreal
-#if !defined(QT_NO_FPU) && !defined(Q_PROCESSOR_ARM) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
- << SOUTH_POLE;
-#else
- << QGeoCoordinate(-89.9999947369857, -90.0);
-#endif
+ if (sizeof(qreal) == sizeof(double)) {
+ QTest::newRow("brisbane -> melbourne")
+ << BRISBANE
+ << qreal(1374820.1618767744)
+ << qreal(211.1717286649)
+ << MELBOURNE;
+ QTest::newRow("london -> new york")
+ << LONDON
+ << qreal(5570538.4987236429)
+ << qreal(288.3388804508)
+ << NEW_YORK;
+ QTest::newRow("north pole -> south pole")
+ << NORTH_POLE
+ << qreal(20015109.4154876769)
+ << qreal(180.0)
+ << SOUTH_POLE;
+ } else {
+ QTest::newRow("brisbane -> melbourne")
+ << BRISBANE
+ << qreal(1374820.1618767744)
+ << qreal(211.1717286649)
+ << QGeoCoordinate(-37.8142515084775, 144.963170622944);
+ QTest::newRow("london -> new york")
+ << LONDON
+ << qreal(5570538.4987236429)
+ << qreal(288.3388804508)
+ << QGeoCoordinate(40.7145220608416, -74.0071216045375);
+ QTest::newRow("north pole -> south pole")
+ << NORTH_POLE
+ << qreal(20015109.4154876769)
+ << qreal(180.0)
+ << QGeoCoordinate(-89.9999947369857, -90.0);
+ }
}
void degreesToString()
diff --git a/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp b/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp
index 21417f84..1a1274c6 100644
--- a/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp
+++ b/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp
@@ -73,21 +73,15 @@ QList<qreal> tst_qgeopositioninfo_qrealTestValues()
{
QList<qreal> values;
-// the following platforms use float for qreal
-#if !defined(QT_NO_FPU) && !defined(Q_PROCESSOR_ARM) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
if (qreal(DBL_MIN) == DBL_MIN)
values << DBL_MIN;
-#endif
values << FLT_MIN;
values << -1.0 << 0.0 << 1.0;
values << FLT_MAX;
-// the following platforms use float for qreal
-#if !defined(QT_NO_FPU) && !defined(Q_PROCESSOR_ARM) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
if (qreal(DBL_MAX) == DBL_MAX)
values << DBL_MAX;
-#endif
return values;
}
diff --git a/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp b/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp
index 69f04762..7dc38d6b 100644
--- a/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp
+++ b/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp
@@ -73,21 +73,15 @@ QList<qreal> tst_qgeosatelliteinfo_qrealTestValues()
{
QList<qreal> values;
-// the following platforms use float for qreal
-#if !defined(QT_NO_FPU) && !defined(Q_PROCESSOR_ARM) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
if (qreal(DBL_MIN) == DBL_MIN)
values << DBL_MIN;
-#endif
values << FLT_MIN;
values << -1.0 << 0.0 << 1.0;
values << FLT_MAX;
-// the following platforms use float for qreal
-#if !defined(QT_NO_FPU) && !defined(Q_PROCESSOR_ARM) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
if (qreal(DBL_MAX) == DBL_MAX)
values << DBL_MAX;
-#endif
return values;
}