diff options
author | Jędrzej Nowacki <jedrzej.nowacki@nokia.com> | 2012-05-22 13:48:22 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-12 04:30:05 +0200 |
commit | 3df316e9615027d9384cef81ac6cbfa2f9f81f01 (patch) | |
tree | d3588c99ffeb729142f8b9b6c80a2f5d65558ac0 /tests/auto/corelib/kernel | |
parent | 778e2b3bf5c29f2bab13e79400280fe86c6d2226 (diff) |
Avoid a type name normalization during auto-registration.
Containers are auto-registered and use normalized names.
Change-Id: Id65c3940401f69436929220e1f6a971135e147ed
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/corelib/kernel')
-rw-r--r-- | tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index d82f7560e3..da8c182f32 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -348,6 +348,13 @@ void tst_QMetaType::typeName_data() QTest::newRow("-1") << QMetaType::Type(-1) << QString(); QTest::newRow("-124125534") << QMetaType::Type(-124125534) << QString(); QTest::newRow("124125534") << QMetaType::Type(124125534) << QString(); + + // automatic registration + QTest::newRow("QList<int>") << static_cast<QMetaType::Type>(::qMetaTypeId<QList<int> >()) << QString::fromLatin1("QList<int>"); + QTest::newRow("QHash<int,int>") << static_cast<QMetaType::Type>(::qMetaTypeId<QHash<int, int> >()) << QString::fromLatin1("QHash<int,int>"); + QTest::newRow("QMap<int,int>") << static_cast<QMetaType::Type>(::qMetaTypeId<QMap<int, int> >()) << QString::fromLatin1("QMap<int,int>"); + QTest::newRow("QVector<QList<int>>") << static_cast<QMetaType::Type>(::qMetaTypeId<QVector<QList<int> > >()) << QString::fromLatin1("QVector<QList<int> >"); + QTest::newRow("QVector<QMap<int,int>>") << static_cast<QMetaType::Type>(::qMetaTypeId<QVector<QMap<int, int> > >()) << QString::fromLatin1("QVector<QMap<int,int> >"); } void tst_QMetaType::typeName() @@ -355,7 +362,10 @@ void tst_QMetaType::typeName() QFETCH(QMetaType::Type, aType); QFETCH(QString, aTypeName); - QCOMPARE(QString::fromLatin1(QMetaType::typeName(aType)), aTypeName); + QString name = QString::fromLatin1(QMetaType::typeName(aType)); + + QCOMPARE(name, aTypeName); + QCOMPARE(name.toLatin1(), QMetaObject::normalizedType(name.toLatin1().constData())); } #define FOR_EACH_PRIMITIVE_METATYPE(F) \ @@ -1392,6 +1402,8 @@ void tst_QMetaType::automaticTemplateRegistration() tn += it->trimmed(); \ } \ } \ + if (tn.endsWith('>')) \ + tn += ' '; \ tn += ">"; \ const int type = QMetaType::type(tn); \ const int expectedType = ::qMetaTypeId<CONTAINER< __VA_ARGS__ > >(); \ |