summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2024-04-26 13:07:28 +0200
committerIvan Solovev <ivan.solovev@qt.io>2024-05-10 16:31:28 +0200
commita4341827ac17c14541ea69c67c76aaae5a09ddcc (patch)
tree4d3c3446e2b22f95525d71900bb6cad374b918e6 /tests/auto/corelib
parent473d06970d224b202e7a8ee8feaa2a2d98d5b257 (diff)
QEasingCurve: use comparison helper macros
Like with the QLine(F) case, we have to use QT_CORE_REMOVED_SINCE to remove the old member operators, but also need to guard the new friend functions with !(QT_CORE_REMOVED_SINCE), because QEasingCurve is also one of the core types, and on Windows the metatype interface for it is instantiated in removed_api.cpp. Task-number: QTBUG-120308 Change-Id: I1bd66f7230afd3eba868d05fd496ab13a0331178 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/tools/qeasingcurve/CMakeLists.txt2
-rw-r--r--tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp25
2 files changed, 18 insertions, 9 deletions
diff --git a/tests/auto/corelib/tools/qeasingcurve/CMakeLists.txt b/tests/auto/corelib/tools/qeasingcurve/CMakeLists.txt
index 3f76f8a38f..2569e0c7a9 100644
--- a/tests/auto/corelib/tools/qeasingcurve/CMakeLists.txt
+++ b/tests/auto/corelib/tools/qeasingcurve/CMakeLists.txt
@@ -14,4 +14,6 @@ endif()
qt_internal_add_test(tst_qeasingcurve
SOURCES
tst_qeasingcurve.cpp
+ LIBRARIES
+ Qt::TestPrivate
)
diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
index fc8c1a3e5c..0a933a1e2b 100644
--- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
+++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
+#include <private/qcomparisontesthelper_p.h>
#include <qeasingcurve.h>
@@ -16,6 +17,7 @@ private slots:
void valueForProgress_data();
void valueForProgress();
void setCustomType();
+ void comparisonCompiles();
void operators();
void properties();
void metaTypes();
@@ -420,6 +422,11 @@ void tst_QEasingCurve::setCustomType()
QCOMPARE(curve.valueForProgress(0.99), 0.99);
}
+void tst_QEasingCurve::comparisonCompiles()
+{
+ QTestPrivate::testEqualityOperatorsCompile<QEasingCurve>();
+}
+
void tst_QEasingCurve::operators()
{
{ // member-swap()
@@ -447,28 +454,28 @@ void tst_QEasingCurve::operators()
curve2 = curve;
curve2.setOvershoot(qreal(1.70158));
QCOMPARE(curve.overshoot(), curve2.overshoot());
- QVERIFY(curve2 == curve);
+ QT_TEST_EQUALITY_OPS(curve2, curve, true);
curve.setOvershoot(3.0);
- QVERIFY(curve2 != curve);
+ QT_TEST_EQUALITY_OPS(curve2, curve, false);
curve2.setOvershoot(3.0);
- QVERIFY(curve2 == curve);
+ QT_TEST_EQUALITY_OPS(curve2, curve, true);
curve2.setType(QEasingCurve::Linear);
QCOMPARE(curve.overshoot(), curve2.overshoot());
- QVERIFY(curve2 != curve);
+ QT_TEST_EQUALITY_OPS(curve2, curve, false);
curve2.setType(QEasingCurve::InBack);
QCOMPARE(curve.overshoot(), curve2.overshoot());
- QVERIFY(curve2 == curve);
+ QT_TEST_EQUALITY_OPS(curve2, curve, true);
QEasingCurve curve3;
QEasingCurve curve4;
curve4.setAmplitude(curve4.amplitude());
QEasingCurve curve5;
curve5.setAmplitude(0.12345);
- QVERIFY(curve3 == curve4); // default value and not assigned
- QVERIFY(curve3 != curve5); // unassinged and other value
- QVERIFY(curve4 != curve5);
+ QT_TEST_EQUALITY_OPS(curve3, curve4, true); // default value and not assigned
+ QT_TEST_EQUALITY_OPS(curve3, curve5, false); // unassinged and other value
+ QT_TEST_EQUALITY_OPS(curve4, curve5, false);
}
class tst_QEasingProperties : public QObject
@@ -890,7 +897,7 @@ void tst_QEasingCurve::streamInOut()
dsw << orig;
dsr >> copy;
- QCOMPARE(copy == orig, equality);
+ QT_TEST_EQUALITY_OPS(copy, orig, equality);
}
QTEST_MAIN(tst_QEasingCurve)