diff options
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 762 |
1 files changed, 381 insertions, 381 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index ecd7bea1c4..5ff959515e 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -373,7 +373,7 @@ private: static void gc(QQmlEngine &engine) { engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } @@ -392,7 +392,7 @@ void tst_qqmlecmascript::assignBasicTypes() { QQmlComponent component(&engine, testFileUrl("assignBasicTypes.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3); QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2); QCOMPARE(object->relatedEnumProperty(), MyEnumContainer::RelatedValue); @@ -421,7 +421,7 @@ void tst_qqmlecmascript::assignBasicTypes() { QQmlComponent component(&engine, testFileUrl("assignBasicTypes.2.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3); QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2); QCOMPARE(object->relatedEnumProperty(), MyEnumContainer::RelatedValue); @@ -471,7 +471,7 @@ void tst_qqmlecmascript::assignDate() QQmlComponent component(&engine, source); QScopedPointer<QObject> obj(component.create()); MyTypeObject *object = qobject_cast<MyTypeObject *>(obj.data()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QDate expectedDate(2009, 5, 12); QDateTime expectedDateTime; @@ -542,7 +542,7 @@ void tst_qqmlecmascript::exportDate() QQmlComponent component(&e, source); QScopedPointer<QObject> obj(component.create()); MyTypeObject *object = qobject_cast<MyTypeObject *>(obj.data()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->boolProperty(), true); } @@ -551,8 +551,8 @@ void tst_qqmlecmascript::idShortcutInvalidates() { QQmlComponent component(&engine, testFileUrl("idShortcutInvalidates.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->objectProperty() != 0); + QVERIFY(object != nullptr); + QVERIFY(object->objectProperty() != nullptr); delete object->objectProperty(); QVERIFY(!object->objectProperty()); delete object; @@ -561,8 +561,8 @@ void tst_qqmlecmascript::idShortcutInvalidates() { QQmlComponent component(&engine, testFileUrl("idShortcutInvalidates.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->objectProperty() != 0); + QVERIFY(object != nullptr); + QVERIFY(object->objectProperty() != nullptr); delete object->objectProperty(); QVERIFY(!object->objectProperty()); delete object; @@ -574,14 +574,14 @@ void tst_qqmlecmascript::boolPropertiesEvaluateAsBool() { QQmlComponent component(&engine, testFileUrl("boolPropertiesEvaluateAsBool.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->stringProperty(), QLatin1String("pass")); delete object; } { QQmlComponent component(&engine, testFileUrl("boolPropertiesEvaluateAsBool.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->stringProperty(), QLatin1String("pass")); delete object; } @@ -592,7 +592,7 @@ void tst_qqmlecmascript::signalAssignment() { QQmlComponent component(&engine, testFileUrl("signalAssignment.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->string(), QString()); emit object->basicSignal(); QCOMPARE(object->string(), QString("pass")); @@ -602,7 +602,7 @@ void tst_qqmlecmascript::signalAssignment() { QQmlComponent component(&engine, testFileUrl("signalAssignment.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->string(), QString()); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); QCOMPARE(object->string(), QString("pass 19 Hello world! 10.25 3 2")); @@ -629,7 +629,7 @@ void tst_qqmlecmascript::signalArguments() { QQmlComponent component(&engine, testFileUrl("signalArguments.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->string(), QString()); emit object->basicSignal(); QCOMPARE(object->string(), QString("pass")); @@ -640,7 +640,7 @@ void tst_qqmlecmascript::signalArguments() { QQmlComponent component(&engine, testFileUrl("signalArguments.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->string(), QString()); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); QCOMPARE(object->string(), QString("pass 19 Hello world! 10.25 3 2")); @@ -654,7 +654,7 @@ void tst_qqmlecmascript::methods() { QQmlComponent component(&engine, testFileUrl("methods.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->methodCalled(), false); QCOMPARE(object->methodIntCalled(), false); emit object->basicSignal(); @@ -666,7 +666,7 @@ void tst_qqmlecmascript::methods() { QQmlComponent component(&engine, testFileUrl("methods.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->methodCalled(), false); QCOMPARE(object->methodIntCalled(), false); emit object->basicSignal(); @@ -678,7 +678,7 @@ void tst_qqmlecmascript::methods() { QQmlComponent component(&engine, testFileUrl("methods.3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 19); delete object; } @@ -686,7 +686,7 @@ void tst_qqmlecmascript::methods() { QQmlComponent component(&engine, testFileUrl("methods.4.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 19); QCOMPARE(object->property("test2").toInt(), 17); QCOMPARE(object->property("test3").toInt(), 16); @@ -696,7 +696,7 @@ void tst_qqmlecmascript::methods() { QQmlComponent component(&engine, testFileUrl("methods.5.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 9); delete object; } @@ -708,7 +708,7 @@ void tst_qqmlecmascript::bindingLoop() QString warning = component.url().toString() + ":9:9: QML MyQmlObject: Binding loop detected for property \"stringProperty\""; QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -894,7 +894,7 @@ void tst_qqmlecmascript::objectPropertiesTriggerReeval() expr.changed = false; QCOMPARE(expr.evaluate(), QVariant("Cat")); - object1.setObjectProperty(0); + object1.setObjectProperty(nullptr); QCOMPARE(expr.changed, true); expr.changed = false; QCOMPARE(expr.evaluate(), QVariant()); @@ -928,16 +928,16 @@ void tst_qqmlecmascript::deferredProperties() QQmlComponent component(&engine, testFileUrl("deferredProperties.qml")); MyDeferredObject *object = qobject_cast<MyDeferredObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 0); QVERIFY(!object->objectProperty()); - QVERIFY(object->objectProperty2() != 0); + QVERIFY(object->objectProperty2() != nullptr); qmlExecuteDeferred(object); QCOMPARE(object->value(), 10); - QVERIFY(object->objectProperty() != 0); + QVERIFY(object->objectProperty() != nullptr); MyQmlObject *qmlObject = qobject_cast<MyQmlObject *>(object->objectProperty()); - QVERIFY(qmlObject != 0); + QVERIFY(qmlObject != nullptr); QCOMPARE(qmlObject->value(), 10); object->setValue(19); QCOMPARE(qmlObject->value(), 19); @@ -951,7 +951,7 @@ void tst_qqmlecmascript::deferredPropertiesErrors() QQmlComponent component(&engine, testFileUrl("deferredPropertiesErrors.qml")); MyDeferredObject *object = qobject_cast<MyDeferredObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 0); QVERIFY(!object->objectProperty()); QVERIFY(!object->objectProperty2()); @@ -971,25 +971,25 @@ void tst_qqmlecmascript::deferredPropertiesInComponents() QObject *object = component.create(); if (!object) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").value<int>(), 10); MyDeferredObject *defObjectA = qobject_cast<MyDeferredObject *>(object->property("deferredInside").value<QObject*>()); - QVERIFY(defObjectA != 0); + QVERIFY(defObjectA != nullptr); QVERIFY(!defObjectA->objectProperty()); qmlExecuteDeferred(defObjectA); - QVERIFY(defObjectA->objectProperty() != 0); + QVERIFY(defObjectA->objectProperty() != nullptr); QCOMPARE(defObjectA->objectProperty()->property("value").value<int>(), 10); MyDeferredObject *defObjectB = qobject_cast<MyDeferredObject *>(object->property("deferredOutside").value<QObject*>()); - QVERIFY(defObjectB != 0); + QVERIFY(defObjectB != nullptr); QVERIFY(!defObjectB->objectProperty()); qmlExecuteDeferred(defObjectB); - QVERIFY(defObjectB->objectProperty() != 0); + QVERIFY(defObjectB->objectProperty() != nullptr); QCOMPARE(defObjectB->objectProperty()->property("value").value<int>(), 10); delete object; @@ -1004,7 +1004,7 @@ void tst_qqmlecmascript::deferredPropertiesInDestruction() QObject *object = component.create(); if (!object) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; //QTBUG-33112 was that this used to cause a crash } @@ -1013,7 +1013,7 @@ void tst_qqmlecmascript::extensionObjects() QQmlComponent component(&engine, testFileUrl("extensionObjects.qml")); MyExtendedObject *object = qobject_cast<MyExtendedObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->baseProperty(), 13); QCOMPARE(object->coreProperty(), 9); object->setProperty("extendedProperty", QVariant(11)); @@ -1038,8 +1038,8 @@ void tst_qqmlecmascript::overrideExtensionProperties() QQmlComponent component(&engine, testFileUrl("extensionObjectsPropertyOverride.qml")); OverrideDefaultPropertyObject *object = qobject_cast<OverrideDefaultPropertyObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->secondProperty() != 0); + QVERIFY(object != nullptr); + QVERIFY(object->secondProperty() != nullptr); QVERIFY(!object->firstProperty()); delete object; @@ -1050,7 +1050,7 @@ void tst_qqmlecmascript::attachedProperties() { QQmlComponent component(&engine, testFileUrl("attachedProperty.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("a").toInt(), 19); QCOMPARE(object->property("b").toInt(), 19); QCOMPARE(object->property("c").toInt(), 19); @@ -1061,7 +1061,7 @@ void tst_qqmlecmascript::attachedProperties() { QQmlComponent component(&engine, testFileUrl("attachedProperty.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("a").toInt(), 26); QCOMPARE(object->property("b").toInt(), 26); QCOMPARE(object->property("c").toInt(), 26); @@ -1073,13 +1073,13 @@ void tst_qqmlecmascript::attachedProperties() { QQmlComponent component(&engine, testFileUrl("writeAttachedProperty.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "writeValue2"); MyQmlAttachedObject *attached = qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object)); - QVERIFY(attached != 0); + QVERIFY(attached != nullptr); QCOMPARE(attached->value2(), 9); delete object; @@ -1092,7 +1092,7 @@ void tst_qqmlecmascript::enums() { QQmlComponent component(&engine, testFileUrl("enums.1.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("enumProperty").toInt(), (int)MyQmlObject::EnumValue2); QCOMPARE(object->property("relatedEnumProperty").toInt(), (int)MyEnumContainer::RelatedValue); @@ -1135,7 +1135,7 @@ void tst_qqmlecmascript::enums() QQmlComponent component(&engine, testFileUrl("enums.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("a").toInt(), 0); QCOMPARE(object->property("b").toInt(), 0); QCOMPARE(object->property("c").toInt(), 0); @@ -1162,7 +1162,7 @@ void tst_qqmlecmascript::enums() { QQmlComponent component(&engine, testFileUrl("enums.3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // check the values are what we expect QCOMPARE(object->property("a").toInt(), 4); @@ -1196,7 +1196,7 @@ void tst_qqmlecmascript::valueTypeFunctions() { QQmlComponent component(&engine, testFileUrl("valueTypeFunctions.qml")); MyTypeObject *obj = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->rectProperty(), QRect(0,0,100,100)); QCOMPARE(obj->rectFProperty(), QRectF(0,0.5,100,99.5)); @@ -1213,7 +1213,7 @@ void tst_qqmlecmascript::constantsOverrideBindings() { QQmlComponent component(&engine, testFileUrl("constantsOverrideBindings.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("c2").toInt(), 0); object->setProperty("c1", QVariant(9)); @@ -1232,7 +1232,7 @@ void tst_qqmlecmascript::constantsOverrideBindings() { QQmlComponent component(&engine, testFileUrl("constantsOverrideBindings.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("c1").toInt(), 0); QCOMPARE(object->property("c2").toInt(), 10); @@ -1268,7 +1268,7 @@ void tst_qqmlecmascript::constantsOverrideBindings() { QQmlComponent component(&engine, testFileUrl("constantsOverrideBindings.4.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("c1").toInt(), 0); QCOMPARE(object->property("c3").toInt(), 10); @@ -1289,7 +1289,7 @@ void tst_qqmlecmascript::outerBindingOverridesInnerBinding() QQmlComponent component(&engine, testFileUrl("outerBindingOverridesInnerBinding.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("c1").toInt(), 0); QCOMPARE(object->property("c2").toInt(), 0); @@ -1321,7 +1321,7 @@ void tst_qqmlecmascript::nonExistentAttachedObject() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -1331,7 +1331,7 @@ void tst_qqmlecmascript::scope() { QQmlComponent component(&engine, testFileUrl("scope.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toInt(), 1); QCOMPARE(object->property("test2").toInt(), 2); @@ -1350,7 +1350,7 @@ void tst_qqmlecmascript::scope() { QQmlComponent component(&engine, testFileUrl("scope.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toInt(), 19); QCOMPARE(object->property("test2").toInt(), 19); @@ -1365,7 +1365,7 @@ void tst_qqmlecmascript::scope() { QQmlComponent component(&engine, testFileUrl("scope.3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QEXPECT_FAIL("", "Properties resolvable at compile time come before the global object, which is not 100% compatible with older QML versions", Continue); @@ -1379,7 +1379,7 @@ void tst_qqmlecmascript::scope() { QQmlComponent component(&engine, testFileUrl("scope.4.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 0); QCOMPARE(object->property("test2").toString(), QString()); @@ -1395,7 +1395,7 @@ void tst_qqmlecmascript::scope() { QQmlComponent component(&engine, testFileUrl("scope.5.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QCOMPARE(object->property("test2").toBool(), true); @@ -1406,7 +1406,7 @@ void tst_qqmlecmascript::scope() { QQmlComponent component(&engine, testFileUrl("scope.6.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -1420,7 +1420,7 @@ void tst_qqmlecmascript::importScope() { QQmlComponent component(&engine, testFileUrl("importScope.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toInt(), 240); @@ -1435,7 +1435,7 @@ void tst_qqmlecmascript::signalParameterTypes() { QQmlComponent component(&engine, testFileUrl("signalParameterTypes.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); emit object->basicSignal(); @@ -1462,7 +1462,7 @@ void tst_qqmlecmascript::objectsCompareAsEqual() { QQmlComponent component(&engine, testFileUrl("objectsCompareAsEqual.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QCOMPARE(object->property("test2").toBool(), true); @@ -1482,7 +1482,7 @@ void tst_qqmlecmascript::aliasPropertyAndBinding() { QQmlComponent component(&engine, testFileUrl("aliasPropertyAndBinding.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("c2").toInt(), 3); QCOMPARE(object->property("c3").toInt(), 3); @@ -1501,12 +1501,12 @@ and that the aliased property is reset correctly if possible. */ void tst_qqmlecmascript::aliasPropertyReset() { - QObject *object = 0; + QObject *object = nullptr; // test that a manual write (of undefined) to a resettable aliased property succeeds QQmlComponent c1(&engine, testFileUrl("aliasreset/aliasPropertyReset.1.qml")); object = c1.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() != 0); QCOMPARE(object->property("aliasIsUndefined"), QVariant(false)); QMetaObject::invokeMethod(object, "resetAliased"); @@ -1517,7 +1517,7 @@ void tst_qqmlecmascript::aliasPropertyReset() // test that a manual write (of undefined) to a resettable alias property succeeds QQmlComponent c2(&engine, testFileUrl("aliasreset/aliasPropertyReset.2.qml")); object = c2.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() != 0); QCOMPARE(object->property("loaderSourceComponentIsUndefined"), QVariant(false)); QMetaObject::invokeMethod(object, "resetAlias"); @@ -1528,7 +1528,7 @@ void tst_qqmlecmascript::aliasPropertyReset() // test that an alias to a bound property works correctly QQmlComponent c3(&engine, testFileUrl("aliasreset/aliasPropertyReset.3.qml")); object = c3.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() != 0); QCOMPARE(object->property("loaderOneSourceComponentIsUndefined"), QVariant(false)); QCOMPARE(object->property("loaderTwoSourceComponentIsUndefined"), QVariant(false)); @@ -1542,10 +1542,10 @@ void tst_qqmlecmascript::aliasPropertyReset() // whose aliased property's object has been deleted, does not crash. QQmlComponent c4(&engine, testFileUrl("aliasreset/aliasPropertyReset.4.qml")); object = c4.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() != 0); QObject *loader = object->findChild<QObject*>("loader"); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); delete loader; QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() == 0); // deletion should have caused value unset. QMetaObject::invokeMethod(object, "resetAlias"); // shouldn't crash. @@ -1557,7 +1557,7 @@ void tst_qqmlecmascript::aliasPropertyReset() // test that binding an alias property to an undefined value works correctly QQmlComponent c5(&engine, testFileUrl("aliasreset/aliasPropertyReset.5.qml")); object = c5.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() == 0); // bound to undefined value. delete object; @@ -1566,7 +1566,7 @@ void tst_qqmlecmascript::aliasPropertyReset() QString warning1 = url.toString() + QLatin1String(":15: Error: Cannot assign [undefined] to int"); QQmlComponent e1(&engine, url); object = e1.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("intAlias").value<int>(), 12); QCOMPARE(object->property("aliasedIntIsUndefined"), QVariant(false)); QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData()); @@ -1638,7 +1638,7 @@ void tst_qqmlecmascript::componentCreation() QQmlComponent component(&engine, testUrl); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, method.toUtf8()); QQmlComponent *created = object->componentProperty(); @@ -1650,7 +1650,7 @@ void tst_qqmlecmascript::componentCreation() if (createdParent == QLatin1String("obj")) { expectedParent = object; } else if ((createdParent == QLatin1String("null")) || createdParent.isEmpty()) { - expectedParent = 0; + expectedParent = nullptr; } QCOMPARE(created->parent(), expectedParent); } @@ -1677,7 +1677,7 @@ void tst_qqmlecmascript::dynamicCreation() QQmlComponent component(&engine, testFileUrl("dynamicCreation.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, method.toUtf8()); QObject *created = object->objectProperty(); @@ -1695,8 +1695,8 @@ void tst_qqmlecmascript::dynamicDestruction() { QQmlComponent component(&engine, testFileUrl("dynamicDeletion.qml")); QPointer<MyQmlObject> object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); - QPointer<QObject> createdQmlObject = 0; + QVERIFY(object != nullptr); + QPointer<QObject> createdQmlObject = nullptr; QMetaObject::invokeMethod(object, "create"); createdQmlObject = object->objectProperty(); @@ -1706,13 +1706,13 @@ void tst_qqmlecmascript::dynamicDestruction() QMetaObject::invokeMethod(object, "killOther"); QVERIFY(createdQmlObject); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(createdQmlObject); for (int ii = 0; createdQmlObject && ii < 50; ++ii) { // After 5 seconds we should give up if (createdQmlObject) { QTest::qWait(100); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } } @@ -1721,7 +1721,7 @@ void tst_qqmlecmascript::dynamicDestruction() QQmlEngine::setObjectOwnership(object, QQmlEngine::JavaScriptOwnership); QMetaObject::invokeMethod(object, "killMe"); QVERIFY(object); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(!object); } @@ -1729,7 +1729,7 @@ void tst_qqmlecmascript::dynamicDestruction() { QQmlComponent component(&engine, testFileUrl("dynamicDeletion.2.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(!qvariant_cast<QObject*>(o->property("objectProperty"))); @@ -1739,7 +1739,7 @@ void tst_qqmlecmascript::dynamicDestruction() QMetaObject::invokeMethod(o, "destroy"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(!qvariant_cast<QObject*>(o->property("objectProperty"))); @@ -1749,10 +1749,10 @@ void tst_qqmlecmascript::dynamicDestruction() { // QTBUG-23451 - QPointer<QObject> createdQmlObject = 0; + QPointer<QObject> createdQmlObject = nullptr; QQmlComponent component(&engine, testFileUrl("dynamicDeletion.3.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(!qvariant_cast<QObject*>(o->property("objectProperty"))); QMetaObject::invokeMethod(o, "create"); createdQmlObject = qvariant_cast<QObject*>(o->property("objectProperty")); @@ -1761,7 +1761,7 @@ void tst_qqmlecmascript::dynamicDestruction() QCOMPARE(qvariant_cast<bool>(o->property("test")), false); for (int ii = 0; createdQmlObject && ii < 50; ++ii) { // After 5 seconds we should give up QTest::qWait(100); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } QVERIFY(!qvariant_cast<QObject*>(o->property("objectProperty"))); @@ -1777,7 +1777,7 @@ void tst_qqmlecmascript::objectToString() { QQmlComponent component(&engine, testFileUrl("qmlToString.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "testToString"); QVERIFY(object->stringProperty().startsWith("MyQmlObject_QML_")); QVERIFY(object->stringProperty().endsWith(", \"objName\")")); @@ -1797,7 +1797,7 @@ void tst_qqmlecmascript::objectHasOwnProperty() QQmlComponent component(&engine, url); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // test QObjects in QML QMetaObject::invokeMethod(object, "testHasOwnPropertySuccess"); @@ -1807,7 +1807,7 @@ void tst_qqmlecmascript::objectHasOwnProperty() // now test other types in QML QObject *child = object->findChild<QObject*>("typeObj"); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QMetaObject::invokeMethod(child, "testHasOwnPropertySuccess"); QCOMPARE(child->property("valueTypeHasOwnProperty").toBool(), true); QCOMPARE(child->property("valueTypeHasOwnProperty2").toBool(), true); @@ -1844,7 +1844,7 @@ void tst_qqmlecmascript::selfDeletingBinding() { QQmlComponent component(&engine, testFileUrl("selfDeletingBinding.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); object->setProperty("triggerDelete", true); delete object; } @@ -1852,7 +1852,7 @@ void tst_qqmlecmascript::selfDeletingBinding() { QQmlComponent component(&engine, testFileUrl("selfDeletingBinding.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); object->setProperty("triggerDelete", true); delete object; } @@ -1869,7 +1869,7 @@ void tst_qqmlecmascript::extendedObjectPropertyLookup() { QQmlComponent component(&engine, testFileUrl("extendedObjectPropertyLookup.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -1880,7 +1880,7 @@ void tst_qqmlecmascript::extendedObjectPropertyLookup2() { QQmlComponent component(&engine, testFileUrl("extendedObjectPropertyLookup2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant returnValue; QVERIFY(QMetaObject::invokeMethod(object, "getValue", Q_RETURN_ARG(QVariant, returnValue))); @@ -1908,7 +1908,7 @@ void tst_qqmlecmascript::extendedObjectPropertyLookup3() QQmlComponent component(&engine, testFileUrl("extendedObjectPropertyLookup3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant returnValue; QVERIFY(QMetaObject::invokeMethod(object, "getAbstractProperty", Q_RETURN_ARG(QVariant, returnValue))); @@ -1943,7 +1943,7 @@ void tst_qqmlecmascript::scriptErrors() QTest::ignoreMessage(QtWarningMsg, warning5.toLatin1().constData()); QTest::ignoreMessage(QtWarningMsg, warning6.toLatin1().constData()); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtWarningMsg, warning4.toLatin1().constData()); emit object->basicSignal(); @@ -1970,14 +1970,14 @@ void tst_qqmlecmascript::functionErrors() QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; // test that if an exception occurs while invoking js function from cpp, it is reported as expected. QQmlComponent componentTwo(&engine, testFileUrl("scarceResourceFunctionFail.var.qml")); url = componentTwo.url().toString(); object = componentTwo.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *resource = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); warning = url + QLatin1String(":16: TypeError: Property 'scarceResource' of object ScarceResourceObject(0x%1) is not a function"); @@ -1997,7 +1997,7 @@ void tst_qqmlecmascript::propertyAssignmentErrors() QString url = component.url().toString(); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QCOMPARE(object->property("test2").toBool(), true); @@ -2013,7 +2013,7 @@ void tst_qqmlecmascript::signalTriggeredBindings() { QQmlComponent component(&engine, testFileUrl("signalTriggeredBindings.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("base").toReal(), 50.); QCOMPARE(object->property("test1").toReal(), 50.); @@ -2041,7 +2041,7 @@ void tst_qqmlecmascript::listProperties() { QQmlComponent component(&engine, testFileUrl("listProperties.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toInt(), 21); QCOMPARE(object->property("test2").toInt(), 2); @@ -2060,7 +2060,7 @@ void tst_qqmlecmascript::exceptionClearsOnReeval() QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), false); @@ -2083,7 +2083,7 @@ void tst_qqmlecmascript::exceptionSlotProducesWarning() QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -2096,7 +2096,7 @@ void tst_qqmlecmascript::exceptionBindingProducesWarning() QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -2105,7 +2105,7 @@ void tst_qqmlecmascript::compileInvalidBinding() // QTBUG-23387: ensure that invalid bindings don't cause a crash. QQmlComponent component(&engine, testFileUrl("v8bindingException.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -2118,7 +2118,7 @@ void tst_qqmlecmascript::transientErrors() QQmlTestMessageHandler messageHandler; QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString())); @@ -2132,7 +2132,7 @@ void tst_qqmlecmascript::transientErrors() QQmlTestMessageHandler messageHandler; QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString())); @@ -2145,7 +2145,7 @@ void tst_qqmlecmascript::shutdownErrors() { QQmlComponent component(&engine, testFileUrl("shutdownErrors.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlTestMessageHandler messageHandler; @@ -2168,7 +2168,7 @@ void tst_qqmlecmascript::jsObject() { QQmlComponent component(&engine, testFileUrl("jsObject.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 92); @@ -2180,7 +2180,7 @@ void tst_qqmlecmascript::undefinedResetsProperty() { QQmlComponent component(&engine, testFileUrl("undefinedResetsProperty.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("resettableProperty").toInt(), 92); @@ -2197,7 +2197,7 @@ void tst_qqmlecmascript::undefinedResetsProperty() { QQmlComponent component(&engine, testFileUrl("undefinedResetsProperty.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("resettableProperty").toInt(), 19); @@ -2214,7 +2214,7 @@ void tst_qqmlecmascript::qtbug_22464() { QQmlComponent component(&engine, testFileUrl("qtbug_22464.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -2226,7 +2226,7 @@ void tst_qqmlecmascript::qtbug_21580() QQmlComponent component(&engine, testFileUrl("qtbug_21580.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -2239,7 +2239,7 @@ void tst_qqmlecmascript::singleV8BindingDestroyedDuringEvaluation() QQmlComponent component(&engine, testFileUrl("singleV8BindingDestroyedDuringEvaluation.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -2248,7 +2248,7 @@ void tst_qqmlecmascript::bug1() { QQmlComponent component(&engine, testFileUrl("bug.1.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 14); @@ -2270,7 +2270,7 @@ void tst_qqmlecmascript::bug2() component.setData("import Qt.test 1.0;\nQPlainTextEdit { width: 100 }", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -2281,7 +2281,7 @@ void tst_qqmlecmascript::dynamicCreationCrash() { QQmlComponent component(&engine, testFileUrl("dynamicCreation.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready"); QMetaObject::invokeMethod(object, "dontCrash"); @@ -2302,9 +2302,9 @@ void tst_qqmlecmascript::dynamicCreationOwnership() QQmlEngine dcoEngine; QQmlComponent component(&dcoEngine, testFileUrl("dynamicCreationOwnership.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MyDynamicCreationDestructionObject *mdcdo = object->findChild<MyDynamicCreationDestructionObject*>("mdcdo"); - QVERIFY(mdcdo != 0); + QVERIFY(mdcdo != nullptr); mdcdo->setDtorCount(&dtorCount); for (int i = 1; i < 105; ++i, ++expectedDtorCount) { @@ -2315,14 +2315,14 @@ void tst_qqmlecmascript::dynamicCreationOwnership() QMetaObject::invokeMethod(object, "performGc"); } if (i % 10 == 0) { - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } } delete object; } - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QCOMPARE(dtorCount, expectedDtorCount); } @@ -2333,7 +2333,7 @@ void tst_qqmlecmascript::regExpBug() { QQmlComponent component(&engine, testFileUrl("regExp.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->regExp().pattern(), QLatin1String("[a-zA-z]")); delete object; } @@ -2731,28 +2731,28 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0)); + QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)nullptr)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(\"Hello world\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0)); + QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)nullptr)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0)); + QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)nullptr)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0)); + QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)nullptr)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(object)", QV4::Primitive::undefinedValue())); @@ -3099,7 +3099,7 @@ void tst_qqmlecmascript::listToVariant() context.setContextObject(&container); QObject *object = component.create(&context); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant v = object->property("test"); QCOMPARE(v.userType(), qMetaTypeId<QQmlListReference>()); @@ -3166,11 +3166,11 @@ void tst_qqmlecmascript::attachedPropertyScope() QQmlComponent component(&engine, testFileUrl("attachedPropertyScope.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MyQmlAttachedObject *attached = qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object)); - QVERIFY(attached != 0); + QVERIFY(attached != nullptr); QCOMPARE(object->property("value2").toInt(), 0); @@ -3187,7 +3187,7 @@ void tst_qqmlecmascript::scriptConnect() QQmlComponent component(&engine, testFileUrl("scriptConnect.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), false); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3200,7 +3200,7 @@ void tst_qqmlecmascript::scriptConnect() QQmlComponent component(&engine, testFileUrl("scriptConnect.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), false); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3213,7 +3213,7 @@ void tst_qqmlecmascript::scriptConnect() QQmlComponent component(&engine, testFileUrl("scriptConnect.3.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), false); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3226,7 +3226,7 @@ void tst_qqmlecmascript::scriptConnect() QQmlComponent component(&engine, testFileUrl("scriptConnect.4.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->methodCalled(), false); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3239,7 +3239,7 @@ void tst_qqmlecmascript::scriptConnect() QQmlComponent component(&engine, testFileUrl("scriptConnect.5.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->methodCalled(), false); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3252,7 +3252,7 @@ void tst_qqmlecmascript::scriptConnect() QQmlComponent component(&engine, testFileUrl("scriptConnect.6.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 0); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3268,7 +3268,7 @@ void tst_qqmlecmascript::scriptDisconnect() QQmlComponent component(&engine, testFileUrl("scriptDisconnect.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 0); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3287,7 +3287,7 @@ void tst_qqmlecmascript::scriptDisconnect() QQmlComponent component(&engine, testFileUrl("scriptDisconnect.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 0); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3306,7 +3306,7 @@ void tst_qqmlecmascript::scriptDisconnect() QQmlComponent component(&engine, testFileUrl("scriptDisconnect.3.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 0); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3324,7 +3324,7 @@ void tst_qqmlecmascript::scriptDisconnect() QQmlComponent component(&engine, testFileUrl("scriptDisconnect.4.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 0); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3361,13 +3361,13 @@ void tst_qqmlecmascript::ownership() { QQmlComponent component(&engine, testFileUrl("ownership.qml")); - QVERIFY(own.object != 0); + QVERIFY(own.object != nullptr); QObject *object = component.create(context); engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(own.object.isNull()); @@ -3380,16 +3380,16 @@ void tst_qqmlecmascript::ownership() { QQmlComponent component(&engine, testFileUrl("ownership.qml")); - QVERIFY(own.object != 0); + QVERIFY(own.object != nullptr); QObject *object = component.create(context); engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); - QVERIFY(own.object != 0); + QVERIFY(own.object != nullptr); delete object; } @@ -3401,7 +3401,7 @@ class CppOwnershipReturnValue : public QObject { Q_OBJECT public: - CppOwnershipReturnValue() : value(0) {} + CppOwnershipReturnValue() : value(nullptr) {} ~CppOwnershipReturnValue() { delete value; } Q_INVOKABLE QObject *create() { @@ -3436,16 +3436,16 @@ void tst_qqmlecmascript::cppOwnershipReturnValue() QObject *object = component.create(); - QVERIFY(object != 0); - QVERIFY(source.value != 0); + QVERIFY(object != nullptr); + QVERIFY(source.value != nullptr); delete object; } - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); - QVERIFY(source.value != 0); + QVERIFY(source.value != nullptr); } // QTBUG-15697 @@ -3464,14 +3464,14 @@ void tst_qqmlecmascript::ownershipCustomReturnValue() QObject *object = component.create(); - QVERIFY(object != 0); - QVERIFY(source.value != 0); + QVERIFY(object != nullptr); + QVERIFY(source.value != nullptr); delete object; } engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(source.value.isNull()); @@ -3483,7 +3483,7 @@ class OwnershipChangingObject : public QObject { Q_OBJECT public: - OwnershipChangingObject(): object(0) { } + OwnershipChangingObject(): object(nullptr) { } QPointer<QObject> object; @@ -3504,10 +3504,10 @@ void tst_qqmlecmascript::ownershipRootObject() engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); - QVERIFY(own.object != 0); + QVERIFY(own.object != nullptr); delete context; delete object; @@ -3534,10 +3534,10 @@ void tst_qqmlecmascript::ownershipConsistency() engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); - QVERIFY(own.object != 0); + QVERIFY(own.object != nullptr); delete context; delete object; @@ -3553,7 +3553,7 @@ void tst_qqmlecmascript::ownershipQmlIncubated() QMetaObject::invokeMethod(object, "deleteIncubatedItem"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(!object->property("incubatedItem").value<QObject*>()); @@ -3605,7 +3605,7 @@ void tst_qqmlecmascript::strictlyEquals() QQmlComponent component(&engine, testFileUrl("strictlyEquals.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QCOMPARE(object->property("test2").toBool(), true); @@ -3624,7 +3624,7 @@ void tst_qqmlecmascript::compiled() QQmlComponent component(&engine, testFileUrl("compiled.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toReal(), qreal(15.7)); QCOMPARE(object->property("test2").toReal(), qreal(-6.7)); @@ -3664,7 +3664,7 @@ void tst_qqmlecmascript::numberAssignment() QQmlComponent component(&engine, testFileUrl("numberAssignment.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1"), QVariant((qreal)6.7)); QCOMPARE(object->property("test2"), QVariant((qreal)6.7)); @@ -3690,7 +3690,7 @@ void tst_qqmlecmascript::propertySplicing() QQmlComponent component(&engine, testFileUrl("propertySplicing.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -3703,7 +3703,7 @@ void tst_qqmlecmascript::signalWithUnknownTypes() QQmlComponent component(&engine, testFileUrl("signalWithUnknownTypes.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MyQmlObject::MyType type; type.value = 0x8971123; @@ -3755,7 +3755,7 @@ void tst_qqmlecmascript::signalWithJSValueInVariant() QQmlComponent component(&engine, testFileUrl("signalWithJSValueInVariant.qml")); QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject *>(component.create())); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QJSValue value = engine.evaluate(expression); QVERIFY(!value.isError()); @@ -3779,7 +3779,7 @@ void tst_qqmlecmascript::signalWithJSValueInVariant_twoEngines() QQmlComponent component(&engine, testFileUrl("signalWithJSValueInVariant.qml")); QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject *>(component.create())); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QJSEngine engine2; QJSValue value = engine2.evaluate(expression); @@ -3809,7 +3809,7 @@ void tst_qqmlecmascript::signalWithQJSValue() QQmlComponent component(&engine, testFileUrl("signalWithQJSValue.qml")); QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject *>(component.create())); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QJSValue value = engine.evaluate(expression); QVERIFY(!value.isError()); @@ -3975,7 +3975,7 @@ void tst_qqmlecmascript::singletonType() if (!errorMessage.isEmpty()) { QVERIFY(!object); } else { - QVERIFY(object != 0); + QVERIFY(object != nullptr); for (int i = 0; i < readProperties.size(); ++i) QCOMPARE(object->property(readProperties.at(i).toLatin1().constData()), readExpectedValues.at(i)); for (int i = 0; i < writeProperties.size(); ++i) @@ -4010,7 +4010,7 @@ void tst_qqmlecmascript::singletonTypeCaching() QQmlEngine cleanEngine; QQmlComponent component(&cleanEngine, testfile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QList<QVariant> firstValues; QMetaObject::invokeMethod(object, "modifyValues"); for (int i = 0; i < readProperties.size(); ++i) @@ -4019,7 +4019,7 @@ void tst_qqmlecmascript::singletonTypeCaching() QQmlComponent component2(&cleanEngine, testfile); QObject *object2 = component2.create(); - QVERIFY(object2 != 0); + QVERIFY(object2 != nullptr); for (int i = 0; i < readProperties.size(); ++i) QCOMPARE(object2->property(readProperties.at(i).toLatin1().constData()), firstValues.at(i)); // cached, shouldn't have changed. delete object2; @@ -4055,18 +4055,18 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) { QQmlContextData *scriptContext, *newContext; qml = scripts->getIndexed(i); - scriptContext = qml ? qml->getContext() : 0; + scriptContext = qml ? qml->getContext() : nullptr; qml = QV4::Encode::undefined(); { QV4::Scope scope(v4); - QV4::ScopedContext temporaryScope(scope, QV4::QmlContext::create(scope.engine->rootContext(), scriptContext, 0)); + QV4::ScopedContext temporaryScope(scope, QV4::QmlContext::create(scope.engine->rootContext(), scriptContext, nullptr)); Q_UNUSED(temporaryScope) } ctxt->engine->collectGarbage(); qml = scripts->getIndexed(i); - newContext = qml ? qml->getContext() : 0; + newContext = qml ? qml->getContext() : nullptr; QCOMPARE(scriptContext, newContext); } } @@ -4341,7 +4341,7 @@ void tst_qqmlecmascript::importScripts() if (!errorMessage.isEmpty()) { QVERIFY(!object); } else { - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlContextData *ctxt = QQmlContextData::get(engine.rootContext()); tst_qqmlecmascript::verifyContextLifetime(ctxt); @@ -4377,9 +4377,9 @@ void tst_qqmlecmascript::scarceResources_other() origPixmap.fill(Qt::blue); QString srp_name, expectedWarning; QV4::ExecutionEngine *v4 = engine.handle(); - ScarceResourceObject *eo = 0; - QObject *srsc = 0; - QObject *object = 0; + ScarceResourceObject *eo = nullptr; + QObject *srsc = nullptr; + QObject *object = nullptr; /* property var semantics */ @@ -4408,7 +4408,7 @@ void tst_qqmlecmascript::scarceResources_other() // test that scarce resources are handled properly from js functions in qml files QQmlComponent varComponentEleven(&engine, testFileUrl("scarceResourceFunction.var.qml")); object = varComponentEleven.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. @@ -4427,7 +4427,7 @@ void tst_qqmlecmascript::scarceResources_other() // test that if an exception occurs while invoking js function from cpp, that the resources are released. QQmlComponent varComponentTwelve(&engine, testFileUrl("scarceResourceFunctionFail.var.qml")); object = varComponentTwelve.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. @@ -4445,7 +4445,7 @@ void tst_qqmlecmascript::scarceResources_other() // that the scarce resource is removed from the engine's list of scarce resources to clean up. QQmlComponent varComponentThirteen(&engine, testFileUrl("scarceResourceObjectGc.var.qml")); object = varComponentThirteen.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(!object->property("varProperty").isValid()); // not assigned yet QMetaObject::invokeMethod(object, "assignVarProperty"); QVERIFY(v4->scarceResources.isEmpty()); // the scarce resource is a VME property. @@ -4459,7 +4459,7 @@ void tst_qqmlecmascript::scarceResources_other() // test that scarce resources are handled properly in signal invocation QQmlComponent variantComponentTen(&engine, testFileUrl("scarceResourceSignal.variant.qml")); object = variantComponentTen.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); srsc = object->findChild<QObject*>("srsc"); QVERIFY(srsc); QVERIFY(!srsc->property("scarceResourceCopy").isValid()); // hasn't been instantiated yet. @@ -4482,7 +4482,7 @@ void tst_qqmlecmascript::scarceResources_other() // test that scarce resources are handled properly from js functions in qml files QQmlComponent variantComponentEleven(&engine, testFileUrl("scarceResourceFunction.variant.qml")); object = variantComponentEleven.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. @@ -4501,7 +4501,7 @@ void tst_qqmlecmascript::scarceResources_other() // test that if an exception occurs while invoking js function from cpp, that the resources are released. QQmlComponent variantComponentTwelve(&engine, testFileUrl("scarceResourceFunctionFail.variant.qml")); object = variantComponentTwelve.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. @@ -4748,12 +4748,12 @@ void tst_qqmlecmascript::scarceResources() QFETCH(QStringList, expectedErrors); QV4::ExecutionEngine *v4 = engine.handle(); - ScarceResourceObject *eo = 0; - QObject *object = 0; + ScarceResourceObject *eo = nullptr; + QObject *object = nullptr; QQmlComponent c(&engine, qmlFile); object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); for (int i = 0; i < propertyNames.size(); ++i) { QString prop = propertyNames.at(i); bool validity = expectedValidity.at(i).toBool(); @@ -4781,7 +4781,7 @@ void tst_qqmlecmascript::propertyChangeSlots() // ensure that allowable property names are allowed and onPropertyNameChanged slots are generated correctly. QQmlComponent component(&engine, testFileUrl("changeslots/propertyChangeSlots.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; // ensure that invalid property names fail properly. @@ -4847,7 +4847,7 @@ void tst_qqmlecmascript::propertyVar() QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -4886,7 +4886,7 @@ void tst_qqmlecmascript::propertyQJSValue() QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -4896,14 +4896,14 @@ void tst_qqmlecmascript::propertyQJSValue() // Tests that we can write QVariant values to var properties from C++ void tst_qqmlecmascript::propertyVarCpp() { - QObject *object = 0; + QObject *object = nullptr; // ensure that writing to and reading from a var property from cpp works as required. // Literal values stored in var properties can be read and written as QVariants // of a specific type, whereas object values are read as QVariantMaps. QQmlComponent component(&engine, testFileUrl("propertyVarCpp.qml")); object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // assign int to property var that currently has int assigned QVERIFY(object->setProperty("varProperty", QVariant::fromValue(10))); QCOMPARE(object->property("varBound"), QVariant(15)); @@ -4926,7 +4926,7 @@ void tst_qqmlecmascript::propertyVarOwnership() { QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), false); QMetaObject::invokeMethod(object, "runTest"); QCOMPARE(object->property("test").toBool(), true); @@ -4936,7 +4936,7 @@ void tst_qqmlecmascript::propertyVarOwnership() { QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), false); QMetaObject::invokeMethod(object, "runTest"); QCOMPARE(object->property("test").toBool(), true); @@ -4946,7 +4946,7 @@ void tst_qqmlecmascript::propertyVarOwnership() { QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test2").toBool(), false); QCOMPARE(object->property("test2").toBool(), false); @@ -4970,7 +4970,7 @@ void tst_qqmlecmascript::propertyVarOwnership() { QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.4.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -4989,7 +4989,7 @@ void tst_qqmlecmascript::propertyVarOwnership() { QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.5.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "createComponent"); engine.collectGarbage(); QMetaObject::invokeMethod(object, "runTest"); @@ -5005,20 +5005,20 @@ void tst_qqmlecmascript::propertyVarImplicitOwnership() // has implicit ownership of the constructed QObject. QQmlComponent component(&engine, testFileUrl("propertyVarImplicitOwnership.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignCircular"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QObject *rootObject = object->property("vp").value<QObject*>(); - QVERIFY(rootObject != 0); + QVERIFY(rootObject != nullptr); QObject *childObject = rootObject->findChild<QObject*>("text"); - QVERIFY(childObject != 0); + QVERIFY(childObject != nullptr); QCOMPARE(rootObject->property("rectCanary").toInt(), 5); QCOMPARE(childObject->property("textCanary").toInt(), 10); QMetaObject::invokeMethod(childObject, "constructQObject"); // creates a reference to a constructed QObject. QPointer<QObject> qobjectGuard(childObject->property("vp").value<QObject*>()); // get the pointer prior to processing deleteLater events. QVERIFY(!qobjectGuard.isNull()); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QVERIFY(!qobjectGuard.isNull()); QMetaObject::invokeMethod(object, "deassignCircular"); @@ -5032,9 +5032,9 @@ void tst_qqmlecmascript::propertyVarReparent() // ensure that nothing breaks if we re-parent objects QQmlComponent component(&engine, testFileUrl("propertyVar.reparent.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignVarProp"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QObject *rect = object->property("vp").value<QObject*>(); QObject *text = rect->findChild<QObject*>("textOne"); @@ -5074,9 +5074,9 @@ void tst_qqmlecmascript::propertyVarReparentNullContext() // this test ensures that no crash occurs in that situation. QQmlComponent component(&engine, testFileUrl("propertyVar.reparent.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignVarProp"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QObject *rect = object->property("vp").value<QObject*>(); QObject *text = rect->findChild<QObject*>("textOne"); @@ -5110,7 +5110,7 @@ void tst_qqmlecmascript::propertyVarCircular() // enforce behaviour regarding circular references - ensure qdvmemo deletion. QQmlComponent component(&engine, testFileUrl("propertyVar.circular.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignCircular"); // cause assignment and gc { QCOMPARE(object->property("canaryInt"), QVariant(5)); @@ -5118,7 +5118,7 @@ void tst_qqmlecmascript::propertyVarCircular() QVERIFY(canaryResourceVariant.isValid()); } - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QCOMPARE(object->property("canaryInt"), QVariant(5)); QVariant canaryResourceVariant = object->property("canaryResource"); @@ -5142,14 +5142,14 @@ void tst_qqmlecmascript::propertyVarCircular2() // where the child has a var property referencing its parent. QQmlComponent component(&engine, testFileUrl("propertyVar.circular.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignCircular"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QObject *rootObject = object->property("vp").value<QObject*>(); - QVERIFY(rootObject != 0); + QVERIFY(rootObject != nullptr); QObject *childObject = rootObject->findChild<QObject*>("text"); - QVERIFY(childObject != 0); + QVERIFY(childObject != nullptr); QPointer<QObject> rootObjectTracker(rootObject); QVERIFY(!rootObjectTracker.isNull()); QPointer<QObject> childObjectTracker(childObject); @@ -5170,9 +5170,9 @@ void tst_qqmlecmascript::propertyVarInheritance() // The particular component under test here has a chain of references. QQmlComponent component(&engine, testFileUrl("propertyVar.inherit.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignCircular"); // cause assignment and gc - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); // we want to be able to track when the varProperties array of the last metaobject is disposed QObject *cco5 = object->property("varProperty").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>(); @@ -5215,14 +5215,14 @@ void tst_qqmlecmascript::propertyVarInheritance2() // only link between rootObject and childObject is that rootObject is the parent of childObject. QQmlComponent component(&engine, testFileUrl("propertyVar.circular.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignCircular"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QObject *rootObject = object->property("vp").value<QObject*>(); - QVERIFY(rootObject != 0); + QVERIFY(rootObject != nullptr); QObject *childObject = rootObject->findChild<QObject*>("text"); - QVERIFY(childObject != 0); + QVERIFY(childObject != nullptr); QCOMPARE(rootObject->property("rectCanary").toInt(), 5); QCOMPARE(childObject->property("textCanary").toInt(), 10); QV4::WeakValue childObjectVarArrayValueHandle; @@ -5249,7 +5249,7 @@ void tst_qqmlecmascript::elementAssign() QQmlComponent component(&engine, testFileUrl("elementAssign.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -5262,7 +5262,7 @@ void tst_qqmlecmascript::objectPassThroughSignals() QQmlComponent component(&engine, testFileUrl("objectsPassThroughSignals.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -5275,7 +5275,7 @@ void tst_qqmlecmascript::objectConversion() QQmlComponent component(&engine, testFileUrl("objectConversion.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant retn; QMetaObject::invokeMethod(object, "circularObject", Q_RETURN_ARG(QVariant, retn)); QCOMPARE(retn.value<QJSValue>().property("test").toInt(), int(100)); @@ -5290,7 +5290,7 @@ void tst_qqmlecmascript::booleanConversion() QQmlComponent component(&engine, testFileUrl("booleanConversion.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test_true1").toBool(), true); QCOMPARE(object->property("test_true2").toBool(), true); @@ -5313,7 +5313,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QQmlEngine hrmEngine; QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.object.1.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); CircularReferenceObject *cro = object->findChild<CircularReferenceObject*>("cro"); cro->setDtorCount(&dtorCount); QMetaObject::invokeMethod(object, "createReference"); @@ -5321,7 +5321,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QCOMPARE(dtorCount, 0); // second has JS ownership, kept alive by first's reference delete object; hrmEngine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QCOMPARE(dtorCount, 3); } @@ -5332,7 +5332,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QQmlEngine hrmEngine; QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.object.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); CircularReferenceObject *cro = object->findChild<CircularReferenceObject*>("cro"); cro->setDtorCount(&dtorCount); QMetaObject::invokeMethod(object, "circularReference"); @@ -5340,7 +5340,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QCOMPARE(dtorCount, 2); // both should be cleaned up, since circular references shouldn't keep alive. delete object; hrmEngine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QCOMPARE(dtorCount, 3); } @@ -5350,7 +5350,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QQmlEngine hrmEngine; QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.dynprop.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "createReference"); gc(hrmEngine); QMetaObject::invokeMethod(object, "ensureReference"); @@ -5367,7 +5367,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QQmlEngine hrmEngine; QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.dynprop.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "createReference"); gc(hrmEngine); QMetaObject::invokeMethod(object, "ensureReference"); @@ -5384,7 +5384,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QQmlEngine hrmEngine; QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.dynprop.3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "createReference"); gc(hrmEngine); QMetaObject::invokeMethod(object, "ensureReference"); @@ -5401,7 +5401,7 @@ void tst_qqmlecmascript::stringArg() { QQmlComponent component(&engine, testFileUrl("stringArg.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "success"); QVERIFY(object->property("returnValue").toBool()); @@ -5418,7 +5418,7 @@ void tst_qqmlecmascript::readonlyDeclaration() QQmlComponent component(&engine, testFileUrl("readonlyDeclaration.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -5436,9 +5436,9 @@ void tst_qqmlecmascript::sequenceConversionRead() QUrl qmlFile = testFileUrl("sequenceConversion.read.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco"); - QVERIFY(seq != 0); + QVERIFY(seq != nullptr); QMetaObject::invokeMethod(object, "readSequences"); QList<int> intList; intList << 1 << 2 << 3 << 4; @@ -5487,9 +5487,9 @@ void tst_qqmlecmascript::sequenceConversionRead() QUrl qmlFile = testFileUrl("sequenceConversion.read.error.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco"); - QVERIFY(seq != 0); + QVERIFY(seq != nullptr); // we haven't registered QList<NonRegisteredType> as a sequence type. QString warningOne = QLatin1String("QMetaProperty::read: Unable to handle unregistered datatype 'QList<NonRegisteredType>' for property 'MySequenceConversionObject::typeListProperty'"); @@ -5516,9 +5516,9 @@ void tst_qqmlecmascript::sequenceConversionWrite() QUrl qmlFile = testFileUrl("sequenceConversion.write.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco"); - QVERIFY(seq != 0); + QVERIFY(seq != nullptr); QMetaObject::invokeMethod(object, "writeSequences"); QCOMPARE(object->property("success").toBool(), true); @@ -5539,9 +5539,9 @@ void tst_qqmlecmascript::sequenceConversionWrite() QUrl qmlFile = testFileUrl("sequenceConversion.write.error.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco"); - QVERIFY(seq != 0); + QVERIFY(seq != nullptr); // we haven't registered QList<QPoint> as a sequence type, so writing shouldn't work. QString warningOne = qmlFile.toString() + QLatin1String(":16: Error: Cannot assign QJSValue to QList<QPoint>"); @@ -5562,7 +5562,7 @@ void tst_qqmlecmascript::sequenceConversionArray() QUrl qmlFile = testFileUrl("sequenceConversion.array.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "indexedAccess"); QVERIFY(object->property("success").toBool()); QMetaObject::invokeMethod(object, "arrayOperations"); @@ -5582,7 +5582,7 @@ void tst_qqmlecmascript::sequenceConversionIndexes() QUrl qmlFile = testFileUrl("sequenceConversion.indexes.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString w1 = qmlFile.toString() + QLatin1String(":34: Index out of range during length set"); QString w2 = qmlFile.toString() + QLatin1String(":41: Index out of range during indexed set"); QString w3 = qmlFile.toString() + QLatin1String(":48: Index out of range during indexed get"); @@ -5603,7 +5603,7 @@ void tst_qqmlecmascript::sequenceConversionThreads() QUrl qmlFile = testFileUrl("sequenceConversion.threads.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "testIntSequence"); QTRY_VERIFY(object->property("finished").toBool()); @@ -5642,7 +5642,7 @@ void tst_qqmlecmascript::sequenceConversionBindings() QUrl qmlFile = testFileUrl("sequenceConversion.bindings.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QList<int> intList; intList << 1 << 2 << 3 << 12 << 7; QCOMPARE(object->property("boundSequence").value<QList<int> >(), intList); QCOMPARE(object->property("boundElement").toInt(), intList.at(3)); @@ -5657,7 +5657,7 @@ void tst_qqmlecmascript::sequenceConversionBindings() QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } } @@ -5667,7 +5667,7 @@ void tst_qqmlecmascript::sequenceConversionCopy() QUrl qmlFile = testFileUrl("sequenceConversion.copy.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "testCopySequences"); QCOMPARE(object->property("success").toBool(), true); QMetaObject::invokeMethod(object, "readSequenceCopyElements"); @@ -5687,7 +5687,7 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.1.qml")); MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->intListProperty(), (QList<int>() << 1 << 2)); QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1 << 2.2 << 3)); QCOMPARE(object->boolListProperty(), (QList<bool>() << false << true)); @@ -5701,7 +5701,7 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.2.qml")); MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->intListProperty(), (QList<int>() << 1)); QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1)); QCOMPARE(object->boolListProperty(), (QList<bool>() << false)); @@ -5715,7 +5715,7 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.3.qml")); MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->intListProperty(), (QList<int>() << 1)); QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1)); QCOMPARE(object->boolListProperty(), (QList<bool>() << false)); @@ -5727,7 +5727,7 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.4.qml")); MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->intListProperty(), (QList<int>() << 1 << 2)); QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1 << 2.2 << 3)); QCOMPARE(object->boolListProperty(), (QList<bool>() << false << true)); @@ -5741,7 +5741,7 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.5.qml")); MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->intListProperty(), (QList<int>() << 1)); QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1)); QCOMPARE(object->boolListProperty(), (QList<bool>() << false)); @@ -5755,7 +5755,7 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.6.qml")); MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->intListProperty(), (QList<int>() << 1)); QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1)); QCOMPARE(object->boolListProperty(), (QList<bool>() << false)); @@ -5767,13 +5767,13 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.7.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MySequenceConversionObject *msco1 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco1")); MySequenceConversionObject *msco2 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco2")); MySequenceConversionObject *msco3 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco3")); MySequenceConversionObject *msco4 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco4")); MySequenceConversionObject *msco5 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco5")); - QVERIFY(msco1 != 0 && msco2 != 0 && msco3 != 0 && msco4 != 0 && msco5 != 0); + QVERIFY(msco1 != nullptr && msco2 != nullptr && msco3 != nullptr && msco4 != nullptr && msco5 != nullptr); QCOMPARE(msco1->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")))); QCOMPARE(msco2->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")))); QCOMPARE(msco3->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")) << QUrl(testFileUrl("example2.html")))); @@ -5790,9 +5790,9 @@ void tst_qqmlecmascript::nullObjectBinding() QQmlComponent component(&engine, testFileUrl("nullObjectBinding.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); - QVERIFY(object->property("test") == QVariant::fromValue((QObject *)0)); + QVERIFY(object->property("test") == QVariant::fromValue((QObject *)nullptr)); delete object; } @@ -5847,7 +5847,7 @@ void tst_qqmlecmascript::deletedEngine() QQmlComponent component(engine, testFileUrl("deletedEngine.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("a").toInt(), 39); object->setProperty("b", QVariant(9)); @@ -5869,7 +5869,7 @@ void tst_qqmlecmascript::libraryScriptAssert() QQmlComponent component(&engine, testFileUrl("libraryScriptAssert.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -5879,7 +5879,7 @@ void tst_qqmlecmascript::variantsAssignedUndefined() QQmlComponent component(&engine, testFileUrl("variantsAssignedUndefined.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toInt(), 10); QCOMPARE(object->property("test2").toInt(), 11); @@ -5898,7 +5898,7 @@ void tst_qqmlecmascript::variants() QQmlComponent component(&engine, testFileUrl("variants.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("undefinedVariant").type(), QVariant::Invalid); QCOMPARE(int(object->property("nullVariant").type()), int(QMetaType::Nullptr)); @@ -5923,7 +5923,7 @@ void tst_qqmlecmascript::qtbug_9792() QQmlContext *context = new QQmlContext(engine.rootContext()); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create(context)); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtDebugMsg, "Hello world!"); object->basicSignal(); @@ -5945,10 +5945,10 @@ void tst_qqmlecmascript::qtcreatorbug_1289() QQmlComponent component(&engine, testFileUrl("qtcreatorbug_1289.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QObject *nested = qvariant_cast<QObject *>(o->property("object")); - QVERIFY(nested != 0); + QVERIFY(nested != nullptr); QVERIFY(qvariant_cast<QObject *>(nested->property("nestedObject")) == o); @@ -5995,9 +5995,9 @@ void tst_qqmlecmascript::canAssignNullToQObject() QQmlComponent component(&engine, testFileUrl("canAssignNullToQObject.1.qml")); MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); - QVERIFY(o->objectProperty() != 0); + QVERIFY(o->objectProperty() != nullptr); o->setProperty("runTest", true); @@ -6010,7 +6010,7 @@ void tst_qqmlecmascript::canAssignNullToQObject() QQmlComponent component(&engine, testFileUrl("canAssignNullToQObject.2.qml")); MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(!o->objectProperty()); @@ -6033,7 +6033,7 @@ void tst_qqmlecmascript::functionAssignment_fromBinding() QTest::ignoreMessage(QtWarningMsg, w4.toLatin1().constData()); MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(!o->property("a").isValid()); @@ -6048,7 +6048,7 @@ void tst_qqmlecmascript::functionAssignment_fromJS() QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString())); MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(!o->property("a").isValid()); o->setProperty("aNumber", QVariant(5)); @@ -6080,7 +6080,7 @@ void tst_qqmlecmascript::functionAssignmentfromJS_invalid() QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString())); MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(!o->property("a").isValid()); o->setProperty("assignFuncWithoutReturn", true); @@ -6107,7 +6107,7 @@ void tst_qqmlecmascript::functionAssignment_afterBinding() QTest::ignoreMessage(QtWarningMsg, w1.toLatin1().constData()); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("t1"), QVariant::fromValue<int>(4)); // should have bound QCOMPARE(o->property("t2"), QVariant::fromValue<int>(2)); // should not have changed @@ -6119,7 +6119,7 @@ void tst_qqmlecmascript::eval() QQmlComponent component(&engine, testFileUrl("eval.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); @@ -6135,7 +6135,7 @@ void tst_qqmlecmascript::function() QQmlComponent component(&engine, testFileUrl("function.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); @@ -6151,7 +6151,7 @@ void tst_qqmlecmascript::include() { QQmlComponent component(&engine, testFileUrl("include.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test0").toInt(), 99); QCOMPARE(o->property("test1").toBool(), true); @@ -6167,7 +6167,7 @@ void tst_qqmlecmascript::include() { QQmlComponent component(&engine, testFileUrl("include_shared.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test0").toInt(), 99); QCOMPARE(o->property("test1").toBool(), true); @@ -6183,7 +6183,7 @@ void tst_qqmlecmascript::include() { QQmlComponent component(&engine, testFileUrl("include_callback.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); @@ -6199,7 +6199,7 @@ void tst_qqmlecmascript::include() { QQmlComponent component(&engine, testFileUrl("include_pragma.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toInt(), 100); delete o; @@ -6213,7 +6213,7 @@ void tst_qqmlecmascript::include() QQmlComponent component(&engine, testFileUrl("include_remote_missing.qml")); QObject *o = component.beginCreate(engine.rootContext()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); o->setProperty("serverBaseUrl", server.baseUrl().toString()); component.completeCreate(); @@ -6230,7 +6230,7 @@ void tst_qqmlecmascript::include() { QQmlComponent component(&engine, QUrl("qrc:///data/include.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test0").toInt(), 99); QCOMPARE(o->property("test1").toBool(), true); @@ -6253,7 +6253,7 @@ void tst_qqmlecmascript::includeRemoteSuccess() QQmlComponent component(&engine, testFileUrl("include_remote.qml")); QObject *o = component.beginCreate(engine.rootContext()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); o->setProperty("serverBaseUrl", server.baseUrl().toString()); component.completeCreate(); @@ -6279,7 +6279,7 @@ void tst_qqmlecmascript::signalHandlers() { QQmlComponent component(&engine, testFileUrl("signalHandlers.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("count").toInt(), 0); QMetaObject::invokeMethod(o, "testSignalCall"); @@ -6340,7 +6340,7 @@ void tst_qqmlecmascript::qtbug_10696() { QQmlComponent component(&engine, testFileUrl("qtbug_10696.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); delete o; } @@ -6348,7 +6348,7 @@ void tst_qqmlecmascript::qtbug_11606() { QQmlComponent component(&engine, testFileUrl("qtbug_11606.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); delete o; } @@ -6357,7 +6357,7 @@ void tst_qqmlecmascript::qtbug_11600() { QQmlComponent component(&engine, testFileUrl("qtbug_11600.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); delete o; } @@ -6366,7 +6366,7 @@ void tst_qqmlecmascript::qtbug_21864() { QQmlComponent component(&engine, testFileUrl("qtbug_21864.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); delete o; } @@ -6377,7 +6377,7 @@ void tst_qqmlecmascript::rewriteMultiLineStrings() // QTBUG-23387 QQmlComponent component(&engine, testFileUrl("rewriteMultiLineStrings.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QTRY_COMPARE(o->property("test").toBool(), true); delete o; } @@ -6385,7 +6385,7 @@ void tst_qqmlecmascript::rewriteMultiLineStrings() { QQmlComponent component(&engine, testFileUrl("rewriteMultiLineStrings_crlf.1.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); delete o; } } @@ -6399,7 +6399,7 @@ void tst_qqmlecmascript::qobjectConnectionListExceptionHandling() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); delete o; } @@ -6409,7 +6409,7 @@ void tst_qqmlecmascript::nonscriptable() { QQmlComponent component(&engine, testFileUrl("nonscriptable.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("readOk").toBool(), true); QCOMPARE(o->property("writeOk").toBool(), true); delete o; @@ -6420,7 +6420,7 @@ void tst_qqmlecmascript::deleteLater() { QQmlComponent component(&engine, testFileUrl("deleteLater.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); delete o; } @@ -6430,7 +6430,7 @@ void tst_qqmlecmascript::objectNameChangedSignal() { QQmlComponent component(&engine, testFileUrl("objectNameChangedSignal.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), false); o->setObjectName("obj"); QCOMPARE(o->property("test").toBool(), true); @@ -6451,7 +6451,7 @@ void tst_qqmlecmascript::in() { QQmlComponent component(&engine, testFileUrl("in.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); delete o; @@ -6462,7 +6462,7 @@ void tst_qqmlecmascript::typeOf() QQmlComponent component(&engine, testFileUrl("typeOf.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toString(), QLatin1String("undefined")); QCOMPARE(o->property("test2").toString(), QLatin1String("object")); @@ -6481,7 +6481,7 @@ void tst_qqmlecmascript::qtbug_24448() { QQmlComponent component(&engine, testFileUrl("qtbug_24448.qml")); QScopedPointer<QObject> o(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(o->property("test").toBool()); } @@ -6489,7 +6489,7 @@ void tst_qqmlecmascript::sharedAttachedObject() { QQmlComponent component(&engine, testFileUrl("sharedAttachedObject.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); delete o; @@ -6500,7 +6500,7 @@ void tst_qqmlecmascript::objectName() { QQmlComponent component(&engine, testFileUrl("objectName.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toString(), QString("hello")); QCOMPARE(o->property("test2").toString(), QString("ell")); @@ -6517,7 +6517,7 @@ void tst_qqmlecmascript::writeRemovesBinding() { QQmlComponent component(&engine, testFileUrl("writeRemovesBinding.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6529,7 +6529,7 @@ void tst_qqmlecmascript::aliasBindingsAssignCorrectly() { QQmlComponent component(&engine, testFileUrl("aliasBindingsAssignCorrectly.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6542,7 +6542,7 @@ void tst_qqmlecmascript::aliasBindingsOverrideTarget() { QQmlComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6552,7 +6552,7 @@ void tst_qqmlecmascript::aliasBindingsOverrideTarget() { QQmlComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.2.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6562,7 +6562,7 @@ void tst_qqmlecmascript::aliasBindingsOverrideTarget() { QQmlComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.3.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6576,7 +6576,7 @@ void tst_qqmlecmascript::aliasWritesOverrideBindings() { QQmlComponent component(&engine, testFileUrl("aliasWritesOverrideBindings.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6586,7 +6586,7 @@ void tst_qqmlecmascript::aliasWritesOverrideBindings() { QQmlComponent component(&engine, testFileUrl("aliasWritesOverrideBindings.2.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6596,7 +6596,7 @@ void tst_qqmlecmascript::aliasWritesOverrideBindings() { QQmlComponent component(&engine, testFileUrl("aliasWritesOverrideBindings.3.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6611,7 +6611,7 @@ void tst_qqmlecmascript::aliasToCompositeElement() QQmlComponent component(&engine, testFileUrl("aliasToCompositeElement.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -6624,7 +6624,7 @@ void tst_qqmlecmascript::qtbug_20344() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -6643,7 +6643,7 @@ void tst_qqmlecmascript::revisionErrors() QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData()); QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData()); MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } { @@ -6665,7 +6665,7 @@ void tst_qqmlecmascript::revisionErrors() QTest::ignoreMessage(QtWarningMsg, warning4.toLatin1().constData()); QTest::ignoreMessage(QtWarningMsg, warning5.toLatin1().constData()); MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } { @@ -6681,7 +6681,7 @@ void tst_qqmlecmascript::revisionErrors() QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData()); QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData()); MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } } @@ -6693,7 +6693,7 @@ void tst_qqmlecmascript::revision() QString url = component.url().toString(); MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } { @@ -6701,7 +6701,7 @@ void tst_qqmlecmascript::revision() QString url = component.url().toString(); MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } { @@ -6709,7 +6709,7 @@ void tst_qqmlecmascript::revision() QString url = component.url().toString(); MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } // Test that non-root classes can resolve revisioned methods @@ -6717,7 +6717,7 @@ void tst_qqmlecmascript::revision() QQmlComponent component(&engine, testFileUrl("metaobjectRevision4.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toReal(), 11.); delete object; } @@ -6726,7 +6726,7 @@ void tst_qqmlecmascript::revision() QQmlComponent component(&engine, testFileUrl("metaobjectRevision5.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toReal(), 11.); delete object; } @@ -6736,7 +6736,7 @@ void tst_qqmlecmascript::realToInt() { QQmlComponent component(&engine, testFileUrl("realToInt.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "test1"); QCOMPARE(object->value(), int(4)); @@ -6749,7 +6749,7 @@ void tst_qqmlecmascript::urlProperty() { QQmlComponent component(&engine, testFileUrl("urlProperty.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); object->setStringProperty("http://qt-project.org"); QCOMPARE(object->urlProperty(), QUrl("http://qt-project.org/index.html")); QCOMPARE(object->intProperty(), 123); @@ -6763,7 +6763,7 @@ void tst_qqmlecmascript::urlPropertyWithEncoding() { QQmlComponent component(&engine, testFileUrl("urlProperty.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); object->setStringProperty("http://qt-project.org"); const QUrl encoded = QUrl::fromEncoded("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode); QCOMPARE(object->urlProperty(), encoded); @@ -6777,12 +6777,12 @@ void tst_qqmlecmascript::urlListPropertyWithEncoding() { QQmlComponent component(&engine, testFileUrl("urlListProperty.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MySequenceConversionObject *msco1 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco1")); MySequenceConversionObject *msco2 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco2")); MySequenceConversionObject *msco3 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco3")); MySequenceConversionObject *msco4 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco4")); - QVERIFY(msco1 != 0 && msco2 != 0 && msco3 != 0 && msco4 != 0); + QVERIFY(msco1 != nullptr && msco2 != nullptr && msco3 != nullptr && msco4 != nullptr); const QUrl encoded = QUrl::fromEncoded("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode); QCOMPARE(msco1->urlListProperty(), (QList<QUrl>() << encoded)); QCOMPARE(msco2->urlListProperty(), (QList<QUrl>() << encoded)); @@ -6796,7 +6796,7 @@ void tst_qqmlecmascript::dynamicString() { QQmlComponent component(&engine, testFileUrl("dynamicString.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("stringProperty").toString(), QString::fromLatin1("string:Hello World false:0 true:1 uint32:100 int32:-100 double:3.14159 date:2011-02-11 05::30:50!")); } @@ -6805,35 +6805,35 @@ void tst_qqmlecmascript::deleteLaterObjectMethodCall() { QQmlComponent component(&engine, testFileUrl("deleteLaterObjectMethodCall.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlecmascript::automaticSemicolon() { QQmlComponent component(&engine, testFileUrl("automaticSemicolon.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlecmascript::compatibilitySemicolon() { QQmlComponent component(&engine, testFileUrl("compatibilitySemicolon.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlecmascript::incrDecrSemicolon1() { QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon1.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlecmascript::incrDecrSemicolon2() { QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlecmascript::incrDecrSemicolon_error1() @@ -6847,7 +6847,7 @@ void tst_qqmlecmascript::unaryExpression() { QQmlComponent component(&engine, testFileUrl("unaryExpression.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } // Makes sure that a binding isn't double re-evaluated when it depends on the same variable twice @@ -6855,9 +6855,9 @@ void tst_qqmlecmascript::doubleEvaluate() { QQmlComponent component(&engine, testFileUrl("doubleEvaluate.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); WriteCounter *wc = qobject_cast<WriteCounter *>(object); - QVERIFY(wc != 0); + QVERIFY(wc != nullptr); QCOMPARE(wc->count(), 1); wc->setProperty("x", 9); @@ -6875,7 +6875,7 @@ void tst_qqmlecmascript::nonNotifyable() QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString expected1 = QLatin1String("QQmlExpression: Expression ") + component.url().toString() + @@ -6907,7 +6907,7 @@ void tst_qqmlecmascript::forInLoop() { QQmlComponent component(&engine, testFileUrl("forInLoop.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "listProperty"); @@ -6927,7 +6927,7 @@ void tst_qqmlecmascript::deleteWhileBindingRunning() { QQmlComponent component(&engine, testFileUrl("deleteWhileBindingRunning.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -6942,7 +6942,7 @@ void tst_qqmlecmascript::qtbug_22679() QSignalSpy warningsSpy(&engine, SIGNAL(warnings(QList<QQmlError>))); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(warningsSpy.count(), 0); delete o; } @@ -6979,7 +6979,7 @@ void tst_qqmlecmascript::switchStatement() { QQmlComponent component(&engine, testFileUrl("switchStatement.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // `object->value()' is the number of executed statements @@ -7002,7 +7002,7 @@ void tst_qqmlecmascript::switchStatement() { QQmlComponent component(&engine, testFileUrl("switchStatement.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // `object->value()' is the number of executed statements @@ -7025,7 +7025,7 @@ void tst_qqmlecmascript::switchStatement() { QQmlComponent component(&engine, testFileUrl("switchStatement.3.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // `object->value()' is the number of executed statements @@ -7052,7 +7052,7 @@ void tst_qqmlecmascript::switchStatement() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // `object->value()' is the number of executed statements @@ -7076,7 +7076,7 @@ void tst_qqmlecmascript::switchStatement() { QQmlComponent component(&engine, testFileUrl("switchStatement.5.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // `object->value()' is the number of executed statements @@ -7099,7 +7099,7 @@ void tst_qqmlecmascript::switchStatement() { QQmlComponent component(&engine, testFileUrl("switchStatement.6.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // `object->value()' is the number of executed statements @@ -7126,7 +7126,7 @@ void tst_qqmlecmascript::withStatement() QUrl url = testFileUrl("withStatement.1.qml"); QQmlComponent component(&engine, url); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 123); } @@ -7137,7 +7137,7 @@ void tst_qqmlecmascript::tryStatement() { QQmlComponent component(&engine, testFileUrl("tryStatement.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 123); } @@ -7145,7 +7145,7 @@ void tst_qqmlecmascript::tryStatement() { QQmlComponent component(&engine, testFileUrl("tryStatement.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 321); } @@ -7153,7 +7153,7 @@ void tst_qqmlecmascript::tryStatement() { QQmlComponent component(&engine, testFileUrl("tryStatement.3.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 1); } @@ -7161,7 +7161,7 @@ void tst_qqmlecmascript::tryStatement() { QQmlComponent component(&engine, testFileUrl("tryStatement.4.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 1); } @@ -7199,7 +7199,7 @@ void tst_qqmlecmascript::invokableWithQObjectDerived() QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("result").value<bool>()); delete object; @@ -7211,7 +7211,7 @@ void tst_qqmlecmascript::realTypePrecision() // Properties and signal parameters of type real should have double precision. QQmlComponent component(&engine, testFileUrl("realTypePrecision.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toDouble(), 1234567890.); QCOMPARE(object->property("test2").toDouble(), 1234567890.); QCOMPARE(object->property("test3").toDouble(), 1234567890.); @@ -7225,7 +7225,7 @@ void tst_qqmlecmascript::registeredFlagMethod() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("registeredFlagMethod.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->buttons(), 0); emit object->basicSignal(); @@ -7240,7 +7240,7 @@ void tst_qqmlecmascript::replaceBinding() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("replaceBinding.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(obj->property("success").toBool()); delete obj; @@ -7252,7 +7252,7 @@ void tst_qqmlecmascript::deleteRootObjectInCreation() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("deleteRootObjectInCreation.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(obj->property("rootIndestructible").toBool()); QVERIFY(!obj->property("childDestructible").toBool()); QTest::qWait(1); @@ -7263,7 +7263,7 @@ void tst_qqmlecmascript::deleteRootObjectInCreation() { QQmlComponent c(&engine, testFileUrl("deleteRootObjectInCreation.2.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("testConditionsMet").toBool()); delete object; } @@ -7277,9 +7277,9 @@ void tst_qqmlecmascript::onDestruction() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("onDestruction.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); delete obj; - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); } { @@ -7290,8 +7290,8 @@ void tst_qqmlecmascript::onDestruction() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("onDestruction.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QVERIFY(obj != nullptr); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); } } @@ -7402,7 +7402,7 @@ struct EventProcessor : public QObject public: Q_INVOKABLE void process() { - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } }; @@ -7417,7 +7417,7 @@ void tst_qqmlecmascript::bindingSuppression() QQmlComponent c(&engine, testFileUrl("bindingSuppression.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); delete obj; QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString())); @@ -7430,7 +7430,7 @@ void tst_qqmlecmascript::signalEmitted() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("signalEmitted.2.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QTRY_VERIFY(obj->property("success").toBool()); delete obj; } @@ -7440,7 +7440,7 @@ void tst_qqmlecmascript::signalEmitted() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("signalEmitted.3.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); gc(engine); // should collect c1. QTRY_VERIFY(obj->property("success").toBool()); delete obj; @@ -7451,7 +7451,7 @@ void tst_qqmlecmascript::signalEmitted() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("signalEmitted.4.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); gc(engine); // should collect c1. QMetaObject::invokeMethod(obj, "destroyC2"); QTRY_VERIFY(obj->property("success").toBool()); // handles events (incl. delete later). @@ -7484,12 +7484,12 @@ void tst_qqmlecmascript::qqmldataDestroyed() { QQmlComponent c(&engine, testFileUrl("qqmldataDestroyed.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // now gc causing the collection of the dynamically constructed object. engine.collectGarbage(); engine.collectGarbage(); // now process events to allow deletion (calling qqmldata::destroyed()) - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); // shouldn't crash. delete object; @@ -7500,7 +7500,7 @@ void tst_qqmlecmascript::qqmldataDestroyed() { QQmlComponent c(&engine, testFileUrl("qqmldataDestroyed.2.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("testConditionsMet").toBool()); // the gc() within the handler will have triggered the weak // qobject reference callback. If that incorrectly disposes @@ -7515,7 +7515,7 @@ void tst_qqmlecmascript::secondAlias() { QQmlComponent c(&engine, testFileUrl("secondAlias.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 200); delete object; } @@ -7525,7 +7525,7 @@ void tst_qqmlecmascript::varAlias() { QQmlComponent c(&engine, testFileUrl("varAlias.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 192); delete object; } @@ -7535,7 +7535,7 @@ void tst_qqmlecmascript::overrideDataAssert() { QQmlComponent c(&engine, testFileUrl("overrideDataAssert.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); object->metaObject(); delete object; } @@ -7560,7 +7560,7 @@ void tst_qqmlecmascript::fallbackBindings() QQmlComponent component(&engine, testFileUrl(source)); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); } @@ -7569,7 +7569,7 @@ void tst_qqmlecmascript::propertyOverride() { QQmlComponent component(&engine, testFileUrl("propertyOverride.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); } @@ -7605,9 +7605,9 @@ void tst_qqmlecmascript::sequenceSort() QQmlComponent component(&engine, testFileUrl("sequenceSort.qml")); QObject *object = component.create(); - if (object == 0) + if (object == nullptr) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant q; QMetaObject::invokeMethod(object, function.toLatin1().constData(), Q_RETURN_ARG(QVariant, q), Q_ARG(QVariant, useComparer)); @@ -7621,9 +7621,9 @@ void tst_qqmlecmascript::dateParse() QQmlComponent component(&engine, testFileUrl("date.qml")); QObject *object = component.create(); - if (object == 0) + if (object == nullptr) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant q; QMetaObject::invokeMethod(object, "test_is_invalid_jsDateTime", Q_RETURN_ARG(QVariant, q)); @@ -7641,9 +7641,9 @@ void tst_qqmlecmascript::utcDate() QQmlComponent component(&engine, testFileUrl("utcdate.qml")); QObject *object = component.create(); - if (object == 0) + if (object == nullptr) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant q; QVariant val = QString::fromLatin1("2014-07-16T23:30:31"); @@ -7656,9 +7656,9 @@ void tst_qqmlecmascript::negativeYear() QQmlComponent component(&engine, testFileUrl("negativeyear.qml")); QObject *object = component.create(); - if (object == 0) + if (object == nullptr) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant q; QMetaObject::invokeMethod(object, "check_negative_tostring", Q_RETURN_ARG(QVariant, q)); @@ -7721,7 +7721,7 @@ void tst_qqmlecmascript::updateCall() QString file("updateCall.qml"); QQmlComponent component(&engine, testFileUrl(file)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlecmascript::numberParsing() @@ -7731,7 +7731,7 @@ void tst_qqmlecmascript::numberParsing() file = file.arg(i); QQmlComponent component(&engine, testFileUrl(file)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } for (int i = 1; i < 3; ++i) { QString file("numberParsing_error.%1.qml"); @@ -7769,7 +7769,7 @@ void tst_qqmlecmascript::qtbug_32801() QQmlComponent component(&engine, testFileUrl("qtbug_32801.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); // do not crash when a QML signal is connected to a non-void slot connect(obj.data(), SIGNAL(testSignal(QString)), obj.data(), SLOT(slotWithReturnValue(QString))); @@ -7790,7 +7790,7 @@ void tst_qqmlecmascript::qtbug_33754() QQmlComponent component(&engine, testFileUrl("qtbug_33754.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); } void tst_qqmlecmascript::qtbug_34493() @@ -7801,7 +7801,7 @@ void tst_qqmlecmascript::qtbug_34493() if (component.errors().size()) qDebug() << component.errors(); QVERIFY(component.errors().isEmpty()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(QMetaObject::invokeMethod(obj.data(), "doIt")); QTRY_VERIFY(obj->property("prop").toString() == QLatin1String("Hello World!")); } @@ -7815,7 +7815,7 @@ void tst_qqmlecmascript::singletonFromQMLToCpp() if (component.errors().size()) qDebug() << component.errors(); QVERIFY(component.errors().isEmpty()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("qobjectTest"), QVariant(true)); QCOMPARE(obj->property("myQmlObjectTest"), QVariant(true)); @@ -7832,7 +7832,7 @@ void tst_qqmlecmascript::singletonFromQMLAndBackAndCompare() if (component.errors().size()) qDebug() << component.errors(); QVERIFY(component.errors().isEmpty()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("myInheritedQmlObjectTest1"), QVariant(true)); QCOMPARE(o->property("myInheritedQmlObjectTest2"), QVariant(true)); @@ -7875,9 +7875,9 @@ void tst_qqmlecmascript::miscTypeTest() QQmlComponent component(&engine, testFileUrl("misctypetest.qml")); QObject *object = component.create(); - if (object == 0) + if (object == nullptr) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant q; QMetaObject::invokeMethod(object, "test_invalid_url_equal", Q_RETURN_ARG(QVariant, q)); @@ -7913,9 +7913,9 @@ void tst_qqmlecmascript::qtbug_34792() QQmlComponent component(&engine, testFileUrl("qtbug34792.qml")); QObject *object = component.create(); - if (object == 0) + if (object == nullptr) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -8069,7 +8069,7 @@ class ObjectContainer : public QObject Q_PROPERTY(ContainedObject1 *object1 READ object1 WRITE setObject1) Q_PROPERTY(ContainedObject2 *object2 READ object2 WRITE setObject2) public: - explicit ObjectContainer(QObject *parent = 0) : + explicit ObjectContainer(QObject *parent = nullptr) : QObject(parent), mGetterCalled(false), mSetterCalled(false) @@ -8079,7 +8079,7 @@ public: ContainedObject1 *object1() { mGetterCalled = true; - return 0; + return nullptr; } void setObject1(ContainedObject1 *) @@ -8090,7 +8090,7 @@ public: ContainedObject2 *object2() { mGetterCalled = true; - return 0; + return nullptr; } void setObject2(ContainedObject2 *) @@ -8155,7 +8155,7 @@ void tst_qqmlecmascript::qtbug_46022() QQmlComponent component(&engine, testFileUrl("qtbug_46022.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("test1").toBool(), true); QCOMPARE(obj->property("test2").toBool(), true); } @@ -8176,7 +8176,7 @@ void tst_qqmlecmascript::qtbug_54589() QQmlComponent component(&engine, testFileUrl("qtbug_54589.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("result").toBool(), true); } @@ -8192,7 +8192,7 @@ void tst_qqmlecmascript::stringify_qtbug_50592() QQmlComponent component(&engine, testFileUrl("stringify_qtbug_50592.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("source").toString(), QString::fromLatin1("http://example.org/some_nonexistant_image.png")); } @@ -8379,7 +8379,7 @@ void tst_qqmlecmascript::singleBlockLoops() QQmlComponent component(&engine, testFileUrl("qtbug_59012.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(!component.isError()); } |