summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/global/qcomparehelpers/tst_qcomparehelpers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/global/qcomparehelpers/tst_qcomparehelpers.cpp')
-rw-r--r--tests/auto/corelib/global/qcomparehelpers/tst_qcomparehelpers.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/auto/corelib/global/qcomparehelpers/tst_qcomparehelpers.cpp b/tests/auto/corelib/global/qcomparehelpers/tst_qcomparehelpers.cpp
index f140c23ed0..466723a271 100644
--- a/tests/auto/corelib/global/qcomparehelpers/tst_qcomparehelpers.cpp
+++ b/tests/auto/corelib/global/qcomparehelpers/tst_qcomparehelpers.cpp
@@ -581,20 +581,46 @@ void tst_QCompareHelpers::builtinOrder()
Qt::strong_ordering::equivalent);
std::array<int, 2> arr{1, 0};
+#if QT_DEPRECATED_SINCE(6, 8)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QCOMPARE_EQ(Qt::compareThreeWay(&arr[0], &arr[1]), Qt::strong_ordering::less);
QCOMPARE_EQ(Qt::compareThreeWay(arr.data(), &arr[0]), Qt::strong_ordering::equivalent);
+QT_WARNING_POP
+#endif // QT_DEPRECATED_SINCE(6, 8)
class Base {};
class Derived : public Base {};
auto b = std::make_unique<Base>();
auto d = std::make_unique<Derived>();
+#if QT_DEPRECATED_SINCE(6, 8)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QCOMPARE_NE(Qt::compareThreeWay(b.get(), d.get()), Qt::strong_ordering::equivalent);
QCOMPARE_EQ(Qt::compareThreeWay(b.get(), nullptr), Qt::strong_ordering::greater);
QCOMPARE_EQ(Qt::compareThreeWay(nullptr, d.get()), Qt::strong_ordering::less);
+QT_WARNING_POP
+#endif // QT_DEPRECATED_SINCE(6, 8)
+
+ // Check Qt::totally_ordered_wrapper
+ auto a0 = Qt::totally_ordered_wrapper(&arr[0]);
+ auto a1 = Qt::totally_ordered_wrapper(&arr[1]);
+ QCOMPARE_EQ(Qt::compareThreeWay(a0, a1), Qt::strong_ordering::less);
+ QCOMPARE_EQ(Qt::compareThreeWay(arr.data(), a0), Qt::strong_ordering::equivalent);
+
+ auto bWrapper = Qt::totally_ordered_wrapper(b.get());
+ auto dWrapper = Qt::totally_ordered_wrapper(d.get());
+ QCOMPARE_NE(Qt::compareThreeWay(bWrapper, dWrapper), Qt::strong_ordering::equivalent);
+ QCOMPARE_NE(Qt::compareThreeWay(bWrapper, d.get()), Qt::strong_ordering::equivalent);
+ QCOMPARE_NE(Qt::compareThreeWay(b.get(), dWrapper), Qt::strong_ordering::equivalent);
+ QCOMPARE_EQ(Qt::compareThreeWay(bWrapper, nullptr), Qt::strong_ordering::greater);
+ QCOMPARE_EQ(Qt::compareThreeWay(nullptr, dWrapper), Qt::strong_ordering::less);
+ dWrapper.reset(nullptr);
+ QCOMPARE_EQ(Qt::compareThreeWay(nullptr, dWrapper), Qt::strong_ordering::equivalent);
#undef TEST_BUILTIN
}
QTEST_MAIN(tst_QCompareHelpers)
-#include "tst_qcomparehelpers.moc"
+#include "moc_tst_qcomparehelpers.cpp"