summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp4
-rw-r--r--tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp2
-rw-r--r--tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp8
-rw-r--r--tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp7
4 files changed, 7 insertions, 14 deletions
diff --git a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
index c2c04b69c5..96d983c8f7 100644
--- a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
+++ b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
@@ -2278,8 +2278,8 @@ void tst_QMatrixNxN::rotate4x4_data()
float y = 2.0f;
float z = -6.0f;
float angle = -45.0f;
- float c = std::cos(angle * M_PI / 180.0f);
- float s = std::sin(angle * M_PI / 180.0f);
+ float c = std::cos(qDegreesToRadians(angle));
+ float s = std::sin(qDegreesToRadians(angle));
float len = std::sqrt(x * x + y * y + z * z);
float xu = x / len;
float yu = y / len;
diff --git a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp
index 53af65e010..097dd111d3 100644
--- a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp
+++ b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp
@@ -815,7 +815,7 @@ void tst_QQuaternion::fromAxisAndAngle()
// http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q56
// to calculate the answer we expect to get.
QVector3D vector = QVector3D(x1, y1, z1).normalized();
- const float a = (angle * M_PI / 180.0) / 2.0;
+ const float a = qDegreesToRadians(angle) / 2.0;
const float sin_a = std::sin(a);
const float cos_a = std::cos(a);
QQuaternion result(cos_a,
diff --git a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp
index 46420b49c5..da88a868f3 100644
--- a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp
+++ b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp
@@ -114,12 +114,8 @@ void tst_QWMatrix::mapping_data()
<< QRect( 0, 0, 30, 40 )
<< QPolygon( QRect( -300, -400, 300, 400 ) );
-#if defined(Q_OS_WIN) && !defined(M_PI)
-#define M_PI 3.14159265897932384626433832795f
-#endif
-
const auto rotate = [](qreal degrees) {
- const qreal rad = M_PI * degrees / 180.;
+ const qreal rad = qDegreesToRadians(degrees);
return QMatrix(std::cos(rad), -std::sin(rad),
std::sin(rad), std::cos(rad), 0, 0);
};
@@ -140,7 +136,7 @@ void tst_QWMatrix::mapping_data()
#if 0
const auto rotScale = [](qreal degrees, qreal scale) {
- const qreal rad = M_PI * degrees / 180.;
+ const qreal rad = qDegreesToRadians(degrees);
return QMatrix(scale * std::cos(rad), -scale * std::sin(rad),
scale * std::sin(rad), scale * std::cos(rad), 0, 0);
};
diff --git a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp
index ea08af7608..f2e6973e27 100644
--- a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp
@@ -33,10 +33,7 @@
#include <QImage>
#include <QPaintEngine>
#include <QTileRules>
-#include <math.h>
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
+#include <qmath.h>
#include <private/qpixmap_raster_p.h>
@@ -1232,7 +1229,7 @@ QTransform tst_QPainter::transformForAngle(qreal angle)
QTransform rotTrans2;
rotTrans2.translate(40, 0);
- qreal rad = angle * 2. * M_PI / 360.;
+ qreal rad = qDegreesToRadians(angle);
qreal c = ::cos(rad);
qreal s = ::sin(rad);