diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-06-24 13:38:42 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 13:00:43 +0200 |
commit | a0deaf42e2bd8b5d773e75ce5fd0851335f4ba9b (patch) | |
tree | 754cd070b8b9c8ad5cba4d965ff97713d2ee6900 /tests | |
parent | 927813fc958a1b6876ae442b6e5e48de842724fd (diff) |
Improve QRectF::toRect()
Implement the better rounding mechanism that was previously blocked
by requiring C++14 to be constexpr.
Change-Id: I4e5b179ce0703f5c0b41c3f0ea00d28dfe53740c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/tools/qrect/tst_qrect.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/auto/corelib/tools/qrect/tst_qrect.cpp b/tests/auto/corelib/tools/qrect/tst_qrect.cpp index 60c48a3f55..d65dba6e37 100644 --- a/tests/auto/corelib/tools/qrect/tst_qrect.cpp +++ b/tests/auto/corelib/tools/qrect/tst_qrect.cpp @@ -4373,12 +4373,12 @@ void tst_QRect::toRect() for (qreal h = 1.0; h < 2.0; h += 0.25) { const QRectF rectf(x, y, w, h); const QRectF rect = rectf.toRect(); - QVERIFY(qAbs(rect.x() - rectf.x()) < 1.0); - QVERIFY(qAbs(rect.y() - rectf.y()) < 1.0); - QVERIFY(qAbs(rect.width() - rectf.width()) < 1.0); - QVERIFY(qAbs(rect.height() - rectf.height()) < 1.0); - QVERIFY(qAbs(rect.right() - rectf.right()) < 1.0); - QVERIFY(qAbs(rect.bottom() - rectf.bottom()) < 1.0); + QVERIFY(qAbs(rect.x() - rectf.x()) <= 0.75); + QVERIFY(qAbs(rect.y() - rectf.y()) <= 0.75); + QVERIFY(qAbs(rect.width() - rectf.width()) <= 0.75); + QVERIFY(qAbs(rect.height() - rectf.height()) <= 0.75); + QVERIFY(qAbs(rect.right() - rectf.right()) <= 0.75); + QVERIFY(qAbs(rect.bottom() - rectf.bottom()) <= 0.75); const QRectF arect = rectf.toAlignedRect(); QVERIFY(qAbs(arect.x() - rectf.x()) < 1.0); |