From 499ec43937e926e4f2fa57a9baa455fcb3862262 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 21 Feb 2018 10:41:54 +0100 Subject: 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 --- tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'tests/auto/qml/qqmlbinding') diff --git a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp index 4b485d2ce8..34cf21024d 100644 --- a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp +++ b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp @@ -65,10 +65,10 @@ void tst_qqmlbinding::binding() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("test-binding.qml")); QQuickRectangle *rect = qobject_cast(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQmlBind *binding3 = qobject_cast(rect->findChild("binding3")); - QVERIFY(binding3 != 0); + QVERIFY(binding3 != nullptr); QCOMPARE(rect->color(), QColor("yellow")); QCOMPARE(rect->property("text").toString(), QString("Hello")); @@ -80,7 +80,7 @@ void tst_qqmlbinding::binding() QCOMPARE(binding3->when(), true); QQmlBind *binding = qobject_cast(rect->findChild("binding1")); - QVERIFY(binding != 0); + QVERIFY(binding != nullptr); QCOMPARE(binding->object(), qobject_cast(rect)); QCOMPARE(binding->property(), QLatin1String("text")); QCOMPARE(binding->value().toString(), QLatin1String("Hello")); @@ -94,7 +94,7 @@ void tst_qqmlbinding::whenAfterValue() QQmlComponent c(&engine, testFileUrl("test-binding2.qml")); QQuickRectangle *rect = qobject_cast(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(), QColor("yellow")); QCOMPARE(rect->property("text").toString(), QString("Hello")); @@ -109,10 +109,10 @@ void tst_qqmlbinding::restoreBinding() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("restoreBinding.qml")); QQuickRectangle *rect = qobject_cast(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *myItem = qobject_cast(rect->findChild("myItem")); - QVERIFY(myItem != 0); + QVERIFY(myItem != nullptr); myItem->setY(25); QCOMPARE(myItem->x(), qreal(100-25)); @@ -139,10 +139,10 @@ void tst_qqmlbinding::restoreBindingWithLoop() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("restoreBindingWithLoop.qml")); QQuickRectangle *rect = qobject_cast(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *myItem = qobject_cast(rect->findChild("myItem")); - QVERIFY(myItem != 0); + QVERIFY(myItem != nullptr); myItem->setY(25); QCOMPARE(myItem->x(), qreal(25 + 100)); @@ -175,10 +175,10 @@ void tst_qqmlbinding::restoreBindingWithoutCrash() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("restoreBindingWithoutCrash.qml")); QQuickRectangle *rect = qobject_cast(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *myItem = qobject_cast(rect->findChild("myItem")); - QVERIFY(myItem != 0); + QVERIFY(myItem != nullptr); myItem->setY(25); QCOMPARE(myItem->x(), qreal(100-25)); @@ -215,9 +215,9 @@ void tst_qqmlbinding::deletedObject() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("deletedObject.qml")); QQuickRectangle *rect = qobject_cast(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); - QGuiApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QGuiApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); //don't crash rect->setProperty("activateBinding", true); @@ -289,7 +289,7 @@ void tst_qqmlbinding::delayed() QQmlComponent c(&engine, testFileUrl("delayed.qml")); QQuickItem *item = qobject_cast(c.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); // update on creation QCOMPARE(item->property("changeCount").toInt(), 1); -- cgit v1.2.3