aboutsummaryrefslogtreecommitdiffstats
path: root/tests
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
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')
-rw-r--r--tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp4
-rw-r--r--tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp7
-rw-r--r--tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp11
-rw-r--r--tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp7
-rw-r--r--tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp10
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp28
-rw-r--r--tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp4
-rw-r--r--tests/auto/qml/qqmllocale/tst_qqmllocale.cpp2
-rw-r--r--tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp36
-rw-r--r--tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp7
-rw-r--r--tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp13
-rw-r--r--tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp7
-rw-r--r--tests/auto/qml/qqmltimer/tst_qqmltimer.cpp10
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp6
-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
23 files changed, 94 insertions, 140 deletions
diff --git a/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp b/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp
index c81fd37f07..7e19e925b6 100644
--- a/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp
+++ b/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp
@@ -53,7 +53,7 @@ private slots:
class TestableQAbstractAnimation : public QAbstractAnimationJob
{
public:
- TestableQAbstractAnimation() : m_duration(10) {}
+ TestableQAbstractAnimation() {}
virtual ~TestableQAbstractAnimation() {};
int duration() const { return m_duration; }
@@ -61,7 +61,7 @@ public:
void setDuration(int duration) { m_duration = duration; }
private:
- int m_duration;
+ int m_duration = 10;
};
class DummyQAnimationGroup : public QAnimationGroupJob
diff --git a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp
index b7f8280c5b..974357dc8e 100644
--- a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp
+++ b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp
@@ -71,10 +71,7 @@ class UncontrolledAnimation : public QObject, public QAbstractAnimationJob
{
Q_OBJECT
public:
- UncontrolledAnimation()
- : id(0)
- {
- }
+ UncontrolledAnimation() { }
int duration() const { return -1; /* not time driven */ }
@@ -96,7 +93,7 @@ protected:
}
private:
- int id;
+ int id = 0;
};
class StateChangeListener: public QAnimationJobChangeListener
diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp
index bb7e50dbbd..a8bcadbc84 100644
--- a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp
+++ b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp
@@ -89,7 +89,6 @@ class UncontrolledAnimation : public QObject, public QAbstractAnimationJob
Q_OBJECT
public:
UncontrolledAnimation()
- : id(0)
{
}
@@ -113,7 +112,7 @@ protected:
}
private:
- int id;
+ int id = 0;
};
class StateChangeListener: public QAnimationJobChangeListener
@@ -133,14 +132,14 @@ public:
class FinishedListener: public QAnimationJobChangeListener
{
public:
- FinishedListener() : m_count(0) {}
+ FinishedListener() {}
virtual void animationFinished(QAbstractAnimationJob *) { ++m_count; }
void clear() { m_count = 0; }
int count() { return m_count; }
private:
- int m_count;
+ int m_count = 0;
};
void tst_QParallelAnimationGroupJob::setCurrentTime()
@@ -685,10 +684,10 @@ void tst_QParallelAnimationGroupJob::stopUncontrolledAnimations()
}
struct AnimState {
- AnimState(int time = -1) : time(time), state(-1) {}
+ AnimState(int time = -1) : time(time) {}
AnimState(int time, int state) : time(time), state(state) {}
int time;
- int state;
+ int state = -1;
};
#define Running QAbstractAnimationJob::Running
diff --git a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp
index ff295c5409..8f6b6a2ab7 100644
--- a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp
+++ b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp
@@ -39,17 +39,14 @@ static const char winTimerError[] = "On windows, consistent timing is not workin
class TestablePauseAnimation : public QPauseAnimationJob
{
public:
- TestablePauseAnimation()
- : m_updateCurrentTimeCount(0)
- {
- }
+ TestablePauseAnimation() { }
TestablePauseAnimation(int duration)
: QPauseAnimationJob(duration), m_updateCurrentTimeCount(0)
{
}
- int m_updateCurrentTimeCount;
+ int m_updateCurrentTimeCount = 0;
protected:
void updateCurrentTime(int currentTime)
{
diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
index ee5db3e75a..57b0905a8a 100644
--- a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
+++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
@@ -95,7 +95,7 @@ class TestValueAnimation : public TestAnimation
{
public:
TestValueAnimation(int duration = 250)
- : TestAnimation(duration), start(0), end(0), value(0) {}
+ : TestAnimation(duration) {}
void updateCurrentTime(int msecs)
{
@@ -105,8 +105,8 @@ public:
value = start + (end - start) * (qreal(msecs) / duration());
}
- qreal start, end;
- qreal value;
+ qreal start = 0, end = 0;
+ qreal value = 0;
};
class UncontrolledAnimation : public QObject, public QAbstractAnimationJob
@@ -140,14 +140,14 @@ public:
class FinishedListener: public QAnimationJobChangeListener
{
public:
- FinishedListener() : m_count(0) {}
+ FinishedListener() {}
virtual void animationFinished(QAbstractAnimationJob *) { ++m_count; }
void clear() { m_count = 0; }
int count() { return m_count; }
private:
- int m_count;
+ int m_count = 0;
};
void tst_QSequentialAnimationGroupJob::setCurrentTime()
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index b34aaea61c..8f3011001b 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -735,23 +735,18 @@ public:
};
Q_ENUMS(Enum1 Enum2)
- Q_INVOKABLE TestQMetaObject()
- : m_called(1) {
- }
+ Q_INVOKABLE TestQMetaObject() {}
Q_INVOKABLE TestQMetaObject(int)
- : m_called(2) {
- }
+ : m_called(2) {}
Q_INVOKABLE TestQMetaObject(QString)
- : m_called(3) {
- }
+ : m_called(3) {}
Q_INVOKABLE TestQMetaObject(QString, int)
- : m_called(4) {
- }
+ : m_called(4) {}
int called() const {
return m_called;
}
private:
- int m_called;
+ int m_called = 1;
};
void tst_QJSEngine::newQObjectPropertyCache()
@@ -1300,8 +1295,8 @@ void tst_QJSEngine::errorMessage_QT679()
struct Foo {
public:
- int x, y;
- Foo() : x(-1), y(-1) { }
+ int x = -1, y = -1;
+ Foo() {}
};
Q_DECLARE_METATYPE(Foo)
@@ -3156,10 +3151,9 @@ class ThreadedTestEngine : public QThread {
Q_OBJECT;
public:
- int result;
+ int result = 0;
- ThreadedTestEngine()
- : result(0) {}
+ ThreadedTestEngine() {}
void run() {
QJSEngine firstEngine;
@@ -4058,9 +4052,9 @@ class TestObject : public QObject
{
Q_OBJECT
public:
- TestObject() : called(false) {}
+ TestObject() {}
- bool called;
+ bool called = false;
Q_INVOKABLE void callMe(QQmlV4Function *) {
called = true;
diff --git a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp
index e6e47bda28..b49832499e 100644
--- a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp
+++ b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp
@@ -45,13 +45,13 @@ struct Range
template <typename T> struct Array
{
- Array() : array(nullptr), count(0) {}
+ Array() : array(nullptr) {}
template<int N> Array(const T (&array)[N]) : array(array), count(N) {}
T operator [](int index) const { return array[index]; }
const T *array;
- int count;
+ int count = 0;
};
typedef Array<int> IndexArray;
diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
index c2c2413c98..eb6eb62648 100644
--- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
+++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
@@ -1232,7 +1232,7 @@ class DateFormatter : public QObject
{
Q_OBJECT
public:
- DateFormatter() : QObject() {}
+ DateFormatter() {}
Q_INVOKABLE QString getLocalizedForm(const QString &isoTimestamp);
};
diff --git a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp
index 381ae98195..8811f779bb 100644
--- a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp
+++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp
@@ -46,21 +46,17 @@ class ExportedClass : public QObject
Q_PROPERTY(int v4BindingProp2 READ v4BindingProp2 NOTIFY v4BindingProp2Changed)
Q_PROPERTY(int scriptBindingProp READ scriptBindingProp NOTIFY scriptBindingPropChanged)
public:
- int qmlObjectPropConnections;
- int cppObjectPropConnections;
- int unboundPropConnections;
- int v8BindingPropConnections;
- int v4BindingPropConnections;
- int v4BindingProp2Connections;
- int scriptBindingPropConnections;
- int boundSignalConnections;
- int unusedSignalConnections;
-
- ExportedClass()
- : qmlObjectPropConnections(0), cppObjectPropConnections(0), unboundPropConnections(0),
- v8BindingPropConnections(0), v4BindingPropConnections(0), v4BindingProp2Connections(0),
- scriptBindingPropConnections(0), boundSignalConnections(0), unusedSignalConnections(0)
- {}
+ int qmlObjectPropConnections = 0;
+ int cppObjectPropConnections = 0;
+ int unboundPropConnections = 0;
+ int v8BindingPropConnections = 0;
+ int v4BindingPropConnections = 0;
+ int v4BindingProp2Connections = 0;
+ int scriptBindingPropConnections = 0;
+ int boundSignalConnections = 0;
+ int unusedSignalConnections = 0;
+
+ ExportedClass() {}
~ExportedClass()
{
@@ -141,9 +137,7 @@ class tst_qqmlnotifier : public QQmlDataTest
{
Q_OBJECT
public:
- tst_qqmlnotifier()
- : root(nullptr), exportedClass(nullptr), exportedObject(nullptr)
- {}
+ tst_qqmlnotifier() {}
private slots:
void initTestCase() override;
@@ -166,9 +160,9 @@ private:
void createObjects();
QQmlEngine engine;
- QObject *root;
- ExportedClass *exportedClass;
- ExportedClass *exportedObject;
+ QObject *root = nullptr;
+ ExportedClass *exportedClass = nullptr;
+ ExportedClass *exportedObject = nullptr;
};
void tst_qqmlnotifier::initTestCase()
diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
index 62a8cd117d..86229b95f3 100644
--- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
+++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
@@ -72,7 +72,6 @@ class LazyPropertyMap : public QQmlPropertyMap, public QQmlParserStatus
public:
LazyPropertyMap()
: QQmlPropertyMap(this, /*parent*/nullptr)
- , value(0)
{}
virtual void classBegin() {}
@@ -87,7 +86,7 @@ signals:
void someFixedPropertyChanged();
private:
- int value;
+ int value = 0;
};
void tst_QQmlPropertyMap::initTestCase()
@@ -313,7 +312,7 @@ class MyEnhancedPropertyMap : public QQmlPropertyMap
{
Q_OBJECT
public:
- MyEnhancedPropertyMap() : QQmlPropertyMap(this, nullptr), m_testSlotCalled(false) {}
+ MyEnhancedPropertyMap() : QQmlPropertyMap(this, nullptr) {}
bool testSlotCalled() const { return m_testSlotCalled; }
signals:
@@ -323,7 +322,7 @@ public slots:
void testSlot() { m_testSlotCalled = true; }
private:
- bool m_testSlotCalled;
+ bool m_testSlotCalled = false;
};
void tst_QQmlPropertyMap::metaObjectAccessibility()
diff --git a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp
index 12c3032eda..b353d23539 100644
--- a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp
+++ b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp
@@ -88,10 +88,7 @@ class CppObject : public QObject
public:
CppObject(QObject *parent = nullptr) : QObject(parent),
- m_intProperty(123),
- m_boolProperty(true),
- m_realProperty(1.23),
- m_doubleProperty(3.45),
+
m_stringProperty("foo"),
m_urlProperty("http://www.qt-project.org"),
m_objectProperty(keyValueMap("foo", "bar")),
@@ -127,10 +124,10 @@ signals:
void fontPropertyChanged(const QFont &arg);
private:
- int m_intProperty;
- bool m_boolProperty;
- qreal m_realProperty;
- double m_doubleProperty;
+ int m_intProperty = 123;
+ bool m_boolProperty = true;
+ qreal m_realProperty = 1.23;
+ double m_doubleProperty = 3.45;
QString m_stringProperty;
QUrl m_urlProperty;
QVariant m_varProperty;
diff --git a/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp b/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp
index 52e27af647..68ed22c01c 100644
--- a/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp
+++ b/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp
@@ -55,10 +55,7 @@ public:
};
public:
- CppObject()
- : QObject()
- , m_objectState(State0)
- {}
+ CppObject() {}
ObjectState objectState() const { return m_objectState; }
void setObjectState(ObjectState objectState) { m_objectState = objectState; emit objectStateChanged();}
@@ -68,7 +65,7 @@ signals:
void mySignal(int signalState);
private:
- ObjectState m_objectState;
+ ObjectState m_objectState = State0;
};
tst_qqmlstatemachine::tst_qqmlstatemachine()
diff --git a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp
index 64f804c200..4e42d02514 100644
--- a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp
+++ b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp
@@ -89,11 +89,9 @@ class TimerHelper : public QObject
{
Q_OBJECT
public:
- TimerHelper() : QObject(), count(0)
- {
- }
+ TimerHelper() { }
- int count;
+ int count = 0;
public slots:
void timeout() {
@@ -101,9 +99,7 @@ public slots:
}
};
-tst_qqmltimer::tst_qqmltimer()
-{
-}
+tst_qqmltimer::tst_qqmltimer() { }
void tst_qqmltimer::initTestCase()
{
diff --git a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
index 1f1be122f1..77fda3b555 100644
--- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
+++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
@@ -48,7 +48,7 @@ class tst_qquickfolderlistmodel : public QQmlDataTest
{
Q_OBJECT
public:
- tst_qquickfolderlistmodel() : removeStart(0), removeEnd(0) {}
+ tst_qquickfolderlistmodel() {}
public slots:
void removed(const QModelIndex &, int start, int end) {
@@ -78,8 +78,8 @@ private:
void checkNoErrors(const QQmlComponent& component);
QQmlEngine engine;
- int removeStart;
- int removeEnd;
+ int removeStart = 0;
+ int removeEnd = 0;
};
void tst_qquickfolderlistmodel::checkNoErrors(const QQmlComponent& component)
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