diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2011-03-14 11:53:44 (GMT) |
---|---|---|
committer | Timo Turunen <timo.p.turunen@nokia.com> | 2011-03-16 07:46:59 (GMT) |
commit | 3fa85afd04ba67c762ca7489c63b4bfc4a6deac0 (patch) | |
tree | dbf45cde41cdf6f1d4ec609b7f63059ce1010ee3 /tests/auto | |
parent | cc016cc9cfba9b35a852399603c6d3f99e31af58 (diff) | |
download | Qt-3fa85afd04ba67c762ca7489c63b4bfc4a6deac0.zip Qt-3fa85afd04ba67c762ca7489c63b4bfc4a6deac0.tar.gz Qt-3fa85afd04ba67c762ca7489c63b4bfc4a6deac0.tar.bz2 |
Fix qgraphicstransform autotest for Symbian, where qreal is float.
Task-number: QTBUG-17907
Reviewed-by: Samuel Rødal
(cherry picked from commit 99aa67f649c44dda8c0da639b4925dbb0e4c9b70)
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index fe66ffa..c8de7fd 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 |