diff options
Diffstat (limited to 'tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp')
-rw-r--r-- | tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp index c0650c7b1a..68bcb53056 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.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" #include "tst_qmetatype_libs.h" @@ -640,6 +640,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() { |