diff options
Diffstat (limited to 'tests/auto/qml')
m--------- | tests/auto/qml/ecmascripttests/test262 | 0 | ||||
-rw-r--r-- | tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp | 104 | ||||
-rw-r--r-- | tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp | 18 |
4 files changed, 61 insertions, 67 deletions
diff --git a/tests/auto/qml/ecmascripttests/test262 b/tests/auto/qml/ecmascripttests/test262 -Subproject d60c4ed97e69639bc5bc1db43a98828debf80c8 +Subproject fe58b18c13d1ea5d42951e5b698efc3bfab6dc8 diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp index 3402aeebc1..6ab84774f2 100644 --- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp +++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp @@ -283,9 +283,9 @@ void tst_qmldiskcache::registerImportForImplicitComponent() QCOMPARE(quint32(testUnit->nImports), quint32(2)); QCOMPARE(testUnit->stringAt(testUnit->importAt(0)->uriIndex), QStringLiteral("QtQuick")); - QQmlType *componentType = QQmlMetaType::qmlType(&QQmlComponent::staticMetaObject); + QQmlType componentType = QQmlMetaType::qmlType(&QQmlComponent::staticMetaObject); - QCOMPARE(testUnit->stringAt(testUnit->importAt(1)->uriIndex), QString(componentType->module())); + QCOMPARE(testUnit->stringAt(testUnit->importAt(1)->uriIndex), QString(componentType.module())); QCOMPARE(testUnit->stringAt(testUnit->importAt(1)->qualifierIndex), QStringLiteral("QmlInternals")); QCOMPARE(quint32(testUnit->nObjects), quint32(3)); @@ -295,7 +295,7 @@ void tst_qmldiskcache::registerImportForImplicitComponent() QCOMPARE(quint32(obj->bindingTable()->type), quint32(QV4::CompiledData::Binding::Type_Object)); const QV4::CompiledData::Object *implicitComponent = testUnit->objectAt(obj->bindingTable()->value.objectIndex); - QCOMPARE(testUnit->stringAt(implicitComponent->inheritedTypeNameIndex), QStringLiteral("QmlInternals.") + componentType->elementName()); + QCOMPARE(testUnit->stringAt(implicitComponent->inheritedTypeNameIndex), QStringLiteral("QmlInternals.") + componentType.elementName()); } } diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp index 30e517c8f9..798e3fd386 100644 --- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp +++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp @@ -148,14 +148,14 @@ void tst_qqmlmetatype::initTestCase() void tst_qqmlmetatype::qmlParserStatusCast() { - QVERIFY(!QQmlMetaType::qmlType(QVariant::Int)); - QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()) != 0); - QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>())->parserStatusCast(), -1); - QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()) != 0); - QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>())->parserStatusCast(), -1); - - QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0); - int cast = QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->parserStatusCast(); + QVERIFY(!QQmlMetaType::qmlType(QVariant::Int).isValid()); + QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()).isValid()); + QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()).parserStatusCast(), -1); + QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()).isValid()); + QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()).parserStatusCast(), -1); + + QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()).isValid()); + int cast = QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()).parserStatusCast(); QVERIFY(cast != -1); QVERIFY(cast != 0); @@ -168,14 +168,14 @@ void tst_qqmlmetatype::qmlParserStatusCast() void tst_qqmlmetatype::qmlPropertyValueSourceCast() { - QVERIFY(!QQmlMetaType::qmlType(QVariant::Int)); - QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()) != 0); - QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>())->propertyValueSourceCast(), -1); - QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0); - QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->propertyValueSourceCast(), -1); - - QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()) != 0); - int cast = QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>())->propertyValueSourceCast(); + QVERIFY(!QQmlMetaType::qmlType(QVariant::Int).isValid()); + QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()).isValid()); + QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()).propertyValueSourceCast(), -1); + QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()).isValid()); + QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()).propertyValueSourceCast(), -1); + + QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()).isValid()); + int cast = QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()).propertyValueSourceCast(); QVERIFY(cast != -1); QVERIFY(cast != 0); @@ -188,14 +188,14 @@ void tst_qqmlmetatype::qmlPropertyValueSourceCast() void tst_qqmlmetatype::qmlPropertyValueInterceptorCast() { - QVERIFY(!QQmlMetaType::qmlType(QVariant::Int)); - QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()) != 0); - QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>())->propertyValueInterceptorCast(), -1); - QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0); - QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->propertyValueInterceptorCast(), -1); - - QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>()) != 0); - int cast = QQmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>())->propertyValueInterceptorCast(); + QVERIFY(!QQmlMetaType::qmlType(QVariant::Int).isValid()); + QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()).isValid()); + QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()).propertyValueInterceptorCast(), -1); + QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()).isValid()); + QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()).propertyValueInterceptorCast(), -1); + + QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>()).isValid()); + int cast = QQmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>()).propertyValueInterceptorCast(); QVERIFY(cast != -1); QVERIFY(cast != 0); @@ -208,17 +208,17 @@ void tst_qqmlmetatype::qmlPropertyValueInterceptorCast() void tst_qqmlmetatype::qmlType() { - QQmlType *type = QQmlMetaType::qmlType(QString("ParserStatusTestType"), QString("Test"), 1, 0); - QVERIFY(type); - QVERIFY(type->module() == QLatin1String("Test")); - QVERIFY(type->elementName() == QLatin1String("ParserStatusTestType")); - QCOMPARE(type->qmlTypeName(), QLatin1String("Test/ParserStatusTestType")); + QQmlType type = QQmlMetaType::qmlType(QString("ParserStatusTestType"), QString("Test"), 1, 0); + QVERIFY(type.isValid()); + QVERIFY(type.module() == QLatin1String("Test")); + QVERIFY(type.elementName() == QLatin1String("ParserStatusTestType")); + QCOMPARE(type.qmlTypeName(), QLatin1String("Test/ParserStatusTestType")); type = QQmlMetaType::qmlType("Test/ParserStatusTestType", 1, 0); - QVERIFY(type); - QVERIFY(type->module() == QLatin1String("Test")); - QVERIFY(type->elementName() == QLatin1String("ParserStatusTestType")); - QCOMPARE(type->qmlTypeName(), QLatin1String("Test/ParserStatusTestType")); + QVERIFY(type.isValid()); + QVERIFY(type.module() == QLatin1String("Test")); + QVERIFY(type.elementName() == QLatin1String("ParserStatusTestType")); + QCOMPARE(type.qmlTypeName(), QLatin1String("Test/ParserStatusTestType")); } void tst_qqmlmetatype::invalidQmlTypeName() @@ -277,23 +277,23 @@ void tst_qqmlmetatype::defaultObject() void tst_qqmlmetatype::registrationType() { - QQmlType *type = QQmlMetaType::qmlType(QString("TestType"), QString("Test"), 1, 0); - QVERIFY(type); - QVERIFY(!type->isInterface()); - QVERIFY(!type->isSingleton()); - QVERIFY(!type->isComposite()); + QQmlType type = QQmlMetaType::qmlType(QString("TestType"), QString("Test"), 1, 0); + QVERIFY(type.isValid()); + QVERIFY(!type.isInterface()); + QVERIFY(!type.isSingleton()); + QVERIFY(!type.isComposite()); type = QQmlMetaType::qmlType(QString("TestTypeSingleton"), QString("Test"), 1, 0); - QVERIFY(type); - QVERIFY(!type->isInterface()); - QVERIFY(type->isSingleton()); - QVERIFY(!type->isComposite()); + QVERIFY(type.isValid()); + QVERIFY(!type.isInterface()); + QVERIFY(type.isSingleton()); + QVERIFY(!type.isComposite()); type = QQmlMetaType::qmlType(QString("TestTypeComposite"), QString("Test"), 1, 0); - QVERIFY(type); - QVERIFY(!type->isInterface()); - QVERIFY(!type->isSingleton()); - QVERIFY(type->isComposite()); + QVERIFY(type.isValid()); + QVERIFY(!type.isInterface()); + QVERIFY(!type.isSingleton()); + QVERIFY(type.isComposite()); } void tst_qqmlmetatype::compositeType() @@ -305,12 +305,12 @@ void tst_qqmlmetatype::compositeType() QObject* obj = c.create(); QVERIFY(obj); - QQmlType *type = QQmlMetaType::qmlType(QString("ImplicitType"), QString(""), 1, 0); - QVERIFY(type); - QVERIFY(type->module().isEmpty()); - QCOMPARE(type->elementName(), QLatin1String("ImplicitType")); - QCOMPARE(type->qmlTypeName(), QLatin1String("ImplicitType")); - QCOMPARE(type->sourceUrl(), testFileUrl("ImplicitType.qml")); + QQmlType type = QQmlMetaType::qmlType(QString("ImplicitType"), QString(""), 1, 0); + QVERIFY(type.isValid()); + QVERIFY(type.module().isEmpty()); + QCOMPARE(type.elementName(), QLatin1String("ImplicitType")); + QCOMPARE(type.qmlTypeName(), QLatin1String("ImplicitType")); + QCOMPARE(type.sourceUrl(), testFileUrl("ImplicitType.qml")); } void tst_qqmlmetatype::externalEnums() diff --git a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp index 824fe445c0..ac1b76b9d2 100644 --- a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp +++ b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp @@ -103,11 +103,10 @@ QQmlPropertyData *cacheProperty(QQmlPropertyCache *cache, const char *name) void tst_qqmlpropertycache::properties() { QQmlEngine engine; - QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine); DerivedObject object; const QMetaObject *metaObject = object.metaObject(); - QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(v4, metaObject)); + QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(metaObject)); QQmlPropertyData *data; QVERIFY((data = cacheProperty(cache, "propertyA"))); @@ -126,11 +125,10 @@ void tst_qqmlpropertycache::properties() void tst_qqmlpropertycache::propertiesDerived() { QQmlEngine engine; - QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine); DerivedObject object; const QMetaObject *metaObject = object.metaObject(); - QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(v4, &BaseObject::staticMetaObject)); + QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(&BaseObject::staticMetaObject)); QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(object.metaObject())); QQmlPropertyData *data; @@ -150,11 +148,10 @@ void tst_qqmlpropertycache::propertiesDerived() void tst_qqmlpropertycache::methods() { QQmlEngine engine; - QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine); DerivedObject object; const QMetaObject *metaObject = object.metaObject(); - QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(v4, metaObject)); + QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(metaObject)); QQmlPropertyData *data; QVERIFY((data = cacheProperty(cache, "slotA"))); @@ -185,11 +182,10 @@ void tst_qqmlpropertycache::methods() void tst_qqmlpropertycache::methodsDerived() { QQmlEngine engine; - QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine); DerivedObject object; const QMetaObject *metaObject = object.metaObject(); - QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(v4, &BaseObject::staticMetaObject)); + QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(&BaseObject::staticMetaObject)); QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(object.metaObject())); QQmlPropertyData *data; @@ -221,11 +217,10 @@ void tst_qqmlpropertycache::methodsDerived() void tst_qqmlpropertycache::signalHandlers() { QQmlEngine engine; - QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine); DerivedObject object; const QMetaObject *metaObject = object.metaObject(); - QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(v4, metaObject)); + QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(metaObject)); QQmlPropertyData *data; QVERIFY((data = cacheProperty(cache, "onSignalA"))); @@ -250,11 +245,10 @@ void tst_qqmlpropertycache::signalHandlers() void tst_qqmlpropertycache::signalHandlersDerived() { QQmlEngine engine; - QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine); DerivedObject object; const QMetaObject *metaObject = object.metaObject(); - QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(v4, &BaseObject::staticMetaObject)); + QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(&BaseObject::staticMetaObject)); QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(object.metaObject())); QQmlPropertyData *data; |