Add QMetaType::FirstCoreType enum value.
We should not assume that the first type id is 0. Change-Id: I17ba6ba57e97ebd495904bfd11235fe458f214e5 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
This commit is contained in:
parent
1747f66457
commit
18965b1384
@ -184,6 +184,7 @@ public:
|
|||||||
// these are merged with QVariant
|
// these are merged with QVariant
|
||||||
QT_FOR_EACH_STATIC_TYPE(QT_DEFINE_METATYPE_ID)
|
QT_FOR_EACH_STATIC_TYPE(QT_DEFINE_METATYPE_ID)
|
||||||
|
|
||||||
|
FirstCoreType = Void,
|
||||||
LastCoreType = QModelIndex,
|
LastCoreType = QModelIndex,
|
||||||
FirstGuiType = QFont,
|
FirstGuiType = QFont,
|
||||||
LastGuiType = QPolygonF,
|
LastGuiType = QPolygonF,
|
||||||
|
@ -3542,6 +3542,7 @@ void tst_QVariant::loadQVariantFromDataStream(QDataStream::Version version)
|
|||||||
stream >> typeName >> loadedVariant;
|
stream >> typeName >> loadedVariant;
|
||||||
|
|
||||||
const int id = QMetaType::type(typeName.toLatin1());
|
const int id = QMetaType::type(typeName.toLatin1());
|
||||||
|
|
||||||
QVariant constructedVariant(static_cast<QVariant::Type>(id));
|
QVariant constructedVariant(static_cast<QVariant::Type>(id));
|
||||||
QCOMPARE(constructedVariant.userType(), id);
|
QCOMPARE(constructedVariant.userType(), id);
|
||||||
QCOMPARE(QMetaType::typeName(loadedVariant.userType()), typeName.toLatin1().constData());
|
QCOMPARE(QMetaType::typeName(loadedVariant.userType()), typeName.toLatin1().constData());
|
||||||
@ -3616,7 +3617,7 @@ void tst_QVariant::debugStream_data()
|
|||||||
{
|
{
|
||||||
QTest::addColumn<QVariant>("variant");
|
QTest::addColumn<QVariant>("variant");
|
||||||
QTest::addColumn<int>("typeId");
|
QTest::addColumn<int>("typeId");
|
||||||
for (int id = QMetaType::Void; id < QMetaType::User; ++id) {
|
for (int id = 0; id < QMetaType::User; ++id) {
|
||||||
const char *tagName = QMetaType::typeName(id);
|
const char *tagName = QMetaType::typeName(id);
|
||||||
if (!tagName)
|
if (!tagName)
|
||||||
continue;
|
continue;
|
||||||
|
@ -240,7 +240,7 @@ void tst_QMetaType::isRegisteredNotRegistered()
|
|||||||
void tst_QMetaType::constructCoreType_data()
|
void tst_QMetaType::constructCoreType_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<int>("typeId");
|
QTest::addColumn<int>("typeId");
|
||||||
for (int i = 0; i <= QMetaType::LastCoreType; ++i)
|
for (int i = QMetaType::FirstCoreType; i <= QMetaType::LastCoreType; ++i)
|
||||||
QTest::newRow(QMetaType::typeName(i)) << i;
|
QTest::newRow(QMetaType::typeName(i)) << i;
|
||||||
// GUI types are tested in tst_QGuiMetaType.
|
// GUI types are tested in tst_QGuiMetaType.
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ void tst_qvariant::stringVariantValue()
|
|||||||
void tst_qvariant::createCoreType_data()
|
void tst_qvariant::createCoreType_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<int>("typeId");
|
QTest::addColumn<int>("typeId");
|
||||||
for (int i = 0; i <= QMetaType::LastCoreType; ++i)
|
for (int i = QMetaType::FirstCoreType; i <= QMetaType::LastCoreType; ++i)
|
||||||
QTest::newRow(QMetaType::typeName(i)) << i;
|
QTest::newRow(QMetaType::typeName(i)) << i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user