aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-21 11:52:59 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-26 13:08:30 +0000
commit06e962f263a86c4b66e1c6195b3d2615695fea1e (patch)
tree3669793f9983762538a9cb12a07ce49d461f066d /tests/auto/quick
parent78e875e6dbd4991fe22c194d8608b3d66c96e036 (diff)
init variables where they are declared when possible (clang-tidy)
clang-tidy -p compile_commands.json $file -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' -header-filter='qtdeclarative' -fix Change-Id: I705f3235ff129ba68b0d8dad54a083e29fcead5f Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/nodes/tst_nodestest.cpp9
-rw-r--r--tests/auto/quick/qquickdrag/tst_qquickdrag.cpp24
-rw-r--r--tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp8
-rw-r--r--tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp13
-rw-r--r--tests/auto/quick/qquickloader/tst_qquickloader.cpp4
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp4
-rw-r--r--tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp4
-rw-r--r--tests/auto/quick/rendernode/tst_rendernode.cpp4
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp12
9 files changed, 33 insertions, 49 deletions
diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp
index c9af5a5c34..79a9e5f757 100644
--- a/tests/auto/quick/nodes/tst_nodestest.cpp
+++ b/tests/auto/quick/nodes/tst_nodestest.cpp
@@ -76,9 +76,9 @@ private Q_SLOTS:
void textureNodeRect();
private:
- QOffscreenSurface *surface;
- QOpenGLContext *context;
- QSGDefaultRenderContext *renderContext;
+ QOffscreenSurface *surface = nullptr;
+ QOpenGLContext *context = nullptr;
+ QSGDefaultRenderContext *renderContext = nullptr;
};
void NodesTest::initTestCase()
@@ -147,9 +147,6 @@ public:
int DummyRenderer::globalRendereringOrder;
NodesTest::NodesTest()
- : surface(nullptr)
- , context(nullptr)
- , renderContext(nullptr)
{
}
diff --git a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp
index 42af7d4443..9d832066af 100644
--- a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp
+++ b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp
@@ -59,14 +59,6 @@ class TestDropTarget : public QQuickItem
public:
TestDropTarget(QQuickItem *parent = nullptr)
: QQuickItem(parent)
- , enterEvents(0)
- , moveEvents(0)
- , leaveEvents(0)
- , dropEvents(0)
- , acceptAction(Qt::MoveAction)
- , defaultAction(Qt::IgnoreAction)
- , proposedAction(Qt::IgnoreAction)
- , accept(true)
{
setFlags(ItemAcceptsDrops);
}
@@ -119,16 +111,16 @@ public:
event->setAccepted(accept);
}
- int enterEvents;
- int moveEvents;
- int leaveEvents;
- int dropEvents;
- Qt::DropAction acceptAction;
- Qt::DropAction defaultAction;
- Qt::DropAction proposedAction;
+ int enterEvents = 0;
+ int moveEvents = 0;
+ int leaveEvents = 0;
+ int dropEvents = 0;
+ Qt::DropAction acceptAction = Qt::MoveAction;
+ Qt::DropAction defaultAction = Qt::IgnoreAction;
+ Qt::DropAction proposedAction = Qt::IgnoreAction;
Qt::DropActions supportedActions;
QPointF position;
- bool accept;
+ bool accept = true;
};
class tst_QQuickDrag: public QObject
diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
index 4298bc198b..d8464ebc74 100644
--- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
+++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
@@ -393,7 +393,7 @@ void tst_qquickimageprovider::imageProviderId()
class TestThreadProvider : public QQuickImageProvider
{
public:
- TestThreadProvider() : QQuickImageProvider(Image), ok(false) {}
+ TestThreadProvider() : QQuickImageProvider(Image) {}
~TestThreadProvider() {}
@@ -417,7 +417,7 @@ class TestThreadProvider : public QQuickImageProvider
QWaitCondition cond;
QMutex mutex;
- bool ok;
+ bool ok = false;
};
@@ -495,7 +495,7 @@ class TestImageResponse : public QQuickImageResponse, public QRunnable
class TestAsyncProvider : public QQuickAsyncImageProvider
{
public:
- TestAsyncProvider() : ok(false)
+ TestAsyncProvider()
{
pool.setMaxThreadCount(4);
}
@@ -512,7 +512,7 @@ class TestAsyncProvider : public QQuickAsyncImageProvider
QThreadPool pool;
QMutex lock;
QWaitCondition condition;
- bool ok;
+ bool ok = false;
};
diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
index 599e8d92b4..1a289a2087 100644
--- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
+++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
@@ -89,17 +89,12 @@ private slots:
private:
void mirroringCheck(int mirroring, int x, bool shouldMirror, const QImage &fb);
- bool m_isMesaSoftwareRasterizer;
- int m_mesaVersion;
- bool m_isOpenGLRenderer;
+ bool m_isMesaSoftwareRasterizer = false;
+ int m_mesaVersion = 0;
+ bool m_isOpenGLRenderer = true;
};
-tst_QQuickItemLayer::tst_QQuickItemLayer()
- : m_isMesaSoftwareRasterizer(false)
- , m_mesaVersion(0)
- , m_isOpenGLRenderer(true)
-{
-}
+tst_QQuickItemLayer::tst_QQuickItemLayer() { }
void tst_QQuickItemLayer::initTestCase()
{
diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
index 5c11628e97..30fc52f95a 100644
--- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp
+++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
@@ -54,11 +54,11 @@ class PeriodicIncubationController : public QObject,
public QQmlIncubationController
{
public:
- PeriodicIncubationController() : incubated(false) {}
+ PeriodicIncubationController() {}
void start() { startTimer(20); }
- bool incubated;
+ bool incubated = false;
protected:
virtual void timerEvent(QTimerEvent *) {
diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
index 056b1fc020..73f3cab318 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
+++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
@@ -41,7 +41,7 @@ class tst_QQuickMultiPointTouchArea : public QQmlDataTest
{
Q_OBJECT
public:
- tst_QQuickMultiPointTouchArea() : device(nullptr) { }
+ tst_QQuickMultiPointTouchArea() { }
private slots:
void initTestCase() {
@@ -73,7 +73,7 @@ private slots:
private:
QQuickView *createAndShowView(const QString &file);
- QTouchDevice *device;
+ QTouchDevice *device = nullptr;
};
void tst_QQuickMultiPointTouchArea::properties()
diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
index fd81c0a67c..2571e4f288 100644
--- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
+++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
@@ -41,7 +41,7 @@ class tst_QQuickPinchArea: public QQmlDataTest
{
Q_OBJECT
public:
- tst_QQuickPinchArea() : device(nullptr) { }
+ tst_QQuickPinchArea() { }
private slots:
void initTestCase();
void cleanupTestCase();
@@ -55,7 +55,7 @@ private slots:
private:
QQuickView *createView();
- QTouchDevice *device;
+ QTouchDevice *device = nullptr;
};
void tst_QQuickPinchArea::initTestCase()
{
diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp
index d6e1982b1e..0e06ee6f50 100644
--- a/tests/auto/quick/rendernode/tst_rendernode.cpp
+++ b/tests/auto/quick/rendernode/tst_rendernode.cpp
@@ -120,7 +120,7 @@ private:
class MessUpNode : public QSGRenderNode, protected QOpenGLFunctions
{
public:
- MessUpNode() : initialized(false) { }
+ MessUpNode() {}
StateFlags changedStates() const override
{
@@ -157,7 +157,7 @@ public:
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
}
- bool initialized;
+ bool initialized = false;
};
class MessUpItem : public QQuickItem
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index 67a7c56099..a79ff4e78f 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -87,7 +87,7 @@ Q_SIGNALS:
public:
EventItem(QQuickItem *parent = nullptr)
- : QQuickItem(parent), touchUngrabCount(0), acceptMouse(false), acceptTouch(false), filterTouch(false), point0(-1)
+ : QQuickItem(parent)
{
setAcceptedMouseButtons(Qt::LeftButton);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@@ -140,10 +140,10 @@ public:
}
QList<Event> eventList;
- int touchUngrabCount;
- bool acceptMouse;
- bool acceptTouch;
- bool filterTouch; // when used as event filter
+ int touchUngrabCount = 0;
+ bool acceptMouse = false;
+ bool acceptTouch = false;
+ bool filterTouch = false; // when used as event filter
bool eventFilter(QObject *, QEvent *event)
{
@@ -162,7 +162,7 @@ public:
}
return false;
}
- int point0;
+ int point0 = -1;
};
class tst_TouchMouse : public QQmlDataTest