Fix building tests on QNX

Use qmath and cmath methods instead of math.h methods.

Change-Id: I86ee2465c999822bf00a7cefee1642c4c30590a6
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@digia.com>
This commit is contained in:
Allan Sandfeld Jensen 2015-03-09 10:54:27 +01:00
parent 3fea1e53a1
commit 1edd16879c
2 changed files with 4 additions and 9 deletions

View File

@ -48,6 +48,7 @@
#include <limits.h> #include <limits.h>
#include <float.h> #include <float.h>
#include <cmath>
#include <QLinkedList> #include <QLinkedList>
#include <QRegularExpression> #include <QRegularExpression>
@ -3376,10 +3377,10 @@ void tst_QVariant::numericalConvert()
switch (v.userType()) switch (v.userType())
{ {
case QVariant::Double: case QVariant::Double:
QCOMPARE(v.toString() , QString::number(num, 'g', DBL_MANT_DIG * log10(2.) + 2)); QCOMPARE(v.toString() , QString::number(num, 'g', DBL_MANT_DIG * std::log10(2.) + 2));
break; break;
case QMetaType::Float: case QMetaType::Float:
QCOMPARE(v.toString() , QString::number(float(num), 'g', FLT_MANT_DIG * log10(2.) + 2)); QCOMPARE(v.toString() , QString::number(float(num), 'g', FLT_MANT_DIG * std::log10(2.) + 2));
break; break;
} }
} }

View File

@ -895,12 +895,6 @@ void tst_QPainterPath::operators()
QCOMPARE(test, expected); QCOMPARE(test, expected);
} }
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define ANGLE(t) ((t) * 2 * M_PI / 360.0)
static inline bool pathFuzzyCompare(double p1, double p2) static inline bool pathFuzzyCompare(double p1, double p2)
{ {
return qAbs(p1 - p2) < 0.001; return qAbs(p1 - p2) < 0.001;
@ -931,7 +925,7 @@ void tst_QPainterPath::testArcMoveTo()
qreal y_radius = rect.height() / 2.0; qreal y_radius = rect.height() / 2.0;
QPointF shouldBe = rect.center() QPointF shouldBe = rect.center()
+ QPointF(x_radius * cos(ANGLE(angle)), -y_radius * sin(ANGLE(angle))); + QPointF(x_radius * qCos(qDegreesToRadians(angle)), -y_radius * qSin(qDegreesToRadians(angle)));
qreal iw = 1 / rect.width(); qreal iw = 1 / rect.width();
qreal ih = 1 / rect.height(); qreal ih = 1 / rect.height();