aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qjsengine
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/qml/qjsengine
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/qml/qjsengine')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp28
1 files changed, 11 insertions, 17 deletions
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;