From 99aa67f649c44dda8c0da639b4925dbb0e4c9b70 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 14 Mar 2011 13:53:44 +0200 Subject: Fix qgraphicstransform autotest for Symbian, where qreal is float. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-17907 Reviewed-by: Samuel Rødal --- tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'tests/auto/qgraphicstransform') diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index 79f22138fc..9434a0b6a4 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 -- cgit v1.2.3