diff options
Diffstat (limited to 'tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp')
-rw-r--r-- | tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp index 350be3da6a..8cdc06354e 100644 --- a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp +++ b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp @@ -1,5 +1,7 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses #include <QTest> #include <QtCore/qmath.h> @@ -575,7 +577,7 @@ void tst_QQuaternion::multiply_data() for (float x = -1.0f; x <= 1.0f; x += 0.5f) for (float y = -1.0f; y <= 1.0f; y += 0.5f) for (float z = -1.0f; z <= 1.0f; z += 0.5f) { - QTest::newRow("exhaustive") + QTest::addRow("exhaustive: (%.1f, %.1f, %.1f), %.1f", x, y, z, w) << x << y << z << w << z << w << y << x; } @@ -962,28 +964,6 @@ void tst_QQuaternion::rotationTo() QVERIFY(myFuzzyCompare(vec2, from)); } -static QByteArray testnameForAxis(const QVector3D &axis) -{ - QByteArray testname; - if (axis == QVector3D()) { - testname = "null"; - } else { - if (axis.x()) { - testname += axis.x() < 0 ? '-' : '+'; - testname += 'X'; - } - if (axis.y()) { - testname += axis.y() < 0 ? '-' : '+'; - testname += 'Y'; - } - if (axis.z()) { - testname += axis.z() < 0 ? '-' : '+'; - testname += 'Z'; - } - } - return testname; -} - // Test quaternion convertion to and from orthonormal axes. void tst_QQuaternion::fromDirection_data() { @@ -1006,7 +986,10 @@ void tst_QQuaternion::fromDirection_data() QVector3D xAxis, yAxis, zAxis; q.getAxes(&xAxis, &yAxis, &zAxis); - QTest::newRow("dir: " + testnameForAxis(zAxis) + ", up: " + testnameForAxis(yAxis)) + QTest::addRow("ortho dirs: (%.1f,%.1f,%.1f), (%.1f,%.1f,%.1f), (%.1f,%.1f,%.1f)", + xAxis.x(), xAxis.y(), xAxis.z(), + yAxis.x(), yAxis.y(), yAxis.z(), + zAxis.x(), zAxis.y(), zAxis.z()) << zAxis * 10.0f << yAxis * 10.0f; } @@ -1025,7 +1008,10 @@ void tst_QQuaternion::fromDirection_data() QVector3D xAxis, yAxis, zAxis; q.getAxes(&xAxis, &yAxis, &zAxis); - QTest::newRow("dir: " + testnameForAxis(zAxis) + ", up: null") + QTest::addRow("bad dirs: (%.1f,%.1f,%.1f), (%.1f,%.1f,%.1f), (%.1f,%.1f,%.1f)", + xAxis.x(), xAxis.y(), xAxis.z(), + yAxis.x(), yAxis.y(), yAxis.z(), + zAxis.x(), zAxis.y(), zAxis.z()) << zAxis * 10.0f << QVector3D(); } } |