summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2015-02-26 17:45:11 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2015-02-26 20:15:04 +0000
commit4ed795df247c5859089e3a6b6ca7c24e8c973a31 (patch)
tree969acbb9d7ac42fc6f196e69523d9e692edce834 /tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp
parentd07166af645fa65cb7e9f571dbc34eb946463627 (diff)
Use C++ <cmath> instead of <math.h> in math3d autotests
Change-Id: I2e13ec190ec42ac7732ce9ed3ca5567f637beb1e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp')
-rw-r--r--tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp
index a4defcc7f2..ed93ff24b0 100644
--- a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp
+++ b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp
@@ -237,7 +237,7 @@ void tst_QQuaternion::length_data()
QTest::newRow("-1y") << 0.0f << -1.0f << 0.0f << 0.0f << 1.0f;
QTest::newRow("-1z") << 0.0f << 0.0f << -1.0f << 0.0f << 1.0f;
QTest::newRow("-1w") << 0.0f << 0.0f << 0.0f << -1.0f << 1.0f;
- QTest::newRow("two") << 2.0f << -2.0f << 2.0f << 2.0f << sqrtf(16.0f);
+ QTest::newRow("two") << 2.0f << -2.0f << 2.0f << 2.0f << std::sqrt(16.0f);
}
void tst_QQuaternion::length()
{
@@ -710,8 +710,9 @@ 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();
- float sin_a = sinf((angle * M_PI / 180.0) / 2.0);
- float cos_a = cosf((angle * M_PI / 180.0) / 2.0);
+ const float a = (angle * M_PI / 180.0) / 2.0;
+ const float sin_a = std::sin(a);
+ const float cos_a = std::cos(a);
QQuaternion result(cos_a,
(vector.x() * sin_a),
(vector.y() * sin_a),