summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2011-08-01 14:38:36 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-02 07:37:27 +0200
commit95d9a0c25c207c7dfc5fa228e90a2eb873b2ecbc (patch)
tree10eb626171c3ee152edb5c7171530281210bb0f2 /tests
parentc07e1130d9fbfec2aeda2248341858b12a99fb93 (diff)
test: remove CONFIG+=insignificant_test for tst_qgraphicstransform
This autotest failure is stable, so it should be marked with QEXPECT_FAIL, not CONFIG+=insignificant_test. Note that the test row naming had to be changed, as the test previously created many rows of testdata with the same name, making it impossible to skip only the broken rows. Task-number: QTBUG-20661 Change-Id: Ie38f5dddafe7686e30eaa8ff3445310935d2cd9a Reviewed-on: http://codereview.qt.nokia.com/2419 Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicstransform/qgraphicstransform.pro2
-rw-r--r--tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp58
2 files changed, 52 insertions, 8 deletions
diff --git a/tests/auto/qgraphicstransform/qgraphicstransform.pro b/tests/auto/qgraphicstransform/qgraphicstransform.pro
index b5e8f34c74..67c939ed8b 100644
--- a/tests/auto/qgraphicstransform/qgraphicstransform.pro
+++ b/tests/auto/qgraphicstransform/qgraphicstransform.pro
@@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qgraphicstransform.cpp
CONFIG += parallel_test
-
-CONFIG+=insignificant_test
diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
index f229ee7d5f..7b928909ff 100644
--- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
+++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
@@ -61,6 +61,9 @@ private slots:
void rotation3d();
void rotation3dArbitraryAxis_data();
void rotation3dArbitraryAxis();
+
+private:
+ QString toString(QTransform const&);
};
@@ -305,6 +308,15 @@ void tst_QGraphicsTransform::rotation3d()
QVERIFY(transform2D(rotation).isIdentity());
}
+QByteArray labelForTest(QVector3D const& axis, int angle) {
+ return QString("rotation of %1 on (%2, %3, %4)")
+ .arg(angle)
+ .arg(axis.x())
+ .arg(axis.y())
+ .arg(axis.z())
+ .toLatin1();
+}
+
void tst_QGraphicsTransform::rotation3dArbitraryAxis_data()
{
QTest::addColumn<QVector3D>("axis");
@@ -317,11 +329,11 @@ void tst_QGraphicsTransform::rotation3dArbitraryAxis_data()
QVector3D axis5 = QVector3D(0.01f, 0.01f, 0.01f);
for (int angle = 0; angle <= 360; angle++) {
- QTest::newRow("test rotation on (1, 1, 1)") << axis1 << qreal(angle);
- QTest::newRow("test rotation on (2, -3, .5)") << axis2 << qreal(angle);
- QTest::newRow("test rotation on (-2, 0, -.5)") << axis3 << qreal(angle);
- QTest::newRow("test rotation on (.0001, .0001, .0001)") << axis4 << qreal(angle);
- QTest::newRow("test rotation on (.01, .01, .01)") << axis5 << qreal(angle);
+ QTest::newRow(labelForTest(axis1, angle).constData()) << axis1 << qreal(angle);
+ QTest::newRow(labelForTest(axis2, angle).constData()) << axis2 << qreal(angle);
+ QTest::newRow(labelForTest(axis3, angle).constData()) << axis3 << qreal(angle);
+ QTest::newRow(labelForTest(axis4, angle).constData()) << axis4 << qreal(angle);
+ QTest::newRow(labelForTest(axis5, angle).constData()) << axis5 << qreal(angle);
}
}
@@ -347,7 +359,26 @@ void tst_QGraphicsTransform::rotation3dArbitraryAxis()
exp.rotate(angle, axis);
QTransform expected = exp.toTransform(1024.0f);
- QVERIFY(fuzzyCompare(transform2D(rotation), expected));
+#ifdef Q_OS_LINUX
+ // These failures possibly relate to the float vs qreal issue mentioned
+ // in the comment above fuzzyCompare().
+ if (sizeof(qreal) == sizeof(double)) {
+ QEXPECT_FAIL("rotation of 120 on (1, 1, 1)", "QTBUG-20661", Abort);
+ QEXPECT_FAIL("rotation of 240 on (1, 1, 1)", "QTBUG-20661", Abort);
+ QEXPECT_FAIL("rotation of 120 on (0.01, 0.01, 0.01)", "QTBUG-20661", Abort);
+ QEXPECT_FAIL("rotation of 240 on (0.01, 0.01, 0.01)", "QTBUG-20661", Abort);
+ QEXPECT_FAIL("rotation of 120 on (0.0001, 0.0001, 0.0001)", "QTBUG-20661", Abort);
+ QEXPECT_FAIL("rotation of 240 on (0.0001, 0.0001, 0.0001)", "QTBUG-20661", Abort);
+ }
+#endif
+
+ QTransform actual = transform2D(rotation);
+ QVERIFY2(fuzzyCompare(actual, expected), qPrintable(
+ QString("\nactual: %1\n"
+ "expected: %2")
+ .arg(toString(actual))
+ .arg(toString(expected))
+ ));
// Check that "rotation" produces the 4x4 form of the 3x3 matrix.
// i.e. third row and column are 0 0 1 0.
@@ -357,6 +388,21 @@ void tst_QGraphicsTransform::rotation3dArbitraryAxis()
QVERIFY(qFuzzyCompare(t, r));
}
+QString tst_QGraphicsTransform::toString(QTransform const& t)
+{
+ return QString("[ [ %1 %2 %3 ]; [ %4 %5 %6 ]; [ %7 %8 %9 ] ]")
+ .arg(t.m11())
+ .arg(t.m12())
+ .arg(t.m13())
+ .arg(t.m21())
+ .arg(t.m22())
+ .arg(t.m23())
+ .arg(t.m31())
+ .arg(t.m32())
+ .arg(t.m33())
+ ;
+}
+
QTEST_MAIN(tst_QGraphicsTransform)
#include "tst_qgraphicstransform.moc"