aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-21 10:41:54 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-26 07:13:18 +0000
commit499ec43937e926e4f2fa57a9baa455fcb3862262 (patch)
tree206c90d47387f8322b68f5e3db613189397e1af3 /tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
parent53d1e9ed21d25e65a2f13606af479838f5f21fe7 (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/qqmlconnections/tst_qqmlconnections.cpp')
-rw-r--r--tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
index 22e9724c61..8ef00f8080 100644
--- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
+++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
@@ -70,7 +70,7 @@ void tst_qqmlconnections::defaultValues()
QQmlComponent c(&engine, testFileUrl("test-connection3.qml"));
QQmlConnections *item = qobject_cast<QQmlConnections*>(c.create());
- QVERIFY(item != 0);
+ QVERIFY(item != nullptr);
QVERIFY(!item->target());
delete item;
@@ -82,9 +82,9 @@ void tst_qqmlconnections::properties()
QQmlComponent c(&engine, testFileUrl("test-connection2.qml"));
QQmlConnections *item = qobject_cast<QQmlConnections*>(c.create());
- QVERIFY(item != 0);
+ QVERIFY(item != nullptr);
- QVERIFY(item != 0);
+ QVERIFY(item != nullptr);
QCOMPARE(item->target(), item);
delete item;
@@ -96,7 +96,7 @@ void tst_qqmlconnections::connection()
QQmlComponent c(&engine, testFileUrl("test-connection.qml"));
QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
- QVERIFY(item != 0);
+ QVERIFY(item != nullptr);
QCOMPARE(item->property("tested").toBool(), false);
QCOMPARE(item->width(), 50.);
@@ -113,7 +113,7 @@ void tst_qqmlconnections::trimming()
QQmlComponent c(&engine, testFileUrl("trimming.qml"));
QObject *object = c.create();
- QVERIFY(object != 0);
+ QVERIFY(object != nullptr);
QCOMPARE(object->property("tested").toString(), QString(""));
int index = object->metaObject()->indexOfSignal("testMe(int,QString)");
@@ -133,7 +133,7 @@ void tst_qqmlconnections::targetChanged()
QQmlEngine engine;
QQmlComponent c(&engine, testFileUrl("connection-targetchange.qml"));
QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
- QVERIFY(item != 0);
+ QVERIFY(item != nullptr);
QQmlConnections *connections = item->findChild<QQmlConnections*>("connections");
QVERIFY(connections);
@@ -178,7 +178,7 @@ void tst_qqmlconnections::unknownSignals()
QQmlEngine engine;
QQmlComponent c(&engine, url);
QObject *object = c.create();
- QVERIFY(object != 0);
+ QVERIFY(object != nullptr);
// check that connection is created (they are all runtime errors)
QQmlConnections *connections = object->findChild<QQmlConnections*>("connections");
@@ -222,7 +222,7 @@ class TestObject : public QObject
Q_PROPERTY(bool ran READ ran WRITE setRan)
public:
- TestObject(QObject *parent = 0) : QObject(parent), m_ran(false) {}
+ TestObject(QObject *parent = nullptr) : QObject(parent), m_ran(false) {}
~TestObject() {}
bool ran() const { return m_ran; }
@@ -244,7 +244,7 @@ void tst_qqmlconnections::rewriteErrors()
QQmlComponent c(&engine, testFileUrl("rewriteError-unnamed.qml"));
QTest::ignoreMessage(QtWarningMsg, (c.url().toString() + ":5:35: QML Connections: Signal uses unnamed parameter followed by named parameter.").toLatin1());
TestObject *obj = qobject_cast<TestObject*>(c.create());
- QVERIFY(obj != 0);
+ QVERIFY(obj != nullptr);
obj->unnamedArgumentSignal(1, .5, "hello");
QCOMPARE(obj->ran(), false);
@@ -256,7 +256,7 @@ void tst_qqmlconnections::rewriteErrors()
QQmlComponent c(&engine, testFileUrl("rewriteError-global.qml"));
QTest::ignoreMessage(QtWarningMsg, (c.url().toString() + ":5:35: QML Connections: Signal parameter \"parseInt\" hides global variable.").toLatin1());
TestObject *obj = qobject_cast<TestObject*>(c.create());
- QVERIFY(obj != 0);
+ QVERIFY(obj != nullptr);
obj->signalWithGlobalName(10);
QCOMPARE(obj->ran(), false);
@@ -272,7 +272,7 @@ Q_OBJECT
Q_PROPERTY(int intProp READ intProp WRITE setIntProp NOTIFY intPropChanged)
public:
- MyTestSingletonType(QObject *parent = 0) : QObject(parent), m_intProp(0), m_changeCount(0) {}
+ MyTestSingletonType(QObject *parent = nullptr) : QObject(parent), m_intProp(0), m_changeCount(0) {}
~MyTestSingletonType() {}
Q_INVOKABLE int otherMethod(int val) { return val + 4; }
@@ -307,7 +307,7 @@ void tst_qqmlconnections::singletonTypeTarget()
qmlRegisterSingletonType<MyTestSingletonType>("MyTestSingletonType", 1, 0, "Api", module_api_factory);
QQmlComponent component(&engine, testFileUrl("singletontype-target.qml"));
QObject *object = component.create();
- QVERIFY(object != 0);
+ QVERIFY(object != nullptr);
QCOMPARE(object->property("moduleIntPropChangedCount").toInt(), 0);
QCOMPARE(object->property("moduleOtherSignalCount").toInt(), 0);
@@ -333,7 +333,7 @@ void tst_qqmlconnections::enableDisable_QTBUG_36350()
QQmlEngine engine;
QQmlComponent c(&engine, testFileUrl("test-connection.qml"));
QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
- QVERIFY(item != 0);
+ QVERIFY(item != nullptr);
QQmlConnections *connections = item->findChild<QQmlConnections*>("connections");
QVERIFY(connections);
@@ -361,7 +361,7 @@ void tst_qqmlconnections::disabledAtStart()
QQmlComponent c(&engine, testFileUrl("disabled-at-start.qml"));
QObject * const object = c.create();
- QVERIFY(object != 0);
+ QVERIFY(object != nullptr);
QCOMPARE(object->property("tested").toBool(), false);
const int index = object->metaObject()->indexOfSignal("testMe()");
@@ -379,7 +379,7 @@ void tst_qqmlconnections::clearImplicitTarget()
QQmlComponent c(&engine, testFileUrl("test-connection-implicit.qml"));
QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
- QVERIFY(item != 0);
+ QVERIFY(item != nullptr);
// normal case: fire Connections
item->setWidth(100.);
@@ -389,7 +389,7 @@ void tst_qqmlconnections::clearImplicitTarget()
// clear the implicit target
QQmlConnections *connections = item->findChild<QQmlConnections*>();
QVERIFY(connections);
- connections->setTarget(0);
+ connections->setTarget(nullptr);
// target cleared: no longer fire Connections
item->setWidth(150.);