diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2024-04-05 14:52:27 +0200 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2024-05-10 15:33:40 +0200 |
commit | 9bedf8a53c8127effb7ab6f331986b967d9c1254 (patch) | |
tree | 0f34d8d2a0f77ffb9696898cb384009659bd9cc2 /tests/auto/corelib/tools | |
parent | 7072030d933e0575bab46994406530c8c1f81f5d (diff) |
QLineF: add qFuzzyCompare and qFuzzyIsNull overloads
[ChangeLog][QtCore][QLineF] Added qFuzzyCompare and qFuzzyIsNull
overloads for QLineF
Task-number: QTBUG-120308
Change-Id: I3d032f47851d886adce95ac72109fde169892688
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r-- | tests/auto/corelib/tools/qline/tst_qline.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qline/tst_qline.cpp b/tests/auto/corelib/tools/qline/tst_qline.cpp index 3954cf5326..10069e821b 100644 --- a/tests/auto/corelib/tools/qline/tst_qline.cpp +++ b/tests/auto/corelib/tools/qline/tst_qline.cpp @@ -16,6 +16,9 @@ private slots: void testComparison_data(); void testComparison(); + void testFuzzyCompare_data(); + void testFuzzyCompare(); + void testIsNull_data(); void testIsNull(); @@ -116,6 +119,29 @@ void tst_QLine::testComparison() QT_TEST_EQUALITY_OPS(l1f, l2, mixedResult); } +void tst_QLine::testFuzzyCompare_data() +{ + testComparison_data(); +} + +void tst_QLine::testFuzzyCompare() +{ + QFETCH(double, xa1); + QFETCH(double, ya1); + QFETCH(double, xa2); + QFETCH(double, ya2); + QFETCH(double, xb1); + QFETCH(double, yb1); + QFETCH(double, xb2); + QFETCH(double, yb2); + QFETCH(bool, floatResult); + + const QLineF l1f(xa1, ya1, xa2, ya2); + const QLineF l2f(xb1, yb1, xb2, yb2); + + QCOMPARE_EQ(qFuzzyCompare(l1f, l2f), floatResult); +} + void tst_QLine::testIsNull_data() { QTest::addColumn<QLineF>("lineF"); @@ -138,6 +164,7 @@ void tst_QLine::testIsNull() QCOMPARE_EQ(line.isNull(), result); QCOMPARE_EQ(lineF.isNull(), floatResult); + QCOMPARE_EQ(qFuzzyIsNull(lineF), floatResult); } void tst_QLine::testSet() |