summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2022-05-11 10:14:45 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2022-05-12 08:17:54 +0200
commit4e7f92bf0dc535f90e6d50ee4739a455951fa397 (patch)
tree4226261927faf50fc5021bd7a00e899475b16858 /tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
parentbb334e8181c52ad1f2b1cf1b89337870579ac8b0 (diff)
QMetaType: Fix normalization on MSVC if name contains enum
During type normalization, we remove the struct, class and enum keywords (see the skipStructClassOrEnum function). However, we only want to do that for actual keywords, not for a name that happens to start with e.g. "enum", as in "enumerationNameSpacce". Adjust the MSVC check to still require no identifier character after the keyword, while still allowing for some remaining characters. Fixes: QTBUG-97813 Pick-to: 6.3 6.2 Change-Id: I82b873d02ff454cce4b75f2814a52a66f2268208 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp')
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index f69327a3f1..7bf3d9756a 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -585,6 +585,10 @@ void tst_QMetaType::normalizedTypes()
#define TYPENAME_DATA(MetaTypeName, MetaTypeId, RealType)\
QTest::newRow(#RealType) << int(QMetaType::MetaTypeName) << #RealType;
+namespace enumerations {
+ enum Test { a = 0 };
+}
+
void tst_QMetaType::typeName_data()
{
QTest::addColumn<int>("aType");
@@ -621,6 +625,8 @@ void tst_QMetaType::typeName_data()
// template instance class derived from Q_GADGET enabled class
QTest::newRow("GadgetDerivedAndTyped<int>") << ::qMetaTypeId<GadgetDerivedAndTyped<int>>() << QString::fromLatin1("GadgetDerivedAndTyped<int>");
QTest::newRow("GadgetDerivedAndTyped<int>*") << ::qMetaTypeId<GadgetDerivedAndTyped<int>*>() << QString::fromLatin1("GadgetDerivedAndTyped<int>*");
+
+ QTest::newRow("msvcKeywordPartOfName") << ::qMetaTypeId<enumerations::Test>() << QString::fromLatin1("enumerations::Test");
}
void tst_QMetaType::typeName()