From 76f32cadb227a8d0a0371e518b9ad99344acf44f Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 18 Aug 2013 18:43:18 +0200 Subject: Fix QGraphics(Ellipse)Item autotest Change-Id: I6d5d702e97a0186979bd3bdcd0526d53afeecbd8 Reviewed-by: Olivier Goffart --- .../widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 9353aa0eba..2c03850181 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -4423,10 +4423,13 @@ void tst_QGraphicsItem::defaultItemTest_QGraphicsEllipseItem() QCOMPARE(item.boundingRect(), QRectF(0, 0, 100, 100)); item.setSpanAngle(90 * 16); - qFuzzyCompare(item.boundingRect().left(), qreal(50.0)); - qFuzzyCompare(item.boundingRect().top(), qreal(0.0)); - qFuzzyCompare(item.boundingRect().width(), qreal(50.0)); - qFuzzyCompare(item.boundingRect().height(), qreal(50.0)); + // for some reason, the bounding rect has very few significant digits + // (i.e. it's likely that floats are being used inside it), so we + // must force the conversion from qreals to float or these tests will fail + QCOMPARE(float(item.boundingRect().left()), 50.0f); + QVERIFY(qFuzzyIsNull(float(item.boundingRect().top()))); + QCOMPARE(float(item.boundingRect().width()), 50.0f); + QCOMPARE(float(item.boundingRect().height()), 50.0f); item.setPen(QPen(Qt::black, 1)); QCOMPARE(item.boundingRect(), QRectF(49.5, -0.5, 51, 51)); -- cgit v1.2.3