summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qmetatype
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/kernel/qmetatype')
-rw-r--r--tests/auto/corelib/kernel/qmetatype/CMakeLists.txt9
-rw-r--r--tests/auto/corelib/kernel/qmetatype/lib1.cpp2
-rw-r--r--tests/auto/corelib/kernel/qmetatype/lib2.cpp2
-rw-r--r--tests/auto/corelib/kernel/qmetatype/lib_common.cpp2
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp206
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h7
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp42
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype3.cpp2
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype_common.h5
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype_libs.h2
10 files changed, 255 insertions, 24 deletions
diff --git a/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt b/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt
index 5ae87eb3a3..65bec3e187 100644
--- a/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt
+++ b/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from qmetatype.pro.
-
#####################################################################
## tst_qmetatype Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qmetatype LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
# Collect test data
list(APPEND test_data "./typeFlags.bin")
@@ -47,6 +51,7 @@ qt_internal_add_test(tst_qmetatype
../../../other/qvariant_common
LIBRARIES
Qt::CorePrivate
+ Qt::TestPrivate
Qt::Gui
qmetatype_lib1
qmetatype_lib2
diff --git a/tests/auto/corelib/kernel/qmetatype/lib1.cpp b/tests/auto/corelib/kernel/qmetatype/lib1.cpp
index 6a811241e9..e5478f87d9 100644
--- a/tests/auto/corelib/kernel/qmetatype/lib1.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/lib1.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2022 Intel Corporation
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#define LIB_NAMESPACE Lib1
#include "lib_common.cpp"
diff --git a/tests/auto/corelib/kernel/qmetatype/lib2.cpp b/tests/auto/corelib/kernel/qmetatype/lib2.cpp
index b5a56f6c68..0a905e669a 100644
--- a/tests/auto/corelib/kernel/qmetatype/lib2.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/lib2.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2022 Intel Corporation
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#define LIB_NAMESPACE Lib2
#include "lib_common.cpp"
diff --git a/tests/auto/corelib/kernel/qmetatype/lib_common.cpp b/tests/auto/corelib/kernel/qmetatype/lib_common.cpp
index f0554ec25c..179f539ccc 100644
--- a/tests/auto/corelib/kernel/qmetatype/lib_common.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/lib_common.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2022 Intel Corporation
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <qcollator.h>
#include "tst_qmetatype_libs.h"
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index b611fb146c..81bf5d5ea8 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "tst_qmetatype.h"
@@ -13,6 +13,8 @@
#include <memory>
#include <vector>
+#include <QtCore/qflags.h>
+
Q_DECLARE_METATYPE(QMetaType::Type)
Q_DECLARE_METATYPE(QPartialOrdering)
@@ -121,6 +123,26 @@ static_assert(!QTypeTraits::has_operator_less_than_v<std::tuple<int, Nested2>>);
static_assert(QTypeTraits::has_operator_equal_v<std::tuple<int, Nested2>>);
static_assert(!QTypeTraits::has_operator_less_than_v<std::tuple<int, Nested2>>);
+// optionals of nesteds
+static_assert(QTypeTraits::has_operator_equal_v<std::optional<std::variant<QString>>>);
+static_assert(QTypeTraits::has_operator_less_than_v<std::optional<std::variant<QString>>>);
+static_assert(!QTypeTraits::has_operator_equal_v<std::optional<std::variant<NoOperators>>>);
+static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<std::variant<NoOperators>>>);
+
+static_assert(QTypeTraits::has_operator_equal_v<std::optional<Nested>>);
+static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<Nested>>);
+static_assert(QTypeTraits::has_operator_equal_v<std::optional<std::tuple<int, Nested>>>);
+static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<std::tuple<int, Nested>>>);
+static_assert(QTypeTraits::has_operator_equal_v<std::optional<std::tuple<int, Nested>>>);
+static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<std::tuple<int, Nested>>>);
+
+static_assert(QTypeTraits::has_operator_equal_v<std::optional<Nested2>>);
+static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<Nested2>>);
+static_assert(QTypeTraits::has_operator_equal_v<std::optional<std::tuple<int, Nested2>>>);
+static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<std::tuple<int, Nested2>>>);
+static_assert(QTypeTraits::has_operator_equal_v<std::optional<std::tuple<int, Nested2>>>);
+static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<std::tuple<int, Nested2>>>);
+
}
struct BaseGenericType
@@ -1025,7 +1047,7 @@ template <typename T> void addFlagsRow(const char *name, int id = qMetaTypeId<T>
QTest::newRow(name)
<< id
<< bool(QTypeInfo<T>::isRelocatable)
- << bool(!std::is_trivially_default_constructible_v<T>)
+ << bool(!std::is_default_constructible_v<T> || !QTypeInfo<T>::isValueInitializationBitwiseZero)
<< bool(!std::is_trivially_copy_constructible_v<T>)
<< bool(!std::is_trivially_destructible_v<T>)
<< bool(QtPrivate::IsPointerToTypeDerivedFromQObject<T>::Value)
@@ -1198,7 +1220,7 @@ void tst_QMetaType::flagsBinaryCompatibility6_0_data()
QTest::addColumn<quint32>("flags");
QFile file(QFINDTESTDATA("typeFlags.bin"));
- file.open(QIODevice::ReadOnly);
+ QVERIFY(file.open(QIODevice::ReadOnly));
QList<quint32> buffer;
QDataStream ds(&file);
ds >> buffer;
@@ -1322,6 +1344,132 @@ FOR_EACH_CORE_METATYPE(RETURN_CONSTRUCT_FUNCTION)
TypeTestFunctionGetter::get(type)();
}
+
+namespace TriviallyConstructibleTests {
+
+enum Enum0 {};
+enum class Enum1 {};
+
+static_assert(QTypeInfo<int>::isValueInitializationBitwiseZero);
+static_assert(QTypeInfo<double>::isValueInitializationBitwiseZero);
+static_assert(QTypeInfo<Enum0>::isValueInitializationBitwiseZero);
+static_assert(QTypeInfo<Enum1>::isValueInitializationBitwiseZero);
+static_assert(QTypeInfo<int *>::isValueInitializationBitwiseZero);
+static_assert(QTypeInfo<void *>::isValueInitializationBitwiseZero);
+static_assert(QTypeInfo<std::nullptr_t>::isValueInitializationBitwiseZero);
+
+struct A {};
+struct B { B() {} };
+struct C { ~C() {} };
+struct D { D(int) {} };
+struct E { E() {} ~E() {} };
+struct F { int i; };
+struct G { G() : i(0) {} int i; };
+struct H { constexpr H() : i(0) {} int i; };
+struct I { I() : i(42) {} int i; };
+struct J { constexpr J() : i(42) {} int i; };
+struct K { K() : i(0) {} ~K() {} int i; };
+
+static_assert(!QTypeInfo<A>::isValueInitializationBitwiseZero);
+static_assert(!QTypeInfo<B>::isValueInitializationBitwiseZero);
+static_assert(!QTypeInfo<C>::isValueInitializationBitwiseZero);
+static_assert(!QTypeInfo<D>::isValueInitializationBitwiseZero);
+static_assert(!QTypeInfo<E>::isValueInitializationBitwiseZero);
+static_assert(!QTypeInfo<F>::isValueInitializationBitwiseZero);
+static_assert(!QTypeInfo<G>::isValueInitializationBitwiseZero);
+static_assert(!QTypeInfo<H>::isValueInitializationBitwiseZero);
+static_assert(!QTypeInfo<I>::isValueInitializationBitwiseZero);
+static_assert(!QTypeInfo<J>::isValueInitializationBitwiseZero);
+static_assert(!QTypeInfo<K>::isValueInitializationBitwiseZero);
+
+} // namespace TriviallyConstructibleTests
+
+// Value-initializing these trivially constructible types cannot be achieved by
+// memset(0) into their storage. For instance, on Itanium, a pointer to a data
+// member needs to be value-initialized by setting it to -1.
+
+// Fits into QVariant
+struct TrivialTypeNotZeroInitableSmall {
+ int TrivialTypeNotZeroInitableSmall::*pdm;
+};
+
+static_assert(std::is_trivially_default_constructible_v<TrivialTypeNotZeroInitableSmall>);
+static_assert(!QTypeInfo<TrivialTypeNotZeroInitableSmall>::isValueInitializationBitwiseZero);
+static_assert(sizeof(TrivialTypeNotZeroInitableSmall) < sizeof(QVariant)); // also checked more thoroughly below
+
+// Does not fit into QVariant internal storage
+struct TrivialTypeNotZeroInitableBig {
+ int a;
+ double b;
+ char c;
+ int array[42];
+ void (TrivialTypeNotZeroInitableBig::*pmf)();
+ int TrivialTypeNotZeroInitableBig::*pdm;
+};
+
+static_assert(std::is_trivially_default_constructible_v<TrivialTypeNotZeroInitableBig>);
+static_assert(!QTypeInfo<TrivialTypeNotZeroInitableSmall>::isValueInitializationBitwiseZero);
+static_assert(sizeof(TrivialTypeNotZeroInitableBig) > sizeof(QVariant)); // also checked more thoroughly below
+
+void tst_QMetaType::defaultConstructTrivial_QTBUG_109594()
+{
+ // MSVC miscompiles value-initialization of pointers to data members,
+ // https://developercommunity.visualstudio.com/t/Pointer-to-data-member-is-not-initialize/10238905
+ {
+ QMetaType mt = QMetaType::fromType<TrivialTypeNotZeroInitableSmall>();
+ QVERIFY(mt.isDefaultConstructible());
+ auto ptr = static_cast<TrivialTypeNotZeroInitableSmall *>(mt.create());
+ const auto cleanup = qScopeGuard([=] {
+ mt.destroy(ptr);
+ });
+#ifdef Q_CC_MSVC_ONLY
+ QEXPECT_FAIL("", "MSVC compiler bug", Continue);
+#endif
+ QCOMPARE(ptr->pdm, nullptr);
+
+ QVariant v(mt);
+ QVERIFY(QVariant::Private::canUseInternalSpace(mt.iface()));
+ auto obj = v.value<TrivialTypeNotZeroInitableSmall>();
+#ifdef Q_CC_MSVC_ONLY
+ QEXPECT_FAIL("", "MSVC compiler bug", Continue);
+#endif
+ QCOMPARE(obj.pdm, nullptr);
+ }
+
+ {
+ QMetaType mt = QMetaType::fromType<TrivialTypeNotZeroInitableBig>();
+ QVERIFY(mt.isDefaultConstructible());
+ auto ptr = static_cast<TrivialTypeNotZeroInitableBig *>(mt.create());
+ const auto cleanup = qScopeGuard([=] {
+ mt.destroy(ptr);
+ });
+ QCOMPARE(ptr->a, 0);
+ QCOMPARE(ptr->b, 0.0);
+ QCOMPARE(ptr->c, '\0');
+ QCOMPARE(ptr->pmf, nullptr);
+ for (int i : ptr->array)
+ QCOMPARE(i, 0);
+#ifdef Q_CC_MSVC_ONLY
+ QEXPECT_FAIL("", "MSVC compiler bug", Continue);
+#endif
+ QCOMPARE(ptr->pdm, nullptr);
+
+ QVariant v(mt);
+ QVERIFY(!QVariant::Private::canUseInternalSpace(mt.iface()));
+ auto obj = v.value<TrivialTypeNotZeroInitableBig>();
+ QCOMPARE(obj.a, 0);
+ QCOMPARE(obj.b, 0.0);
+ QCOMPARE(obj.c, '\0');
+ QCOMPARE(obj.pmf, nullptr);
+ for (int i : obj.array)
+ QCOMPARE(i, 0);
+#ifdef Q_CC_MSVC_ONLY
+ QEXPECT_FAIL("", "MSVC compiler bug", Continue);
+#endif
+ QCOMPARE(obj.pdm, nullptr);
+ }
+}
+
void tst_QMetaType::typedConstruct()
{
auto testMetaObjectWriteOnGadget = [](QVariant &gadget, const QList<GadgetPropertyType> &properties)
@@ -1712,6 +1860,58 @@ void tst_QMetaType::isEnum()
QVERIFY((QMetaType(type6).flags() & QMetaType::IsEnumeration) == QMetaType::IsEnumeration);
}
+enum E1 : unsigned char {};
+enum E2 : qlonglong {};
+enum class E3 : unsigned short {};
+
+namespace myflags {
+
+ Q_NAMESPACE
+
+ enum Flag1 : int { A, B };
+ enum Flag2 : short { X, Y };
+
+ Q_DECLARE_FLAGS(Flags1, myflags::Flag1);
+ Q_FLAG_NS(Flags1)
+ Q_DECLARE_FLAGS(Flags2, myflags::Flag2);
+ Q_FLAG_NS(Flags2)
+
+}
+
+template <typename T>
+using getUnderlyingTypeNormalized = std::conditional_t<
+ std::is_signed_v<std::underlying_type_t<T>>,
+ typename QIntegerForSize<sizeof(T)>::Signed,
+ typename QIntegerForSize<sizeof(T)>::Unsigned
+>;
+
+void tst_QMetaType::underlyingType_data()
+{
+ QTest::addColumn<QMetaType>("source");
+ QTest::addColumn<QMetaType>("underlying");
+
+ QTest::newRow("invalid") << QMetaType() << QMetaType();
+ QTest::newRow("plain") << QMetaType::fromType<isEnumTest_Enum1>()
+ << QMetaType::fromType<getUnderlyingTypeNormalized<isEnumTest_Enum1>>();
+ QTest::newRow("uchar") << QMetaType::fromType<E1>()
+ << QMetaType::fromType<getUnderlyingTypeNormalized<E1>>();
+ QTest::newRow("long") << QMetaType::fromType<E2>()
+ << QMetaType::fromType<getUnderlyingTypeNormalized<E2>>();
+ QTest::newRow("class_ushort") << QMetaType::fromType<E3>()
+ << QMetaType::fromType<getUnderlyingTypeNormalized<E3>>();
+ QTest::newRow("flags_int") << QMetaType::fromType<myflags::Flags1>()
+ << QMetaType::fromType<int>();
+ QTest::newRow("flags_short") << QMetaType::fromType<myflags::Flags2>()
+ << QMetaType::fromType<int>(); // sic, not short!
+}
+
+void tst_QMetaType::underlyingType()
+{
+ QFETCH(QMetaType, source);
+ QFETCH(QMetaType, underlying);
+ QCOMPARE(source.underlyingType(), underlying);
+}
+
void tst_QMetaType::isRegisteredStaticLess_data()
{
isRegistered_data();
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h
index 77feff806f..bcd2fe2def 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include "tst_qmetatype_common.h"
@@ -77,6 +77,7 @@ private slots:
void flagsBinaryCompatibility6_0();
void construct_data();
void construct();
+ void defaultConstructTrivial_QTBUG_109594();
void typedConstruct();
void constructCopy_data();
void constructCopy();
@@ -90,6 +91,8 @@ private slots:
void isRegisteredStaticLess();
void isNotRegistered();
void isEnum();
+ void underlyingType_data();
+ void underlyingType();
void automaticTemplateRegistration_1();
void automaticTemplateRegistration_2(); // defined in tst_qmetatype3.cpp
void saveAndLoadBuiltin_data();
@@ -108,6 +111,7 @@ private slots:
void customDebugStream();
void unknownType();
void fromType();
+ void compareCompiles();
void operatorEq_data();
void operatorEq();
void operatorEq2_data();
@@ -117,6 +121,7 @@ private slots:
void typesWithInaccessibleDTors();
void voidIsNotUnknown();
void typeNameNormalization();
+ void typeNameInQtPrivate();
// Tests for deprecated APIs
#if QT_DEPRECATED_SINCE(6, 0)
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp
index c0650c7b1a..661c1f6072 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp
@@ -1,10 +1,11 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "tst_qmetatype.h"
#include "tst_qmetatype_libs.h"
#include <QtCore/private/qmetaobjectbuilder_p.h>
+#include <QtTest/private/qcomparisontesthelper_p.h>
void tst_QMetaType::constRefs()
{
@@ -418,6 +419,11 @@ struct CharTemplate
} y;
};
+void tst_QMetaType::compareCompiles()
+{
+ QTestPrivate::testEqualityOperatorsCompile<QMetaType>();
+}
+
void tst_QMetaType::operatorEq_data()
{
QTest::addColumn<QMetaType>("typeA");
@@ -447,10 +453,7 @@ void tst_QMetaType::operatorEq()
QFETCH(QMetaType, typeB);
QFETCH(bool, eq);
- QCOMPARE(typeA == typeB, eq);
- QCOMPARE(typeB == typeA, eq);
- QCOMPARE(typeA != typeB, !eq);
- QCOMPARE(typeB != typeA, !eq);
+ QT_TEST_EQUALITY_OPS(typeA, typeB, eq);
#if !defined(Q_OS_WIN) && !defined(Q_OS_INTEGRITY)
// for built-in types or locally-defined types, this must also hold true
@@ -487,10 +490,10 @@ FOR_EACH_CORE_METATYPE(GET_METATYPE_FROM_TYPE)
QCOMPARE(fromId2.id(), type);
// confirm that they're all equal
- QCOMPARE(fromId1, fromId2);
- QCOMPARE(fromType1, fromType2);
- QCOMPARE(fromType1, fromId1);
- QCOMPARE(fromType2, fromId2);
+ QT_TEST_EQUALITY_OPS(fromId1, fromId2, true);
+ QT_TEST_EQUALITY_OPS(fromType1, fromType2, true);
+ QT_TEST_EQUALITY_OPS(fromType1, fromId1, true);
+ QT_TEST_EQUALITY_OPS(fromType2, fromId2, true);
#if !defined(Q_OS_WIN) && !defined(Q_OS_INTEGRITY)
// for built-in types (other than void), this must be true
@@ -541,7 +544,7 @@ void tst_QMetaType::operatorEqAcrossLibs()
// DO THIS FIRST:
// if this isn't a built-in type, then the QMetaTypeInterface::typeId is
// initially set to 0
- QCOMPARE(lib1Type, lib2Type);
+ QT_TEST_EQUALITY_OPS(lib1Type, lib2Type, true);
int actualTypeId = localType.id();
bool builtinTypeExpected = builtinTypeId != QMetaType::UnknownType;
@@ -559,8 +562,8 @@ void tst_QMetaType::operatorEqAcrossLibs()
QCOMPARE(lib2Type.id(), actualTypeId);
QCOMPARE(QByteArray(lib1Type.name()), QByteArray(localType.name()));
QCOMPARE(QByteArray(lib2Type.name()), QByteArray(localType.name()));
- QCOMPARE(lib1Type, localType);
- QCOMPARE(lib2Type, localType);
+ QT_TEST_EQUALITY_OPS(lib1Type, localType, true);
+ QT_TEST_EQUALITY_OPS(lib2Type, localType, true);
#if !defined(Q_OS_WIN) && !defined(Q_OS_INTEGRITY)
if (actualTypeId < QMetaType::FirstGuiType && actualTypeId != QMetaType::Void) {
@@ -640,6 +643,21 @@ void tst_QMetaType::typeNameNormalization()
}
}
+QT_BEGIN_NAMESPACE
+namespace QtPrivate { struct tst_QMetaType_TestType {}; }
+QT_END_NAMESPACE
+
+void tst_QMetaType::typeNameInQtPrivate()
+{
+ using T = QT_PREPEND_NAMESPACE(QtPrivate::tst_QMetaType_TestType);
+
+ // some compilers (GCC) are known to suppress the namespace prefix if the
+ // type and the function where it is expanded on are on the same namespace
+ static constexpr char expectedName[] = "QtPrivate::tst_QMetaType_TestType";
+ QMetaType mt = QMetaType::fromType<T>();
+ QCOMPARE(mt.name(), expectedName);
+}
+
#if QT_DEPRECATED_SINCE(6, 0)
void tst_QMetaType::testDeprecatedGetters()
{
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype3.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype3.cpp
index 95577e16da..779044589c 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype3.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype3.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "tst_qmetatype.h"
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype_common.h b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype_common.h
index 3324cb5b32..ea59b5cd02 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype_common.h
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype_common.h
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
// Used by both tst_qmetatype and tst_qsettings
@@ -129,6 +129,9 @@ template<> struct TestValueFactory<QMetaType::UChar> {
template<> struct TestValueFactory<QMetaType::Float> {
static float *create() { return new float(FLT_MIN); }
};
+template<> struct TestValueFactory<QMetaType::Float16> {
+ static auto create() { return new qfloat16(std::numeric_limits<qfloat16>::min()); }
+};
template<> struct TestValueFactory<QMetaType::QObjectStar> {
static QObject * *create() { return new QObject *(0); }
};
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype_libs.h b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype_libs.h
index 908e80f9a8..673fc9083c 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype_libs.h
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype_libs.h
@@ -1,5 +1,5 @@
// Copyright (C) 2022 Intel Corporation
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TST_QMETATYPE_LIBS_H
#define TST_QMETATYPE_LIBS_H