summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicstransform
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-03-14 11:53:44 (GMT)
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-03-14 12:09:05 (GMT)
commit99aa67f649c44dda8c0da639b4925dbb0e4c9b70 (patch)
treebdb3d545193a13c3eea70d331310eaa442d24075 /tests/auto/qgraphicstransform
parentd8aa0f54f8e6f5d2a95965203b7f60c11297dacf (diff)
downloadQt-99aa67f649c44dda8c0da639b4925dbb0e4c9b70.zip
Qt-99aa67f649c44dda8c0da639b4925dbb0e4c9b70.tar.gz
Qt-99aa67f649c44dda8c0da639b4925dbb0e4c9b70.tar.bz2
Fix qgraphicstransform autotest for Symbian, where qreal is float.
Task-number: QTBUG-17907 Reviewed-by: Samuel Rødal
Diffstat (limited to 'tests/auto/qgraphicstransform')
-rw-r--r--tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
index 79f2213..9434a0b 100644
--- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
+++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
@@ -163,10 +163,11 @@ static inline bool fuzzyCompare(qreal p1, qreal p2)
{
// increase delta on small machines using float instead of double
if (sizeof(qreal) == sizeof(float))
- return (qAbs(p1 - p2) <= 0.00002f * qMin(qAbs(p1), qAbs(p2)));
+ return (qAbs(p1 - p2) <= 0.00003f * qMin(qAbs(p1), qAbs(p2)));
else
return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2)));
}
+
static bool fuzzyCompare(const QTransform& t1, const QTransform& t2)
{
return fuzzyCompare(t1.m11(), t2.m11()) &&
@@ -180,6 +181,15 @@ static bool fuzzyCompare(const QTransform& t1, const QTransform& t2)
fuzzyCompare(t1.m33(), t2.m33());
}
+static inline bool fuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2)
+{
+ bool ok = true;
+ for (int y = 0; y < 4; ++y)
+ for (int x = 0; x < 4; ++x)
+ ok &= fuzzyCompare(m1(y, x), m2(y, x));
+ return ok;
+}
+
void tst_QGraphicsTransform::rotation()
{
QGraphicsRotation rotation;
@@ -267,7 +277,7 @@ void tst_QGraphicsTransform::rotation3d()
// because the deg2rad value in QTransform is not accurate
// enough to match what QMatrix4x4 is doing.
} else {
- QVERIFY(qFuzzyCompare(t, r));
+ QVERIFY(fuzzyCompare(t, r));
}
//now let's check that a null vector will not change the transform