aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlincubator
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/qqmlincubator
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/qqmlincubator')
-rw-r--r--tests/auto/qml/qqmlincubator/testtypes.cpp28
-rw-r--r--tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp84
2 files changed, 56 insertions, 56 deletions
diff --git a/tests/auto/qml/qqmlincubator/testtypes.cpp b/tests/auto/qml/qqmlincubator/testtypes.cpp
index 3fcd3ba299..06d5904bbd 100644
--- a/tests/auto/qml/qqmlincubator/testtypes.cpp
+++ b/tests/auto/qml/qqmlincubator/testtypes.cpp
@@ -28,7 +28,7 @@
#include "testtypes.h"
#include <QtQml/qqml.h>
-SelfRegisteringType *SelfRegisteringType::m_me = 0;
+SelfRegisteringType *SelfRegisteringType::m_me = nullptr;
SelfRegisteringType::SelfRegisteringType()
: m_v(0)
{
@@ -42,13 +42,13 @@ SelfRegisteringType *SelfRegisteringType::me()
void SelfRegisteringType::clearMe()
{
- m_me = 0;
+ m_me = nullptr;
}
-SelfRegisteringOuterType *SelfRegisteringOuterType::m_me = 0;
+SelfRegisteringOuterType *SelfRegisteringOuterType::m_me = nullptr;
bool SelfRegisteringOuterType::beenDeleted = false;
SelfRegisteringOuterType::SelfRegisteringOuterType()
-: m_v(0)
+: m_v(nullptr)
{
m_me = this;
beenDeleted = false;
@@ -64,7 +64,7 @@ SelfRegisteringOuterType *SelfRegisteringOuterType::me()
return m_me;
}
-CompletionRegisteringType *CompletionRegisteringType::m_me = 0;
+CompletionRegisteringType *CompletionRegisteringType::m_me = nullptr;
CompletionRegisteringType::CompletionRegisteringType()
{
}
@@ -85,11 +85,11 @@ CompletionRegisteringType *CompletionRegisteringType::me()
void CompletionRegisteringType::clearMe()
{
- m_me = 0;
+ m_me = nullptr;
}
-CallbackRegisteringType::callback CallbackRegisteringType::m_callback = 0;
-void *CallbackRegisteringType::m_data = 0;
+CallbackRegisteringType::callback CallbackRegisteringType::m_callback = nullptr;
+void *CallbackRegisteringType::m_data = nullptr;
CallbackRegisteringType::CallbackRegisteringType()
: m_v(0)
{
@@ -97,8 +97,8 @@ CallbackRegisteringType::CallbackRegisteringType()
void CallbackRegisteringType::clearCallback()
{
- m_callback = 0;
- m_data = 0;
+ m_callback = nullptr;
+ m_data = nullptr;
}
void CallbackRegisteringType::registerCallback(callback c, void *d)
@@ -107,8 +107,8 @@ void CallbackRegisteringType::registerCallback(callback c, void *d)
m_data = d;
}
-CompletionCallbackType::callback CompletionCallbackType::m_callback = 0;
-void *CompletionCallbackType::m_data = 0;
+CompletionCallbackType::callback CompletionCallbackType::m_callback = nullptr;
+void *CompletionCallbackType::m_data = nullptr;
CompletionCallbackType::CompletionCallbackType()
{
}
@@ -124,8 +124,8 @@ void CompletionCallbackType::componentComplete()
void CompletionCallbackType::clearCallback()
{
- m_callback = 0;
- m_data = 0;
+ m_callback = nullptr;
+ m_data = nullptr;
}
void CompletionCallbackType::registerCallback(callback c, void *d)
diff --git a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp
index 863b6aaa29..8f0e04e12e 100644
--- a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp
+++ b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp
@@ -145,15 +145,15 @@ void tst_qqmlincubator::objectDeleted()
QCOMPARE(incubator.status(), QQmlIncubator::Loading);
QVERIFY(!SelfRegisteringType::me());
- while (SelfRegisteringOuterType::me() == 0 && incubator.isLoading()) {
+ while (SelfRegisteringOuterType::me() == nullptr && incubator.isLoading()) {
bool b = false;
controller.incubateWhile(&b);
}
- QVERIFY(SelfRegisteringOuterType::me() != 0);
+ QVERIFY(SelfRegisteringOuterType::me() != nullptr);
QVERIFY(incubator.isLoading());
- while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) {
bool b = false;
controller.incubateWhile(&b);
}
@@ -201,13 +201,13 @@ void tst_qqmlincubator::clear()
QQmlIncubator incubator;
component.create(incubator);
- while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) {
bool b = false;
controller.incubateWhile(&b);
}
QVERIFY(incubator.isLoading());
- QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(SelfRegisteringType::me() != nullptr);
QPointer<SelfRegisteringType> srt = SelfRegisteringType::me();
incubator.clear();
@@ -226,7 +226,7 @@ void tst_qqmlincubator::clear()
}
QVERIFY(incubator.isReady());
- QVERIFY(incubator.object() != 0);
+ QVERIFY(incubator.object() != nullptr);
QPointer<QObject> obj = incubator.object();
incubator.clear();
@@ -299,7 +299,7 @@ void tst_qqmlincubator::forceCompletion()
incubator.forceCompletion();
QVERIFY(incubator.isReady());
- QVERIFY(incubator.object() != 0);
+ QVERIFY(incubator.object() != nullptr);
QCOMPARE(incubator.object()->property("testValue").toInt(), 3499);
delete incubator.object();
@@ -314,18 +314,18 @@ void tst_qqmlincubator::forceCompletion()
component.create(incubator);
QVERIFY(incubator.isLoading());
- while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) {
bool b = false;
controller.incubateWhile(&b);
}
- QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(SelfRegisteringType::me() != nullptr);
QVERIFY(incubator.isLoading());
incubator.forceCompletion();
QVERIFY(incubator.isReady());
- QVERIFY(incubator.object() != 0);
+ QVERIFY(incubator.object() != nullptr);
QCOMPARE(incubator.object()->property("testValue").toInt(), 3499);
delete incubator.object();
@@ -341,13 +341,13 @@ void tst_qqmlincubator::forceCompletion()
incubator.forceCompletion();
QVERIFY(incubator.isReady());
- QVERIFY(incubator.object() != 0);
+ QVERIFY(incubator.object() != nullptr);
QCOMPARE(incubator.object()->property("testValue").toInt(), 3499);
incubator.forceCompletion();
QVERIFY(incubator.isReady());
- QVERIFY(incubator.object() != 0);
+ QVERIFY(incubator.object() != nullptr);
QCOMPARE(incubator.object()->property("testValue").toInt(), 3499);
delete incubator.object();
@@ -410,19 +410,19 @@ void tst_qqmlincubator::clearDuringCompletion()
QCOMPARE(incubator.status(), QQmlIncubator::Loading);
QVERIFY(!CompletionRegisteringType::me());
- while (CompletionRegisteringType::me() == 0 && incubator.isLoading()) {
+ while (CompletionRegisteringType::me() == nullptr && incubator.isLoading()) {
bool b = false;
controller.incubateWhile(&b);
}
- QVERIFY(CompletionRegisteringType::me() != 0);
- QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(CompletionRegisteringType::me() != nullptr);
+ QVERIFY(SelfRegisteringType::me() != nullptr);
QVERIFY(incubator.isLoading());
QPointer<QObject> srt = SelfRegisteringType::me();
incubator.clear();
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
QCoreApplication::processEvents();
QVERIFY(incubator.isNull());
QVERIFY(srt.isNull());
@@ -436,7 +436,7 @@ void tst_qqmlincubator::objectDeletionAfterInit()
struct MyIncubator : public QQmlIncubator
{
MyIncubator(QQmlIncubator::IncubationMode mode)
- : QQmlIncubator(mode), obj(0) {}
+ : QQmlIncubator(mode), obj(nullptr) {}
virtual void setInitialState(QObject *o) {
obj = o;
@@ -455,12 +455,12 @@ void tst_qqmlincubator::objectDeletionAfterInit()
}
QVERIFY(incubator.isLoading());
- QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(SelfRegisteringType::me() != nullptr);
delete incubator.obj;
incubator.clear();
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
QCoreApplication::processEvents();
QVERIFY(incubator.isNull());
}
@@ -592,11 +592,11 @@ void tst_qqmlincubator::asynchronousIfNested()
QVERIFY(component.isReady());
QObject *object = component.create();
- QVERIFY(object != 0);
+ QVERIFY(object != nullptr);
QCOMPARE(object->property("a").toInt(), 10);
QQmlIncubator incubator(QQmlIncubator::AsynchronousIfNested);
- component.create(incubator, 0, qmlContext(object));
+ component.create(incubator, nullptr, qmlContext(object));
QVERIFY(incubator.isReady());
QVERIFY(incubator.object());
@@ -618,16 +618,16 @@ void tst_qqmlincubator::asynchronousIfNested()
QVERIFY(incubator.isLoading());
QVERIFY(!SelfRegisteringType::me());
- while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) {
bool b = false;
controller.incubateWhile(&b);
}
- QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(SelfRegisteringType::me() != nullptr);
QVERIFY(incubator.isLoading());
QQmlIncubator nested(QQmlIncubator::AsynchronousIfNested);
- component.create(nested, 0, qmlContext(SelfRegisteringType::me()));
+ component.create(nested, nullptr, qmlContext(SelfRegisteringType::me()));
QVERIFY(nested.isLoading());
while (nested.isLoading()) {
@@ -669,7 +669,7 @@ void tst_qqmlincubator::asynchronousIfNested()
if (!c.isReady()) return;
QQmlIncubator incubator(QQmlIncubator::AsynchronousIfNested);
- c.create(incubator, 0, qmlContext(o));
+ c.create(incubator, nullptr, qmlContext(o));
if (!incubator.isReady()) return;
@@ -738,12 +738,12 @@ void tst_qqmlincubator::chainedAsynchronousIfNested()
QVERIFY(incubator.isLoading());
QVERIFY(!SelfRegisteringType::me());
- while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) {
bool b = false;
controller.incubateWhile(&b);
}
- QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(SelfRegisteringType::me() != nullptr);
QVERIFY(incubator.isLoading());
struct MyIncubator : public QQmlIncubator {
@@ -753,7 +753,7 @@ void tst_qqmlincubator::chainedAsynchronousIfNested()
protected:
virtual void statusChanged(Status s) {
if (s == Ready && next)
- component->create(*next, 0, ctxt);
+ component->create(*next, nullptr, ctxt);
}
private:
@@ -762,10 +762,10 @@ void tst_qqmlincubator::chainedAsynchronousIfNested()
QQmlContext *ctxt;
};
- MyIncubator incubator2(0, &component, 0);
+ MyIncubator incubator2(nullptr, &component, nullptr);
MyIncubator incubator1(&incubator2, &component, qmlContext(SelfRegisteringType::me()));
- component.create(incubator1, 0, qmlContext(SelfRegisteringType::me()));
+ component.create(incubator1, nullptr, qmlContext(SelfRegisteringType::me()));
QVERIFY(incubator.isLoading());
QVERIFY(incubator1.isLoading());
@@ -824,7 +824,7 @@ void tst_qqmlincubator::chainedAsynchronousIfNestedOnCompleted()
protected:
virtual void statusChanged(Status s) {
if (s == Ready && next) {
- component->create(*next, 0, ctxt);
+ component->create(*next, nullptr, ctxt);
}
}
@@ -842,7 +842,7 @@ void tst_qqmlincubator::chainedAsynchronousIfNestedOnCompleted()
QQmlContext *ctxt;
static void callback(CompletionCallbackType *, void *data) {
CallbackData *d = (CallbackData *)data;
- d->component->create(*d->incubator, 0, d->ctxt);
+ d->component->create(*d->incubator, nullptr, d->ctxt);
}
};
@@ -852,15 +852,15 @@ void tst_qqmlincubator::chainedAsynchronousIfNestedOnCompleted()
QVERIFY(incubator.isLoading());
QVERIFY(!SelfRegisteringType::me());
- while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) {
bool b = false;
controller.incubateWhile(&b);
}
- QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(SelfRegisteringType::me() != nullptr);
QVERIFY(incubator.isLoading());
- MyIncubator incubator3(0, &c1, qmlContext(SelfRegisteringType::me()));
+ MyIncubator incubator3(nullptr, &c1, qmlContext(SelfRegisteringType::me()));
MyIncubator incubator2(&incubator3, &c1, qmlContext(SelfRegisteringType::me()));
MyIncubator incubator1(&incubator2, &c1, qmlContext(SelfRegisteringType::me()));
@@ -952,7 +952,7 @@ void tst_qqmlincubator::chainedAsynchronousClear()
protected:
virtual void statusChanged(Status s) {
if (s == Ready && next) {
- component->create(*next, 0, ctxt);
+ component->create(*next, nullptr, ctxt);
}
}
@@ -970,7 +970,7 @@ void tst_qqmlincubator::chainedAsynchronousClear()
QQmlContext *ctxt;
static void callback(CompletionCallbackType *, void *data) {
CallbackData *d = (CallbackData *)data;
- d->component->create(*d->incubator, 0, d->ctxt);
+ d->component->create(*d->incubator, nullptr, d->ctxt);
}
};
@@ -980,15 +980,15 @@ void tst_qqmlincubator::chainedAsynchronousClear()
QVERIFY(incubator.isLoading());
QVERIFY(!SelfRegisteringType::me());
- while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) {
bool b = false;
controller.incubateWhile(&b);
}
- QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(SelfRegisteringType::me() != nullptr);
QVERIFY(incubator.isLoading());
- MyIncubator incubator3(0, &c1, qmlContext(SelfRegisteringType::me()));
+ MyIncubator incubator3(nullptr, &c1, qmlContext(SelfRegisteringType::me()));
MyIncubator incubator2(&incubator3, &c1, qmlContext(SelfRegisteringType::me()));
MyIncubator incubator1(&incubator2, &c1, qmlContext(SelfRegisteringType::me()));
@@ -1103,12 +1103,12 @@ void tst_qqmlincubator::selfDelete()
QCOMPARE(incubator->QQmlIncubator::status(), QQmlIncubator::Loading);
QVERIFY(!SelfRegisteringType::me());
- while (SelfRegisteringType::me() == 0 && incubator->isLoading()) {
+ while (SelfRegisteringType::me() == nullptr && incubator->isLoading()) {
bool b = false;
controller.incubateWhile(&b);
}
- QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(SelfRegisteringType::me() != nullptr);
QVERIFY(incubator->isLoading());
// We have to cheat and manually remove it from the creator->allCreatedObjects