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/qqmllistreference | |
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/qqmllistreference')
-rw-r--r-- | tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp index 5c16a48378..199f7bc7e4 100644 --- a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp +++ b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp @@ -115,7 +115,7 @@ void tst_qqmllistreference::qmllistreference_invalid() QVERIFY(!r.canAt()); QVERIFY(!r.canClear()); QVERIFY(!r.canCount()); - QVERIFY(!r.append(0)); + QVERIFY(!r.append(nullptr)); QVERIFY(!r.at(10)); QVERIFY(!r.clear()); QCOMPARE(r.count(), 0); @@ -132,7 +132,7 @@ void tst_qqmllistreference::qmllistreference_invalid() QVERIFY(!r.canAt()); QVERIFY(!r.canClear()); QVERIFY(!r.canCount()); - QVERIFY(!r.append(0)); + QVERIFY(!r.append(nullptr)); QVERIFY(!r.at(10)); QVERIFY(!r.clear()); QCOMPARE(r.count(), 0); @@ -149,7 +149,7 @@ void tst_qqmllistreference::qmllistreference_invalid() QVERIFY(!r.canAt()); QVERIFY(!r.canClear()); QVERIFY(!r.canCount()); - QVERIFY(!r.append(0)); + QVERIFY(!r.append(nullptr)); QVERIFY(!r.at(10)); QVERIFY(!r.clear()); QCOMPARE(r.count(), 0); @@ -247,7 +247,7 @@ void tst_qqmllistreference::canAppend() { TestType tt; - tt.property.append = 0; + tt.property.append = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.canAppend()); } @@ -276,7 +276,7 @@ void tst_qqmllistreference::canAt() { TestType tt; - tt.property.at = 0; + tt.property.at = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.canAt()); } @@ -305,7 +305,7 @@ void tst_qqmllistreference::canClear() { TestType tt; - tt.property.clear = 0; + tt.property.clear = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.canClear()); } @@ -334,7 +334,7 @@ void tst_qqmllistreference::canCount() { TestType tt; - tt.property.count = 0; + tt.property.count = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.canCount()); } @@ -363,7 +363,7 @@ void tst_qqmllistreference::isReadable() { TestType tt; - tt.property.count = 0; + tt.property.count = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.isReadable()); } @@ -392,7 +392,7 @@ void tst_qqmllistreference::isManipulable() { TestType tt; - tt.property.count = 0; + tt.property.count = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.isManipulable()); } @@ -421,17 +421,17 @@ void tst_qqmllistreference::append() QVERIFY(!ref.append(&object)); QCOMPARE(tt->data.count(), 1); QCOMPARE(tt->data.at(0), tt); - QVERIFY(ref.append(0)); + QVERIFY(ref.append(nullptr)); QCOMPARE(tt->data.count(), 2); QCOMPARE(tt->data.at(0), tt); QVERIFY(!tt->data.at(1)); delete tt; - QVERIFY(!ref.append(0)); + QVERIFY(!ref.append(nullptr)); } { TestType tt; - tt.property.append = 0; + tt.property.append = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.append(&tt)); } @@ -466,7 +466,7 @@ void tst_qqmllistreference::at() { TestType tt; tt.data.append(&tt); - tt.property.at = 0; + tt.property.at = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.at(0)); } @@ -499,7 +499,7 @@ void tst_qqmllistreference::clear() { TestType tt; - tt.property.clear = 0; + tt.property.clear = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.clear()); } @@ -534,7 +534,7 @@ void tst_qqmllistreference::count() { TestType tt; tt.data.append(&tt); - tt.property.count = 0; + tt.property.count = nullptr; QQmlListReference ref(&tt, "data"); QCOMPARE(ref.count(), 0); } @@ -626,17 +626,17 @@ void tst_qqmllistreference::listProperty() QQmlComponent component(&engine, testFileUrl("propertyList.qml")); QScopedPointer<QObject> object( component.create() ); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE( object->property("state").toString(), QStringLiteral("MyState2") ); QQmlListReference list( object.data(), "states"); QCOMPARE( list.count(), 2 ); QQuickState* state1 = dynamic_cast<QQuickState*>( list.at( 0 ) ); - QVERIFY(state1 != 0); + QVERIFY(state1 != nullptr); QCOMPARE( state1->name(), QStringLiteral("MyState1") ); QQuickState* state2 = dynamic_cast<QQuickState*>( list.at( 1 ) ); - QVERIFY(state2 != 0); + QVERIFY(state2 != nullptr); QCOMPARE( state2->name(), QStringLiteral("MyState2") ); } |