aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmltest
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 /src/qmltest
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 'src/qmltest')
-rw-r--r--src/qmltest/quicktest.cpp8
-rw-r--r--src/qmltest/quicktestevent.cpp4
-rw-r--r--src/qmltest/quicktestevent_p.h4
-rw-r--r--src/qmltest/quicktestresult.cpp24
-rw-r--r--src/qmltest/quicktestresult_p.h2
5 files changed, 21 insertions, 21 deletions
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 817f9a5389..a02a0a806d 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -79,7 +79,7 @@ class QTestRootObject : public QObject
Q_PROPERTY(bool hasTestCase READ hasTestCase WRITE setHasTestCase NOTIFY hasTestCaseChanged)
Q_PROPERTY(QObject *defined READ defined)
public:
- QTestRootObject(QObject *parent = 0)
+ QTestRootObject(QObject *parent = nullptr)
: QObject(parent), hasQuit(false), m_windowShown(false), m_hasTestCase(false) {
m_defined = new QQmlPropertyMap(this);
#if defined(QT_OPENGL_ES_2_ANGLE)
@@ -191,7 +191,7 @@ bool qWaitForSignal(QObject *obj, const char* signal, int timeout = 5000)
if (remaining <= 0)
break;
QCoreApplication::processEvents(QEventLoop::AllEvents, remaining);
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
QTest::qSleep(10);
}
@@ -343,7 +343,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch
}
#endif
- QCoreApplication *app = 0;
+ QCoreApplication *app = nullptr;
if (!QCoreApplication::instance()) {
#ifdef QT_QMLTEST_WITH_WIDGETS
if (withWidgets)
@@ -577,7 +577,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch
}
// Flush the current logging stream.
- QuickTestResult::setProgramName(0);
+ QuickTestResult::setProgramName(nullptr);
delete app;
// Return the number of failures as the exit code.
diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp
index bf255e9cda..ee375a896c 100644
--- a/src/qmltest/quicktestevent.cpp
+++ b/src/qmltest/quicktestevent.cpp
@@ -190,7 +190,7 @@ namespace QtQuickTest
me.setTimestamp(++lastMouseTimestamp);
break;
case MouseRelease:
- me = QMouseEvent(QEvent::MouseButtonRelease, pos, window->mapToGlobal(pos), button, 0, stateKey);
+ me = QMouseEvent(QEvent::MouseButtonRelease, pos, window->mapToGlobal(pos), button, nullptr, stateKey);
me.setTimestamp(++lastMouseTimestamp);
lastMouseTimestamp += 500; // avoid double clicks being generated
break;
@@ -355,7 +355,7 @@ QWindow *QuickTestEvent::eventWindow(QObject *item)
QQuickItem *testParentitem = qobject_cast<QQuickItem *>(parent());
if (testParentitem)
return testParentitem->window();
- return 0;
+ return nullptr;
}
QWindow *QuickTestEvent::activeWindow()
diff --git a/src/qmltest/quicktestevent_p.h b/src/qmltest/quicktestevent_p.h
index 92477399bc..d586ff638d 100644
--- a/src/qmltest/quicktestevent_p.h
+++ b/src/qmltest/quicktestevent_p.h
@@ -81,7 +81,7 @@ class Q_QUICK_TEST_EXPORT QuickTestEvent : public QObject
Q_OBJECT
Q_PROPERTY(int defaultMouseDelay READ defaultMouseDelay FINAL)
public:
- QuickTestEvent(QObject *parent = 0);
+ QuickTestEvent(QObject *parent = nullptr);
~QuickTestEvent();
int defaultMouseDelay() const;
@@ -115,7 +115,7 @@ public Q_SLOTS:
QQuickTouchEventSequence *touchEvent(QObject *item = nullptr);
private:
- QWindow *eventWindow(QObject *item = 0);
+ QWindow *eventWindow(QObject *item = nullptr);
QWindow *activeWindow();
QTouchDevice *touchDevice();
diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp
index d7d692a80d..c4a3280cf6 100644
--- a/src/qmltest/quicktestresult.cpp
+++ b/src/qmltest/quicktestresult.cpp
@@ -73,7 +73,7 @@
QT_BEGIN_NAMESPACE
-static const char *globalProgramName = 0;
+static const char *globalProgramName = nullptr;
static bool loggingStarted = false;
static QBenchmarkGlobalData globalBenchmarkData;
@@ -88,7 +88,7 @@ class Q_QUICK_TEST_EXPORT QuickTestImageObject : public QObject
Q_PROPERTY(QSize size READ size CONSTANT)
public:
- QuickTestImageObject(const QImage& img, QObject *parent = 0)
+ QuickTestImageObject(const QImage& img, QObject *parent = nullptr)
: QObject(parent)
, m_image(img)
{
@@ -172,9 +172,9 @@ class QuickTestResultPrivate
{
public:
QuickTestResultPrivate()
- : table(0)
- , benchmarkIter(0)
- , benchmarkData(0)
+ : table(nullptr)
+ , benchmarkIter(nullptr)
+ , benchmarkData(nullptr)
, iterCount(0)
{
}
@@ -261,10 +261,10 @@ void QuickTestResult::setFunctionName(const QString &name)
QString fullName = d->testCaseName + QLatin1String("::") + name;
QTestResult::setCurrentTestFunction
(d->intern(fullName).constData());
- QTestPrivate::checkBlackLists(fullName.toUtf8().constData(), 0);
+ QTestPrivate::checkBlackLists(fullName.toUtf8().constData(), nullptr);
}
} else {
- QTestResult::setCurrentTestFunction(0);
+ QTestResult::setCurrentTestFunction(nullptr);
}
d->functionName = name;
emit functionNameChanged();
@@ -293,7 +293,7 @@ void QuickTestResult::setDataTag(const QString &tag)
QTestPrivate::checkBlackLists((testCaseName() + QLatin1String("::") + functionName()).toUtf8().constData(), tag.toUtf8().constData());
emit dataTagChanged();
} else {
- QTestResult::setCurrentTestData(0);
+ QTestResult::setCurrentTestData(nullptr);
}
}
@@ -438,7 +438,7 @@ void QuickTestResult::clearTestTable()
{
Q_D(QuickTestResult);
delete d->table;
- d->table = 0;
+ d->table = nullptr;
}
void QuickTestResult::finishTestData()
@@ -745,7 +745,7 @@ void QuickTestResult::stopBenchmark()
{
Q_D(QuickTestResult);
delete d->benchmarkIter;
- d->benchmarkIter = 0;
+ d->benchmarkIter = nullptr;
}
QObject *QuickTestResult::grabImage(QQuickItem *item)
@@ -759,7 +759,7 @@ QObject *QuickTestResult::grabImage(QQuickItem *item)
QQmlEngine::setContextForObject(o, qmlContext(this));
return o;
}
- return 0;
+ return nullptr;
}
QObject *QuickTestResult::findChild(QObject *parent, const QString &objectName)
@@ -787,7 +787,7 @@ void QuickTestResult::setProgramName(const char *name)
} else if (!name && loggingStarted) {
QTestResult::setCurrentTestObject(globalProgramName);
QTestLog::stopLogging();
- QTestResult::setCurrentTestObject(0);
+ QTestResult::setCurrentTestObject(nullptr);
}
globalProgramName = name;
QTestResult::setCurrentTestObject(globalProgramName);
diff --git a/src/qmltest/quicktestresult_p.h b/src/qmltest/quicktestresult_p.h
index af13299ee5..3973cf4072 100644
--- a/src/qmltest/quicktestresult_p.h
+++ b/src/qmltest/quicktestresult_p.h
@@ -77,7 +77,7 @@ class Q_QUICK_TEST_EXPORT QuickTestResult : public QObject
Q_PROPERTY(int skipCount READ skipCount)
Q_PROPERTY(QStringList functionsToRun READ functionsToRun)
public:
- QuickTestResult(QObject *parent = 0);
+ QuickTestResult(QObject *parent = nullptr);
~QuickTestResult();
// Values must match QBenchmarkIterationController::RunMode.