summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-03-21 10:22:17 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-03-22 02:54:15 +0100
commitb20da0ba2844b1ecbb7b128f3075f7285673b604 (patch)
treee6453ba621d90c25af1800d59bfb6eb24171205b /tests/auto/corelib/global/qglobal/tst_qglobal.cpp
parent44cbd84968c9dec387d3ea522c5a5eee5ea628e9 (diff)
tst_qglobal: add a few tests for QTypeInfo
Change-Id: Iff4d8d9488d5b414d4504bc700b3191c799bf86c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/global/qglobal/tst_qglobal.cpp')
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index c2f2912144..1a19048bbe 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -883,5 +883,54 @@ void tst_QGlobal::nodiscard()
QCOMPARE(t2.get(), 42);
}
+QT_BEGIN_NAMESPACE
+
+// Compile-time typeinfo tests
+struct Complex1
+{
+ ~Complex1();
+};
+static_assert(QTypeInfo<Complex1>::isComplex);
+static_assert(!QTypeInfo<Complex1>::isRelocatable);
+
+struct Complex2
+{
+ Complex2(Complex2 &&);
+};
+static_assert(QTypeInfo<Complex2>::isComplex);
+static_assert(!QTypeInfo<Complex2>::isRelocatable);
+
+struct Complex3
+{
+ Complex3(int);
+};
+static_assert(QTypeInfo<Complex3>::isComplex);
+static_assert(QTypeInfo<Complex3>::isRelocatable);
+
+struct Relocatable1
+{
+ ~Relocatable1();
+};
+Q_DECLARE_TYPEINFO(Relocatable1, Q_RELOCATABLE_TYPE);
+static_assert(QTypeInfo<Relocatable1>::isComplex);
+static_assert(QTypeInfo<Relocatable1>::isRelocatable);
+
+struct Relocatable2
+{
+ Relocatable2(int);
+};
+Q_DECLARE_TYPEINFO(Relocatable2, Q_RELOCATABLE_TYPE);
+static_assert(QTypeInfo<Relocatable2>::isComplex);
+static_assert(QTypeInfo<Relocatable2>::isRelocatable);
+
+struct Trivial1
+{
+ int x[42];
+};
+static_assert(!QTypeInfo<Trivial1>::isComplex);
+static_assert(QTypeInfo<Trivial1>::isRelocatable);
+
+QT_END_NAMESPACE
+
QTEST_APPLESS_MAIN(tst_QGlobal)
#include "tst_qglobal.moc"