diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-21 11:52:59 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-26 13:08:30 +0000 |
commit | 06e962f263a86c4b66e1c6195b3d2615695fea1e (patch) | |
tree | 3669793f9983762538a9cb12a07ce49d461f066d /tests/auto/qml/animation | |
parent | 78e875e6dbd4991fe22c194d8608b3d66c96e036 (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/qml/animation')
5 files changed, 16 insertions, 23 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() |