diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2013-08-18 18:43:18 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-19 14:24:28 +0200 |
commit | 76f32cadb227a8d0a0371e518b9ad99344acf44f (patch) | |
tree | cb5de08457e961191693033f98a207f4029d6a4d /tests | |
parent | a45d8edb6c2e234902202f55a0d6ee2f2ba60f5d (diff) |
Fix QGraphics(Ellipse)Item autotest
Change-Id: I6d5d702e97a0186979bd3bdcd0526d53afeecbd8
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
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)); |