aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2020-01-07 11:37:01 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-03-09 10:54:37 +0100
commitf3dccc334f01d088fcdf1c2016c8153fe6154b61 (patch)
tree7b8148f8ba1dcf53fc9f56a46fa42e810b699316 /tests/auto
parentf65c0e7190c4f2ebcadc963cf0647c71de26f3bb (diff)
Adapt to the the new QMetaType change
Fixes: QTBUG-82453 Change-Id: I7e5682945a07c3af183becd3947a69568f139d16 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp6
-rw-r--r--tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp48
2 files changed, 27 insertions, 27 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 7e053a027d..c6076410b2 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -5439,7 +5439,7 @@ void tst_qqmllanguage::selfReference()
const QMetaObject *metaObject = o->metaObject();
QMetaProperty selfProperty = metaObject->property(metaObject->indexOfProperty("self"));
- QCOMPARE(selfProperty.userType(), compilationUnit->metaTypeId);
+ QCOMPARE(selfProperty.userType(), compilationUnit->metaTypeId.id());
QByteArray typeName = selfProperty.typeName();
QVERIFY(typeName.endsWith('*'));
@@ -5448,7 +5448,7 @@ void tst_qqmllanguage::selfReference()
QMetaMethod selfFunction = metaObject->method(metaObject->indexOfMethod("returnSelf()"));
QVERIFY(selfFunction.isValid());
- QCOMPARE(selfFunction.returnType(), compilationUnit->metaTypeId);
+ QCOMPARE(selfFunction.returnType(), compilationUnit->metaTypeId.id());
QMetaMethod selfSignal;
@@ -5462,7 +5462,7 @@ void tst_qqmllanguage::selfReference()
QVERIFY(selfSignal.isValid());
QCOMPARE(selfSignal.parameterCount(), 1);
- QCOMPARE(selfSignal.parameterType(0), compilationUnit->metaTypeId);
+ QCOMPARE(selfSignal.parameterType(0), compilationUnit->metaTypeId.id());
}
void tst_qqmllanguage::selfReferencingSingleton()
diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
index c8e6e9c935..b69b466947 100644
--- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
+++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
@@ -387,24 +387,24 @@ void tst_qqmlmetatype::unregisterCustomType()
QQmlEngine engine;
QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
QTypeRevision::fromVersion(1, 0));
- QVERIFY(!type.isValid());
+ QVERIFY2(!type.isValid(), "Type is not valid yet");
controllerId = qmlRegisterType<Controller1>("mytypes", 1, 0, "Controller");
type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
QTypeRevision::fromVersion(1, 0));
- QVERIFY(type.isValid());
- QVERIFY(!type.isInterface());
- QVERIFY(!type.isSingleton());
- QVERIFY(!type.isComposite());
+ QVERIFY2(type.isValid(), "Type is valid now");
+ QVERIFY2(!type.isInterface(), "Type is not an interface");
+ QVERIFY2(!type.isSingleton(), "Type is not a singleton");
+ QVERIFY2(!type.isComposite(), "Types is not a composite type");
QQmlComponent c(&engine, testFileUrl("testUnregisterCustomType.qml"));
QScopedPointer<QObject> obj(c.create());
- QVERIFY(obj);
+ QVERIFY2(obj, "obj is not null");
QObject *controller = obj->findChild<QObject *>("controller");
- QVERIFY(qobject_cast<Controller1 *>(controller));
+ QVERIFY2(qobject_cast<Controller1 *>(controller), "child 'controller' could be found and is a Controller1*");
QVariant stringVal = controller->property("string");
QCOMPARE(stringVal.userType(), QVariant::String);
QCOMPARE(stringVal.toString(), QStringLiteral("Controller #1"));
QVariant enumVal = controller->property("enumVal");
- QCOMPARE(enumVal.userType(), QVariant::Int);
+ QVERIFY2(QMetaType(enumVal.userType()).flags() & QMetaType::IsEnumeration, "enumVal's type is enumeratoion");
QCOMPARE(enumVal.toInt(), 1);
}
QQmlMetaType::unregisterType(controllerId);
@@ -412,24 +412,24 @@ void tst_qqmlmetatype::unregisterCustomType()
QQmlEngine engine;
QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
QTypeRevision::fromVersion(1, 0));
- QVERIFY(!type.isValid());
+ QVERIFY2(!type.isValid(), "Type is not valid anymore");
controllerId = qmlRegisterType<Controller2>("mytypes", 1, 0, "Controller");
type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
QTypeRevision::fromVersion(1, 0));
- QVERIFY(type.isValid());
- QVERIFY(!type.isInterface());
- QVERIFY(!type.isSingleton());
- QVERIFY(!type.isComposite());
+ QVERIFY2(type.isValid(), "Type is valid again");
+ QVERIFY2(!type.isInterface(), "Type is not an interface");
+ QVERIFY2(!type.isSingleton(), "Type is not a singleton");
+ QVERIFY2(!type.isComposite(), "Type is not a composite");
QQmlComponent c(&engine, testFileUrl("testUnregisterCustomType.qml"));
QScopedPointer<QObject> obj(c.create());
- QVERIFY(obj);
+ QVERIFY2(obj, "obj is not null");
QObject *controller = obj->findChild<QObject *>("controller");
- QVERIFY(qobject_cast<Controller2 *>(controller));
+ QVERIFY2(qobject_cast<Controller2 *>(controller), "child 'controller' could be found and is a Controller2*");
QVariant stringVal = controller->property("string");
QCOMPARE(stringVal.userType(), QVariant::String);
QCOMPARE(stringVal.toString(), QStringLiteral("Controller #2"));
QVariant enumVal = controller->property("enumVal");
- QCOMPARE(enumVal.userType(), QVariant::Int);
+ QVERIFY2(QMetaType(enumVal.userType()).flags() & QMetaType::IsEnumeration, "enumVal's type is enumeratoion");
QCOMPARE(enumVal.toInt(), 111);
}
QQmlMetaType::unregisterType(controllerId);
@@ -437,24 +437,24 @@ void tst_qqmlmetatype::unregisterCustomType()
QQmlEngine engine;
QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
QTypeRevision::fromVersion(1, 0));
- QVERIFY(!type.isValid());
+ QVERIFY2(!type.isValid(), "Type is not valid anymore");
controllerId = qmlRegisterType<Controller1>("mytypes", 1, 0, "Controller");
type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
QTypeRevision::fromVersion(1, 0));
- QVERIFY(type.isValid());
- QVERIFY(!type.isInterface());
- QVERIFY(!type.isSingleton());
- QVERIFY(!type.isComposite());
+ QVERIFY2(type.isValid(), "Type is valid again");
+ QVERIFY2(!type.isInterface(), "Type is not an interface");
+ QVERIFY2(!type.isSingleton(), "Type is not a singleton");
+ QVERIFY2(!type.isComposite(), "Type is not a composite");
QQmlComponent c(&engine, testFileUrl("testUnregisterCustomType.qml"));
QScopedPointer<QObject> obj(c.create());
- QVERIFY(obj);
+ QVERIFY2(obj, "obj is not null");
QObject *controller = obj->findChild<QObject *>("controller");
- QVERIFY(qobject_cast<Controller1 *>(controller));
+ QVERIFY2(qobject_cast<Controller1 *>(controller), "child 'controller' could be found and is a Controller1*");
QVariant stringVal = controller->property("string");
QCOMPARE(stringVal.userType(), QVariant::String);
QCOMPARE(stringVal.toString(), QStringLiteral("Controller #1"));
QVariant enumVal = controller->property("enumVal");
- QCOMPARE(enumVal.userType(), QVariant::Int);
+ QVERIFY2(QMetaType(enumVal.userType()).flags() & QMetaType::IsEnumeration, "enumVal's type is enumeratoion");
QCOMPARE(enumVal.toInt(), 1);
}
}