summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qline/tst_qline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qline/tst_qline.cpp')
-rw-r--r--tests/auto/corelib/tools/qline/tst_qline.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/corelib/tools/qline/tst_qline.cpp b/tests/auto/corelib/tools/qline/tst_qline.cpp
index df167b48ae..8e9d9896dc 100644
--- a/tests/auto/corelib/tools/qline/tst_qline.cpp
+++ b/tests/auto/corelib/tools/qline/tst_qline.cpp
@@ -265,8 +265,8 @@ void tst_QLine::testLength_data()
<< -(tiny * .5) << -(tiny * .5) << (tiny * .5) << (tiny * .5)
<< (tiny * M_SQRT2) << (2 * M_SQRT2) << 2.0 << 2.0;
QTest::newRow("[1+3e-13,1+4e-13]|1895| (1, 1)")
- << 1.0 << 1.0 << (1 + 3e-13) << (1 + 4e-13) // isNull(), so ignores setLength()
- << 5e-13 << 1895.0 << 3e-13 << 4e-13;
+ << 1.0 << 1.0 << (1 + 3e-13) << (1 + 4e-13)
+ << 5e-13 << 1895.0 << 1137.0 << 1516.0;
QTest::newRow("[4e-323,5e-324]|1892|") // Unavoidable underflow: denormals
<< 0.0 << 0.0 << 4e-323 << 5e-324
<< 4e-323 << 1892.0 << 4e-323 << 5e-324; // vx, vy values ignored
@@ -284,14 +284,14 @@ void tst_QLine::testLength()
QFETCH(double, vy);
QLineF l(x1, y1, x2, y2);
- const bool wasNull = l.isNull();
- if (!wasNull)
- QCOMPARE(l.length(), qreal(length));
+ QCOMPARE(l.length(), qreal(length));
l.setLength(lengthToSet);
- QCOMPARE(l.length(), wasNull ? qreal(length) : qreal(lengthToSet));
// Scaling tiny values up to big can be imprecise: don't try to test vx, vy
- if (wasNull || !qFuzzyIsNull(length)) {
+ if (length > 0 && qFuzzyIsNull(length)) {
+ QVERIFY(l.length() > lengthToSet / 2 && l.length() < lengthToSet * 2);
+ } else {
+ QCOMPARE(l.length(), length > 0 ? qreal(lengthToSet) : qreal(length));
QCOMPARE(l.dx(), qreal(vx));
QCOMPARE(l.dy(), qreal(vy));
}