Fix tst_qquickpath not to use fuzzy compare
authorRafael Roquetto <rafael.roquetto.qnx@kdab.com>
Tue, 30 Jul 2013 20:07:48 +0000 (17:07 -0300)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 2 Aug 2013 13:03:09 +0000 (15:03 +0200)
On arm platforms, qreal == float. QPointF stores its coordinates internally on
qreal variables (float on arm). When QPointF comparison takes place, a call to
qFuzzyIsNull(float) will ultimately be triggered, causing the test to fail for
some values, because the epsilon of 0.00001f is too small.

In the particular case regarding BB10, the comparison between QPointF(100,
150) and QPointF(99.9999771, 150) is failing because of that.

Change-Id: I53c8cfe7f8a975f6a015e7690702d3e5f05bc2f2
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
tests/auto/quick/qquickpath/tst_qquickpath.cpp

index fa68442..6ecc5ce 100644 (file)
@@ -128,7 +128,7 @@ void tst_QuickPath::catmullromCurve()
     pos = obj->pointAt(.75);
     QCOMPARE(pos.toPoint(), QPoint(51,105)); //fuzzy compare
     pos = obj->pointAt(1);
-    QCOMPARE(pos, QPointF(100,150));
+    QCOMPARE(pos.toPoint(), QPoint(100,150));
 }
 
 void tst_QuickPath::closedCatmullromCurve()
@@ -227,7 +227,7 @@ void tst_QuickPath::line()
         QCOMPARE(p1.x(), p1.y());
 
         QPointF p2 = path2->pointAt(t);
-        QCOMPARE(p1, p2);
+        QCOMPARE(p1.toPoint(), p2.toPoint());
     }
 }