diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-21 10:41:54 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-26 07:13:18 +0000 |
commit | 499ec43937e926e4f2fa57a9baa455fcb3862262 (patch) | |
tree | 206c90d47387f8322b68f5e3db613189397e1af3 /tests/auto/qml/qqmllanguage | |
parent | 53d1e9ed21d25e65a2f13606af479838f5f21fe7 (diff) |
use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where
we are assigning or testing a pointer rather than a numeric zero.
Also, replaced cases where 0 was passed as Qt::KeyboardModifiers
with Qt::NoModifier (clang-tidy replaced them with nullptr, which
waas wrong, so it was just as well to make the tests more readable
rather than to revert those lines).
Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
-rw-r--r-- | tests/auto/qml/qqmllanguage/testtypes.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 404 |
2 files changed, 204 insertions, 204 deletions
diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp index 1a81528bc4..0eb4f26878 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.cpp +++ b/tests/auto/qml/qqmllanguage/testtypes.cpp @@ -185,8 +185,8 @@ void SimpleObjectCustomParser::applyBindings(QObject *object, QV4::CompiledData: MyQmlObject::MyQmlObject() : m_value(-1) - , m_interface(0) - , m_qmlobject(0) + , m_interface(nullptr) + , m_qmlobject(nullptr) , m_childAddedEventCount(0) { qRegisterMetaType<MyCustomVariantType>("MyCustomVariantType"); diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index d08ad47310..952e4a22a1 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -619,7 +619,7 @@ void tst_qqmllanguage::simpleObject() QQmlComponent component(&engine, testFileUrl("simpleObject.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmllanguage::simpleContainer() @@ -627,7 +627,7 @@ void tst_qqmllanguage::simpleContainer() QQmlComponent component(&engine, testFileUrl("simpleContainer.qml")); VERIFY_ERRORS(0); MyContainer *container= qobject_cast<MyContainer*>(component.create()); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->getChildren()->count(),2); } @@ -636,7 +636,7 @@ void tst_qqmllanguage::interfaceProperty() QQmlComponent component(&engine, testFileUrl("interfaceProperty.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->interface()); QCOMPARE(object->interface()->id, 913); } @@ -646,7 +646,7 @@ void tst_qqmllanguage::interfaceQList() QQmlComponent component(&engine, testFileUrl("interfaceQList.qml")); VERIFY_ERRORS(0); MyContainer *container= qobject_cast<MyContainer*>(component.create()); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->getQListInterfaces()->count(), 2); for(int ii = 0; ii < 2; ++ii) QCOMPARE(container->getQListInterfaces()->at(ii)->id, 913); @@ -657,7 +657,7 @@ void tst_qqmllanguage::assignObjectToSignal() QQmlComponent component(&engine, testFileUrl("assignObjectToSignal.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot"); emit object->basicSignal(); } @@ -667,7 +667,7 @@ void tst_qqmllanguage::assignObjectToVariant() QQmlComponent component(&engine, testFileUrl("assignObjectToVariant.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant v = object->property("a"); QVERIFY(v.userType() == qMetaTypeId<QObject *>()); } @@ -677,7 +677,7 @@ void tst_qqmllanguage::assignLiteralSignalProperty() QQmlComponent component(&engine, testFileUrl("assignLiteralSignalProperty.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->onLiteralSignal(), 10); } @@ -687,7 +687,7 @@ void tst_qqmllanguage::assignQmlComponent() QQmlComponent component(&engine, testFileUrl("assignQmlComponent.qml")); VERIFY_ERRORS(0); MyContainer *object = qobject_cast<MyContainer *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->getChildren()->count(), 1); QObject *child = object->getChildren()->at(0); QCOMPARE(child->property("x"), QVariant(10)); @@ -700,7 +700,7 @@ void tst_qqmllanguage::assignBasicTypes() QQmlComponent component(&engine, testFileUrl("assignBasicTypes.qml")); VERIFY_ERRORS(0); 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->qtEnumProperty(), Qt::RichText); @@ -729,9 +729,9 @@ void tst_qqmllanguage::assignBasicTypes() QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2f, 2.3f)); const QUrl encoded = QUrl::fromEncoded("main.qml?with%3cencoded%3edata", QUrl::TolerantMode); QCOMPARE(object->urlProperty(), component.url().resolved(encoded)); - QVERIFY(object->objectProperty() != 0); + QVERIFY(object->objectProperty() != nullptr); MyTypeObject *child = qobject_cast<MyTypeObject *>(object->objectProperty()); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QCOMPARE(child->intProperty(), 8); //these used to go via script. Ensure they no longer do @@ -745,7 +745,7 @@ void tst_qqmllanguage::assignTypeExtremes() QQmlComponent component(&engine, testFileUrl("assignTypeExtremes.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->uintProperty(), 0xEE6B2800); QCOMPARE(object->intProperty(), -0x77359400); } @@ -756,7 +756,7 @@ void tst_qqmllanguage::assignCompositeToType() QQmlComponent component(&engine, testFileUrl("assignCompositeToType.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } // Test that literals are stored correctly in variant properties @@ -765,7 +765,7 @@ void tst_qqmllanguage::assignLiteralToVariant() QQmlComponent component(&engine, testFileUrl("assignLiteralToVariant.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(isJSNumberType(object->property("test1").userType())); QVERIFY(isJSNumberType(object->property("test2").userType())); @@ -804,7 +804,7 @@ void tst_qqmllanguage::assignLiteralToVar() QQmlComponent component(&engine, testFileUrl("assignLiteralToVar.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(isJSNumberType(object->property("test1").userType())); QCOMPARE(object->property("test2").userType(), (int)QMetaType::Double); @@ -852,7 +852,7 @@ void tst_qqmllanguage::assignLiteralToJSValue() QQmlComponent component(&engine, testFileUrl("assignLiteralToJSValue.qml")); VERIFY_ERRORS(0); QObject *root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); { MyQmlObject *object = root->findChild<MyQmlObject *>("test1"); @@ -940,7 +940,7 @@ void tst_qqmllanguage::assignNullStrings() QQmlComponent component(&engine, testFileUrl("assignNullStrings.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->stringProperty().isNull()); QVERIFY(object->byteArrayProperty().isNull()); QMetaObject::invokeMethod(object, "assignNullStringsFromJs", Qt::DirectConnection); @@ -954,7 +954,7 @@ void tst_qqmllanguage::bindJSValueToVar() VERIFY_ERRORS(0); QObject *root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QObject *object = root->findChild<QObject *>("varProperties"); @@ -1003,7 +1003,7 @@ void tst_qqmllanguage::bindJSValueToVariant() VERIFY_ERRORS(0); QObject *root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QObject *object = root->findChild<QObject *>("variantProperties"); @@ -1052,7 +1052,7 @@ void tst_qqmllanguage::bindJSValueToType() VERIFY_ERRORS(0); QObject *root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); { MyTypeObject *object = root->findChild<MyTypeObject *>("typedProperties"); @@ -1087,7 +1087,7 @@ void tst_qqmllanguage::bindTypeToJSValue() VERIFY_ERRORS(0); QObject *root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); { MyQmlObject *object = root->findChild<MyQmlObject *>("flagProperty"); @@ -1226,7 +1226,7 @@ void tst_qqmllanguage::customParserTypes() QQmlComponent component(&engine, testFileUrl("customParserTypes.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("count"), QVariant(2)); } @@ -1236,7 +1236,7 @@ void tst_qqmllanguage::rootAsQmlComponent() QQmlComponent component(&engine, testFileUrl("rootAsQmlComponent.qml")); VERIFY_ERRORS(0); MyContainer *object = qobject_cast<MyContainer *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("x"), QVariant(11)); QCOMPARE(object->getChildren()->count(), 2); } @@ -1260,12 +1260,12 @@ void tst_qqmllanguage::inlineQmlComponents() QQmlComponent component(&engine, testFileUrl("inlineQmlComponents.qml")); VERIFY_ERRORS(0); MyContainer *object = qobject_cast<MyContainer *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->getChildren()->count(), 1); QQmlComponent *comp = qobject_cast<QQmlComponent *>(object->getChildren()->at(0)); - QVERIFY(comp != 0); + QVERIFY(comp != nullptr); MyQmlObject *compObject = qobject_cast<MyQmlObject *>(comp->create()); - QVERIFY(compObject != 0); + QVERIFY(compObject != nullptr); QCOMPARE(compObject->value(), 11); } @@ -1276,17 +1276,17 @@ void tst_qqmllanguage::idProperty() QQmlComponent component(&engine, testFileUrl("idProperty.qml")); VERIFY_ERRORS(0); MyContainer *object = qobject_cast<MyContainer *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->getChildren()->count(), 2); MyTypeObject *child = qobject_cast<MyTypeObject *>(object->getChildren()->at(0)); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QCOMPARE(child->id(), QString("myObjectId")); QCOMPARE(object->property("object"), QVariant::fromValue((QObject *)child)); child = qobject_cast<MyTypeObject *>(object->getChildren()->at(1)); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QCOMPARE(child->id(), QString("name.with.dots")); } { @@ -1307,7 +1307,7 @@ void tst_qqmllanguage::autoNotifyConnection() QQmlComponent component(&engine, testFileUrl("autoNotifyConnection.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaProperty prop = object->metaObject()->property(object->metaObject()->indexOfProperty("receivedNotify")); QVERIFY(prop.isValid()); @@ -1322,7 +1322,7 @@ void tst_qqmllanguage::assignSignal() QQmlComponent component(&engine, testFileUrl("assignSignal.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot"); emit object->basicSignal(); QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlotWithArgs(9)"); @@ -1334,7 +1334,7 @@ void tst_qqmllanguage::assignSignalFunctionExpression() QQmlComponent component(&engine, testFileUrl("assignSignalFunctionExpression.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot"); emit object->basicSignal(); QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlotWithArgs(9)"); @@ -1363,7 +1363,7 @@ void tst_qqmllanguage::overrideSignal() if (errorFile.isEmpty()) { VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); delete object; } else { @@ -1377,7 +1377,7 @@ void tst_qqmllanguage::dynamicProperties() QQmlComponent component(&engine, testFileUrl("dynamicProperties.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("intProperty"), QVariant(10)); QCOMPARE(object->property("boolProperty"), QVariant(false)); QCOMPARE(object->property("doubleProperty"), QVariant(-10.1)); @@ -1395,7 +1395,7 @@ void tst_qqmllanguage::dynamicPropertiesNested() QQmlComponent component(&engine, testFileUrl("dynamicPropertiesNested.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("super_a").toInt(), 11); // Overridden QCOMPARE(object->property("super_c").toInt(), 14); // Inherited @@ -1411,7 +1411,7 @@ void tst_qqmllanguage::listProperties() QQmlComponent component(&engine, testFileUrl("listProperties.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 2); } @@ -1431,18 +1431,18 @@ void tst_qqmllanguage::dynamicObjectProperties() QQmlComponent component(&engine, testFileUrl("dynamicObjectProperties.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); - QCOMPARE(object->property("objectProperty"), qVariantFromValue((QObject*)0)); - QVERIFY(object->property("objectProperty2") != qVariantFromValue((QObject*)0)); + QCOMPARE(object->property("objectProperty"), qVariantFromValue((QObject*)nullptr)); + QVERIFY(object->property("objectProperty2") != qVariantFromValue((QObject*)nullptr)); } { QQmlComponent component(&engine, testFileUrl("dynamicObjectProperties.2.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); - QVERIFY(object->property("objectProperty") != qVariantFromValue((QObject*)0)); + QVERIFY(object->property("objectProperty") != qVariantFromValue((QObject*)nullptr)); } } @@ -1454,7 +1454,7 @@ void tst_qqmllanguage::dynamicSignalsAndSlots() QQmlComponent component(&engine, testFileUrl("dynamicSignalsAndSlots.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->metaObject()->indexOfMethod("signal1()") != -1); QVERIFY(object->metaObject()->indexOfMethod("signal2()") != -1); QVERIFY(object->metaObject()->indexOfMethod("slot1()") != -1); @@ -1470,7 +1470,7 @@ void tst_qqmllanguage::simpleBindings() QQmlComponent component(&engine, testFileUrl("simpleBindings.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value1"), QVariant(10)); QCOMPARE(object->property("value2"), QVariant(10)); QCOMPARE(object->property("value3"), QVariant(21)); @@ -1484,20 +1484,20 @@ void tst_qqmllanguage::autoComponentCreation() QQmlComponent component(&engine, testFileUrl("autoComponentCreation.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->componentProperty() != 0); + QVERIFY(object != nullptr); + QVERIFY(object->componentProperty() != nullptr); MyTypeObject *child = qobject_cast<MyTypeObject *>(object->componentProperty()->create()); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QCOMPARE(child->realProperty(), qreal(9)); } { QQmlComponent component(&engine, testFileUrl("autoComponentCreation.2.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->componentProperty() != 0); + QVERIFY(object != nullptr); + QVERIFY(object->componentProperty() != nullptr); MyTypeObject *child = qobject_cast<MyTypeObject *>(object->componentProperty()->create()); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QCOMPARE(child->realProperty(), qreal(9)); } } @@ -1507,10 +1507,10 @@ void tst_qqmllanguage::autoComponentCreationInGroupProperty() QQmlComponent component(&engine, testFileUrl("autoComponentCreationInGroupProperties.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->componentProperty() != 0); + QVERIFY(object != nullptr); + QVERIFY(object->componentProperty() != nullptr); MyTypeObject *child = qobject_cast<MyTypeObject *>(object->componentProperty()->create()); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QCOMPARE(child->realProperty(), qreal(9)); } @@ -1520,7 +1520,7 @@ void tst_qqmllanguage::propertyValueSource() QQmlComponent component(&engine, testFileUrl("propertyValueSource.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QList<QObject *> valueSources; QObjectList allChildren = object->findChildren<QObject*>(); @@ -1532,7 +1532,7 @@ void tst_qqmllanguage::propertyValueSource() QCOMPARE(valueSources.count(), 1); MyPropertyValueSource *valueSource = qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); - QVERIFY(valueSource != 0); + QVERIFY(valueSource != nullptr); QCOMPARE(valueSource->prop.object(), qobject_cast<QObject*>(object)); QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty"))); } @@ -1541,7 +1541,7 @@ void tst_qqmllanguage::propertyValueSource() QQmlComponent component(&engine, testFileUrl("propertyValueSource.2.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QList<QObject *> valueSources; QObjectList allChildren = object->findChildren<QObject*>(); @@ -1553,7 +1553,7 @@ void tst_qqmllanguage::propertyValueSource() QCOMPARE(valueSources.count(), 1); MyPropertyValueSource *valueSource = qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); - QVERIFY(valueSource != 0); + QVERIFY(valueSource != nullptr); QCOMPARE(valueSource->prop.object(), qobject_cast<QObject*>(object)); QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty"))); } @@ -1564,9 +1564,9 @@ void tst_qqmllanguage::attachedProperties() QQmlComponent component(&engine, testFileUrl("attachedProperties.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *attached = qmlAttachedPropertiesObject<MyQmlObject>(object); - QVERIFY(attached != 0); + QVERIFY(attached != nullptr); QCOMPARE(attached->property("value"), QVariant(10)); QCOMPARE(attached->property("value2"), QVariant(13)); } @@ -1577,7 +1577,7 @@ void tst_qqmllanguage::dynamicObjects() QQmlComponent component(&engine, testFileUrl("dynamicObject.1.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } // Tests the registration of custom variant string converters @@ -1586,7 +1586,7 @@ void tst_qqmllanguage::customVariantTypes() QQmlComponent component(&engine, testFileUrl("customVariantTypes.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->customType().a, 10); } @@ -1600,7 +1600,7 @@ void tst_qqmllanguage::valueTypes() QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rectProperty(), QRect(10, 11, 12, 13)); @@ -1631,7 +1631,7 @@ void tst_qqmllanguage::cppnamespace() QQmlComponent component(&engine, testFileUrl("cppnamespace.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("intProperty").toInt(), (int)MyNamespace::MyOtherNSEnum::OtherKey2); @@ -1642,7 +1642,7 @@ void tst_qqmllanguage::cppnamespace() QQmlComponent component(&engine, testFileUrl("cppnamespace.2.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } } @@ -1654,7 +1654,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.1.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // Read through alias QCOMPARE(object->property("valueAlias").toInt(), 10); @@ -1674,12 +1674,12 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.2.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // Read through alias MyQmlObject *v = qvariant_cast<MyQmlObject *>(object->property("aliasObject")); - QVERIFY(v != 0); + QVERIFY(v != nullptr); QCOMPARE(v->value(), 10); // Write through alias @@ -1688,7 +1688,7 @@ void tst_qqmllanguage::aliasProperties() object->setProperty("aliasObject", qVariantFromValue(v2)); MyQmlObject *v3 = qvariant_cast<MyQmlObject *>(object->property("aliasObject")); - QVERIFY(v3 != 0); + QVERIFY(v3 != nullptr); QCOMPARE(v3, v2); delete object; @@ -1699,7 +1699,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.3.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toInt(), 1892); QCOMPARE(object->property("value2").toInt(), 1892); @@ -1720,7 +1720,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.4.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("enumAlias").toInt(), 1); @@ -1732,7 +1732,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.5.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant v = object->property("otherAlias"); QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>()); @@ -1754,7 +1754,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.6.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("a").toInt(), 1923); } @@ -1766,12 +1766,12 @@ void tst_qqmllanguage::aliasProperties() VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *object1 = qvariant_cast<QObject *>(object->property("object")); - QVERIFY(object1 != 0); + QVERIFY(object1 != nullptr); QObject *object2 = qvariant_cast<QObject *>(object1->property("object")); - QVERIFY(object2 != 0); + QVERIFY(object2 != nullptr); QObject *alias = qvariant_cast<QObject *>(object->property("aliasedObject")); QCOMPARE(alias, object2); @@ -1780,7 +1780,7 @@ void tst_qqmllanguage::aliasProperties() QObject *alias2 = object; // "Random" start value int status = -1; - void *a[] = { &alias2, 0, &status }; + void *a[] = { &alias2, nullptr, &status }; QMetaObject::metacall(object, QMetaObject::ReadProperty, object->metaObject()->indexOfProperty("aliasedObject"), a); QVERIFY(!alias2); @@ -1791,7 +1791,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.8.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toInt(), 10); @@ -1803,7 +1803,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.9.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toInt(), 10); @@ -1816,7 +1816,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.10.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // Read through alias QCOMPARE(object->property("valueAlias").toRect(), QRect(10, 11, 9, 8)); @@ -1836,7 +1836,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.11.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // Read through alias QCOMPARE(object->property("aliasProperty").toInt(), 19); @@ -1911,19 +1911,19 @@ void tst_qqmllanguage::componentCompositeType() QQmlComponent component(&engine, testFileUrl("componentCompositeType.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } class TestType : public QObject { Q_OBJECT public: - TestType(QObject *p=0) : QObject(p) {} + TestType(QObject *p=nullptr) : QObject(p) {} }; class TestType2 : public QObject { Q_OBJECT public: - TestType2(QObject *p=0) : QObject(p) {} + TestType2(QObject *p=nullptr) : QObject(p) {} }; void tst_qqmllanguage::i18n_data() @@ -1945,7 +1945,7 @@ void tst_qqmllanguage::i18n() QQmlComponent component(&engine, testFileUrl(file)); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->stringProperty(), stringProperty); delete object; @@ -1960,7 +1960,7 @@ void tst_qqmllanguage::onCompleted() QTest::ignoreMessage(QtDebugMsg, "Completed 6 10"); QTest::ignoreMessage(QtDebugMsg, "Completed 10 11"); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } // Check that the Component::onDestruction attached property works @@ -1969,7 +1969,7 @@ void tst_qqmllanguage::onDestruction() QQmlComponent component(&engine, testFileUrl("onDestruction.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtDebugMsg, "Destruction 6 10"); QTest::ignoreMessage(QtDebugMsg, "Destruction 6 10"); QTest::ignoreMessage(QtDebugMsg, "Destruction 10 11"); @@ -1984,7 +1984,7 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(!object->scriptProperty().isEmpty()); QCOMPARE(object->scriptProperty().stringLiteral(), QString()); bool ok; @@ -1992,12 +1992,12 @@ void tst_qqmllanguage::scriptString() QCOMPARE(ok, false); const QQmlScriptStringPrivate *scriptPrivate = QQmlScriptStringPrivate::get(object->scriptProperty()); - QVERIFY(scriptPrivate != 0); + QVERIFY(scriptPrivate != nullptr); QCOMPARE(scriptPrivate->script, QString("foo + bar")); QCOMPARE(scriptPrivate->scope, qobject_cast<QObject*>(object)); QCOMPARE(scriptPrivate->context, qmlContext(object)); - QVERIFY(object->grouped() != 0); + QVERIFY(object->grouped() != nullptr); const QQmlScriptStringPrivate *groupedPrivate = QQmlScriptStringPrivate::get(object->grouped()->script()); QCOMPARE(groupedPrivate->script, QString("console.log(1921)")); QCOMPARE(groupedPrivate->scope, qobject_cast<QObject*>(object)); @@ -2009,7 +2009,7 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->scriptProperty().stringLiteral(), QString("hello\\n\\\"world\\\"")); } @@ -2018,7 +2018,7 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); bool ok; QCOMPARE(object->scriptProperty().numberLiteral(&ok), qreal(12.345)); QCOMPARE(ok, true); @@ -2030,7 +2030,7 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); bool ok; QCOMPARE(object->scriptProperty().booleanLiteral(&ok), true); QCOMPARE(ok, true); @@ -2041,7 +2041,7 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->scriptProperty().isNullLiteral(), true); } @@ -2050,7 +2050,7 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->scriptProperty().isUndefinedLiteral(), true); } { @@ -2058,11 +2058,11 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlScriptString ss = object->scriptProperty(); { - QQmlExpression expr(ss, /*context*/0, object); + QQmlExpression expr(ss, /*context*/nullptr, object); QCOMPARE(expr.evaluate().toInt(), int(100)); } @@ -2071,7 +2071,7 @@ void tst_qqmllanguage::scriptString() QVERIFY(testScope.metaObject()->indexOfProperty("intProperty") != object->metaObject()->indexOfProperty("intProperty")); testScope.setIntProperty(42); - QQmlExpression expr(ss, /*context*/0, &testScope); + QQmlExpression expr(ss, /*context*/nullptr, &testScope); QCOMPARE(expr.evaluate().toInt(), int(42)); } } @@ -2084,9 +2084,9 @@ void tst_qqmllanguage::scriptStringJs() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlContext *context = QQmlEngine::contextForObject(object); - QVERIFY(context != 0); + QVERIFY(context != nullptr); bool ok; QCOMPARE(QQmlScriptStringPrivate::get(object->scriptProperty())->script, QString("\" hello \\\" world \"")); @@ -2188,7 +2188,7 @@ void tst_qqmllanguage::scriptStringWithoutSourceCode() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlScriptString ss = object->scriptProperty(); QVERIFY(!ss.isEmpty()); QCOMPARE(ss.stringLiteral(), QString()); @@ -2197,13 +2197,13 @@ void tst_qqmllanguage::scriptStringWithoutSourceCode() QCOMPARE(ok, false); const QQmlScriptStringPrivate *scriptPrivate = QQmlScriptStringPrivate::get(ss); - QVERIFY(scriptPrivate != 0); + QVERIFY(scriptPrivate != nullptr); QVERIFY(scriptPrivate->script.isEmpty()); QCOMPARE(scriptPrivate->scope, qobject_cast<QObject*>(object)); QCOMPARE(scriptPrivate->context, qmlContext(object)); { - QQmlExpression expr(ss, /*context*/0, object); + QQmlExpression expr(ss, /*context*/nullptr, object); QCOMPARE(expr.evaluate().toInt(), int(100)); } } @@ -2215,17 +2215,17 @@ void tst_qqmllanguage::scriptStringComparison() QQmlComponent component1(&engine, testFileUrl("scriptString.qml")); QVERIFY(!component1.isError() && component1.errors().isEmpty()); MyTypeObject *object1 = qobject_cast<MyTypeObject*>(component1.create()); - QVERIFY(object1 != 0); + QVERIFY(object1 != nullptr); QQmlComponent component2(&engine, testFileUrl("scriptString2.qml")); QVERIFY(!component2.isError() && component2.errors().isEmpty()); MyTypeObject *object2 = qobject_cast<MyTypeObject*>(component2.create()); - QVERIFY(object2 != 0); + QVERIFY(object2 != nullptr); QQmlComponent component3(&engine, testFileUrl("scriptString3.qml")); QVERIFY(!component3.isError() && component3.errors().isEmpty()); MyTypeObject *object3 = qobject_cast<MyTypeObject*>(component3.create()); - QVERIFY(object3 != 0); + QVERIFY(object3 != nullptr); //QJSValue inst1 = engine.newQObject(object1); QJSValue inst2 = engine.newQObject(object2); @@ -2285,7 +2285,7 @@ void tst_qqmllanguage::scriptStringComparison() // because the (none literal) script string may access variables which have different // values in both instances and hence evaluated to different results. MyTypeObject *object1_2 = qobject_cast<MyTypeObject*>(component1.create()); - QVERIFY(object1_2 != 0); + QVERIFY(object1_2 != nullptr); QVERIFY(object1->scriptProperty() != object1_2->scriptProperty()); } @@ -2297,7 +2297,7 @@ void tst_qqmllanguage::defaultPropertyListOrder() VERIFY_ERRORS(0); MyContainer *container = qobject_cast<MyContainer *>(component.create()); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->getChildren()->count(), 6); QCOMPARE(container->getChildren()->at(0)->property("index"), QVariant(0)); @@ -2426,7 +2426,7 @@ void tst_qqmllanguage::testType(const QString& qml, const QString& type, const Q } else { VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(QString(object->metaObject()->className()), type); delete object; } @@ -2440,7 +2440,7 @@ void tst_qqmllanguage::inlineAssignmentsOverrideBindings() QQmlComponent component(&engine, testFileUrl("inlineAssignmentsOverrideBindings.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toInt(), 11); delete o; } @@ -2874,7 +2874,7 @@ void tst_qqmllanguage::importsPath() VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toString(), value); delete object; @@ -3085,7 +3085,7 @@ void tst_qqmllanguage::importJs() if (performTest) { QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(),true); delete object; } @@ -3130,27 +3130,27 @@ void tst_qqmllanguage::qmlAttachedPropertiesObjectMethod() { QObject object; - QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(&object, false), (QObject *)0); + QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(&object, false), (QObject *)nullptr); QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(&object, true)); { QQmlComponent component(&engine, testFileUrl("qmlAttachedPropertiesObjectMethod.1.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); - QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(object, false), (QObject *)0); - QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != 0); + QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(object, false), (QObject *)nullptr); + QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != nullptr); } { QQmlComponent component(&engine, testFileUrl("qmlAttachedPropertiesObjectMethod.2.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); - QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, false) != 0); - QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != 0); + QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, false) != nullptr); + QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != nullptr); } } @@ -3172,7 +3172,7 @@ void tst_qqmllanguage::customOnProperty() VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("on").toInt(), 10); @@ -3186,7 +3186,7 @@ void tst_qqmllanguage::variantNotify() VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("notifyCount").toInt(), 1); @@ -3200,7 +3200,7 @@ void tst_qqmllanguage::revisions() VERIFY_ERRORS(0); MyRevisionedClass *object = qobject_cast<MyRevisionedClass*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->prop2(), 10.0); @@ -3212,7 +3212,7 @@ void tst_qqmllanguage::revisions() VERIFY_ERRORS(0); MyRevisionedSubclass *object = qobject_cast<MyRevisionedSubclass*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->prop1(), 10.0); QCOMPARE(object->prop2(), 10.0); @@ -3225,7 +3225,7 @@ void tst_qqmllanguage::revisions() QQmlComponent component(&engine, testFileUrl("versionedbase.qml")); VERIFY_ERRORS(0); MySubclass *object = qobject_cast<MySubclass*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->prop1(), 10.0); QCOMPARE(object->prop2(), 10.0); @@ -3277,7 +3277,7 @@ void tst_qqmllanguage::subclassedUncreateableRevision() QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready"); c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); QObject *obj = c.create(); - QCOMPARE(obj, static_cast<QObject*>(0)); + QCOMPARE(obj, static_cast<QObject*>(nullptr)); QCOMPARE(c.errors().count(), 1); QCOMPARE(c.errors().first().description(), QString("Cannot create MyUncreateableBaseClass")); } @@ -3290,7 +3290,7 @@ void tst_qqmllanguage::subclassedUncreateableRevision() c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); QObject *obj = c.create(); if (!shouldWork) { - QCOMPARE(obj, static_cast<QObject*>(0)); + QCOMPARE(obj, static_cast<QObject*>(nullptr)); return; } @@ -3333,7 +3333,7 @@ void tst_qqmllanguage::subclassedExtendedUncreateableRevision() QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready"); c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); QObject *obj = c.create(); - QCOMPARE(obj, static_cast<QObject*>(0)); + QCOMPARE(obj, static_cast<QObject*>(nullptr)); QCOMPARE(c.errors().count(), 1); QCOMPARE(c.errors().first().description(), QString("Cannot create MyExtendedUncreateableBaseClass")); } @@ -3346,7 +3346,7 @@ void tst_qqmllanguage::subclassedExtendedUncreateableRevision() c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); QObject *obj = c.create(); if (!shouldWork) { - QCOMPARE(obj, static_cast<QObject*>(0)); + QCOMPARE(obj, static_cast<QObject*>(nullptr)); return; } @@ -3416,7 +3416,7 @@ void tst_qqmllanguage::aliasPropertyChangeSignals() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -3429,7 +3429,7 @@ void tst_qqmllanguage::aliasPropertyChangeSignals() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -3445,7 +3445,7 @@ void tst_qqmllanguage::propertyInit() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toInt(), 1); @@ -3457,7 +3457,7 @@ void tst_qqmllanguage::propertyInit() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toInt(), 123); @@ -3472,7 +3472,7 @@ void tst_qqmllanguage::registrationOrder() QQmlComponent component(&engine, testFileUrl("registrationOrder.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->metaObject(), &MyVersion2Class::staticMetaObject); delete o; } @@ -3482,7 +3482,7 @@ void tst_qqmllanguage::readonly() QQmlComponent component(&engine, testFileUrl("readonly.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toInt(), 10); QCOMPARE(o->property("test2").toInt(), 18); @@ -3534,7 +3534,7 @@ void tst_qqmllanguage::receivers() QQmlComponent component(&engine, testFileUrl("receivers.qml")); MyReceiversTestObject *o = qobject_cast<MyReceiversTestObject*>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->mySignalCount(), 1); QCOMPARE(o->propChangedCount(), 2); QCOMPARE(o->myUnconnectedSignalCount(), 0); @@ -3552,7 +3552,7 @@ void tst_qqmllanguage::registeredCompositeType() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); delete o; } @@ -3564,7 +3564,7 @@ void tst_qqmllanguage::registeredCompositeTypeWithEnum() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("enumValue0").toInt(), static_cast<int>(MyCompositeBaseType::EnumValue0)); QCOMPARE(o->property("enumValue42").toInt(), static_cast<int>(MyCompositeBaseType::EnumValue42)); @@ -3580,7 +3580,7 @@ void tst_qqmllanguage::registeredCompositeTypeWithAttachedProperty() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("attachedProperty").toString(), QStringLiteral("test")); @@ -3606,7 +3606,7 @@ void tst_qqmllanguage::signalWithDefaultArg() QQmlComponent component(&engine, testFileUrl("signalWithDefaultArg.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("signalCount").toInt(), 0); QCOMPARE(object->property("signalArg").toInt(), 0); @@ -3637,7 +3637,7 @@ void tst_qqmllanguage::signalParameterTypes() { QQmlComponent component(&engine, testFileUrl("signalParameterTypes.1.qml")); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(obj->property("success").toBool()); delete obj; } @@ -3646,7 +3646,7 @@ void tst_qqmllanguage::signalParameterTypes() { QQmlComponent component(&engine, testFileUrl("signalParameterTypes.2.qml")); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(obj->property("success").toBool()); delete obj; } @@ -3662,14 +3662,14 @@ void tst_qqmllanguage::globalEnums() QQmlComponent component(&engine, testFileUrl("globalEnums.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); MyEnum1Class *enum1Class = o->findChild<MyEnum1Class *>(QString::fromLatin1("enum1Class")); - QVERIFY(enum1Class != 0); + QVERIFY(enum1Class != nullptr); QVERIFY(enum1Class->getValue() == -1); MyEnumDerivedClass *enum2Class = o->findChild<MyEnumDerivedClass *>(QString::fromLatin1("enumDerivedClass")); - QVERIFY(enum2Class != 0); + QVERIFY(enum2Class != nullptr); QVERIFY(enum2Class->getValueA() == -1); QVERIFY(enum2Class->getValueB() == -1); QVERIFY(enum2Class->getValueC() == 0); @@ -3754,7 +3754,7 @@ void tst_qqmllanguage::scopedEnum() QQmlComponent component(&engine, testFileUrl("scopedEnum.qml")); MyTypeObject *o = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->scopedEnum(), MyTypeObject::MyScopedEnum::ScopedVal1); QCOMPARE(o->intProperty(), (int)MyTypeObject::MyScopedEnum::ScopedVal2); @@ -3831,7 +3831,7 @@ void tst_qqmllanguage::literals() QQmlComponent component(&engine, testFile("literals.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property(property.toLatin1()), value); delete object; } @@ -3853,13 +3853,13 @@ void tst_qqmllanguage::objectDeletionNotify() QQmlComponent component(&engine, testFile(file)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); QMetaObject::invokeMethod(object, "destroyObject"); // Process the deletion event - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QCOMPARE(object->property("success").toBool(), true); @@ -3872,7 +3872,7 @@ void tst_qqmllanguage::scopedProperties() QQmlComponent component(&engine, testFile("scopedProperties.qml")); QScopedPointer<QObject> o(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(o->property("success").toBool()); } @@ -3880,7 +3880,7 @@ void tst_qqmllanguage::deepProperty() { QQmlComponent component(&engine, testFile("deepProperty.qml")); QScopedPointer<QObject> o(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QFont font = qvariant_cast<QFont>(qvariant_cast<QObject*>(o->property("someObject"))->property("font")); QCOMPARE(font.family(), QStringLiteral("test")); } @@ -3899,10 +3899,10 @@ void tst_qqmllanguage::implicitImportsLast() QQmlComponent component(&engine, testFile("localOrderTest.qml")); VERIFY_ERRORS(0); QObject *object = qobject_cast<QObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(QString(object->metaObject()->className()).startsWith(QLatin1String("QQuickMouseArea"))); QObject* object2 = object->property("item").value<QObject*>(); - QVERIFY(object2 != 0); + QVERIFY(object2 != nullptr); QCOMPARE(QString(object2->metaObject()->className()), QLatin1String("QQuickRectangle")); engine.setImportPathList(defaultImportPathList); @@ -3910,8 +3910,8 @@ void tst_qqmllanguage::implicitImportsLast() void tst_qqmllanguage::getSingletonInstance(QQmlEngine& engine, const char* fileName, const char* propertyName, QObject** result /* out */) { - QVERIFY(fileName != 0); - QVERIFY(propertyName != 0); + QVERIFY(fileName != nullptr); + QVERIFY(propertyName != nullptr); if (!fileName || !propertyName) return; @@ -3919,15 +3919,15 @@ void tst_qqmllanguage::getSingletonInstance(QQmlEngine& engine, const char* file QQmlComponent component(&engine, testFile(fileName)); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); getSingletonInstance(object, propertyName, result); } void tst_qqmllanguage::getSingletonInstance(QObject* o, const char* propertyName, QObject** result /* out */) { - QVERIFY(o != 0); - QVERIFY(propertyName != 0); + QVERIFY(o != nullptr); + QVERIFY(propertyName != nullptr); if (!o || !propertyName) return; @@ -3935,11 +3935,11 @@ void tst_qqmllanguage::getSingletonInstance(QObject* o, const char* propertyName QVariant variant = o->property(propertyName); QVERIFY(variant.userType() == qMetaTypeId<QObject *>()); - QObject *singleton = NULL; + QObject *singleton = nullptr; if (variant.canConvert<QObject*>()) singleton = variant.value<QObject*>(); - QVERIFY(singleton != 0); + QVERIFY(singleton != nullptr); *result = singleton; } @@ -3959,7 +3959,7 @@ void tst_qqmllanguage::compositeSingletonProperties() QQmlComponent component(&engine, testFile("singletonTest1.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 125, "value2", -55); } @@ -3968,14 +3968,14 @@ void tst_qqmllanguage::compositeSingletonProperties() // engine are the same. void tst_qqmllanguage::compositeSingletonSameEngine() { - QObject* s1 = NULL; + QObject* s1 = nullptr; getSingletonInstance(engine, "singletonTest2.qml", "singleton1", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); s1->setProperty("testProp2", QVariant(13)); - QObject* s2 = NULL; + QObject* s2 = nullptr; getSingletonInstance(engine, "singletonTest3.qml", "singleton2", &s2); - QVERIFY(s2 != 0); + QVERIFY(s2 != nullptr); QCOMPARE(s2->property("testProp2"), QVariant(13)); QCOMPARE(s1, s2); @@ -3987,14 +3987,14 @@ void tst_qqmllanguage::compositeSingletonDifferentEngine() { QQmlEngine e2; - QObject* s1 = NULL; + QObject* s1 = nullptr; getSingletonInstance(engine, "singletonTest2.qml", "singleton1", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); s1->setProperty("testProp2", QVariant(13)); - QObject* s2 = NULL; + QObject* s2 = nullptr; getSingletonInstance(e2, "singletonTest3.qml", "singleton2", &s2); - QVERIFY(s2 != 0); + QVERIFY(s2 != nullptr); QCOMPARE(s2->property("testProp2"), QVariant(25)); QVERIFY(s1 != s2); @@ -4013,19 +4013,19 @@ void tst_qqmllanguage::compositeSingletonQualifiedNamespace() QQmlComponent component(&engine, testFile("singletonTest5.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 125, "value2", -55); // lets verify that the singleton instance we are using is the same // when loaded through another file (without namespace!) - QObject *s1 = NULL; + QObject *s1 = nullptr; getSingletonInstance(o, "singletonInstance", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); - QObject* s2 = NULL; + QObject* s2 = nullptr; getSingletonInstance(engine, "singletonTest5a.qml", "singletonInstance", &s2); - QVERIFY(s2 != 0); + QVERIFY(s2 != nullptr); QCOMPARE(s1, s2); } @@ -4038,20 +4038,20 @@ void tst_qqmllanguage::compositeSingletonModule() QQmlComponent component(&engine, testFile("singletonTest6.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 125, "value2", -55); verifyCompositeSingletonPropertyValues(o, "value3", 125, "value4", -55); // lets verify that the singleton instance we are using is the same // when loaded through another file - QObject *s1 = NULL; + QObject *s1 = nullptr; getSingletonInstance(o, "singletonInstance", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); - QObject* s2 = NULL; + QObject* s2 = nullptr; getSingletonInstance(engine, "singletonTest6a.qml", "singletonInstance", &s2); - QVERIFY(s2 != 0); + QVERIFY(s2 != nullptr); QCOMPARE(s1, s2); } @@ -4064,20 +4064,20 @@ void tst_qqmllanguage::compositeSingletonModuleVersioned() QQmlComponent component(&engine, testFile("singletonTest7.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 225, "value2", 55); verifyCompositeSingletonPropertyValues(o, "value3", 225, "value4", 55); // lets verify that the singleton instance we are using is the same // when loaded through another file - QObject *s1 = NULL; + QObject *s1 = nullptr; getSingletonInstance(o, "singletonInstance", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); - QObject* s2 = NULL; + QObject* s2 = nullptr; getSingletonInstance(engine, "singletonTest7a.qml", "singletonInstance", &s2); - QVERIFY(s2 != 0); + QVERIFY(s2 != nullptr); QCOMPARE(s1, s2); } @@ -4090,20 +4090,20 @@ void tst_qqmllanguage::compositeSingletonModuleQualified() QQmlComponent component(&engine, testFile("singletonTest8.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 225, "value2", 55); verifyCompositeSingletonPropertyValues(o, "value3", 225, "value4", 55); // lets verify that the singleton instance we are using is the same // when loaded through another file - QObject *s1 = NULL; + QObject *s1 = nullptr; getSingletonInstance(o, "singletonInstance", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); - QObject* s2 = NULL; + QObject* s2 = nullptr; getSingletonInstance(engine, "singletonTest8a.qml", "singletonInstance", &s2); - QVERIFY(s2 != 0); + QVERIFY(s2 != nullptr); QCOMPARE(s1, s2); } @@ -4129,7 +4129,7 @@ void tst_qqmllanguage::compositeSingletonDynamicSignal() QQmlComponent component(&engine, testFile("singletonTest11.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 99, "value2", -55); } @@ -4178,7 +4178,7 @@ void tst_qqmllanguage::compositeSingletonRemote() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 525, "value2", 355); } @@ -4191,7 +4191,7 @@ void tst_qqmllanguage::compositeSingletonJavaScriptPragma() QQmlComponent component(&engine, testFile("singletonTest16.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); // The value1 that is read from the SingletonType was changed from 125 to 99 // in compositeSingletonDynamicSignal() above. As the type is a singleton and @@ -4209,7 +4209,7 @@ void tst_qqmllanguage::compositeSingletonSelectors() QQmlComponent component(&e2, testFile("singletonTest1.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 625, "value2", 455); } @@ -4221,7 +4221,7 @@ void tst_qqmllanguage::compositeSingletonRegistered() QQmlComponent component(&engine, testFile("singletonTest17.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 925, "value2", 755); } @@ -4234,7 +4234,7 @@ void tst_qqmllanguage::compositeSingletonCircular() QQmlTestMessageHandler messageHandler; QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); // ensure we aren't hitting the recursion warning QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString())); @@ -4321,7 +4321,7 @@ void tst_qqmllanguage::preservePropertyCacheOnGroupObjects() QVERIFY(ddata); QQmlPropertyCache *subCache = ddata->propertyCache; QVERIFY(subCache); - QQmlPropertyData *pd = subCache->property(QStringLiteral("newProperty"), /*object*/0, /*context*/0); + QQmlPropertyData *pd = subCache->property(QStringLiteral("newProperty"), /*object*/nullptr, /*context*/nullptr); QVERIFY(pd); QCOMPARE(pd->propType(), qMetaTypeId<int>()); } @@ -4589,7 +4589,7 @@ void tst_qqmllanguage::noChildEvents() component.setData("import QtQml 2.0; import Test 1.0; MyQmlObject { property QtObject child: QtObject {} }", QUrl()); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->childAddedEventCount(), 0); } @@ -4609,14 +4609,14 @@ void tst_qqmllanguage::deleteSingletons() QQmlComponent component(&tmpEngine, testFile("singletonTest5.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); - QObject *s1 = NULL; + QVERIFY(o != nullptr); + QObject *s1 = nullptr; getSingletonInstance(o, "singletonInstance", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); singleton = s1; - QVERIFY(singleton.data() != 0); + QVERIFY(singleton.data() != nullptr); } - QVERIFY(singleton.data() == 0); + QVERIFY(singleton.data() == nullptr); } void tst_qqmllanguage::arrayBuffer_data() @@ -4636,7 +4636,7 @@ void tst_qqmllanguage::arrayBuffer() QQmlComponent component(&engine, testFile(file)); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("ok").toBool(), true); } @@ -4855,9 +4855,9 @@ void tst_qqmllanguage::instanceof() VERIFY_ERRORS(0); QScopedPointer<QObject> o(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); - QQmlExpression expr(engine.contextForObject(o.data()), 0, QString::fromLatin1(QTest::currentDataTag())); + QQmlExpression expr(engine.contextForObject(o.data()), nullptr, QString::fromLatin1(QTest::currentDataTag())); QVariant ret = expr.evaluate(); if (expectedValue.type() == QVariant::Bool) { |