diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp b/tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp index 5a4411a1e9..82cefa729b 100644 --- a/tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp +++ b/tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp @@ -56,6 +56,9 @@ private Q_SLOTS: void functionDeclaration(); void functionExpression1(); void functionExpression2(); + void functionExpression3(); + void functionExpression4(); + void functionExpression5(); void propertyDeclarations(); void signalDeclarations(); void ifBinding1(); @@ -415,6 +418,76 @@ void tst_QMLCodeFormatter::functionExpression2() checkIndent(data); } +void tst_QMLCodeFormatter::functionExpression3() +{ + QList<Line> data; + data << Line("Rectangle {") + << Line(" function foo(a, b, c) {") + << Line(" var foo = {") + << Line(" bar: function() {") + << Line(" bar = 2") + << Line(" },") + << Line(" bar2: function()") + << Line(" {") + << Line(" bar = 2") + << Line(" }") + << Line(" }") + << Line(" Foo.proto.bar = function() {") + << Line(" bar = 2") + << Line(" }") + << Line(" Foo.proto.bar = function()") + << Line(" {") + << Line(" bar = 2") + << Line(" }") + << Line(" }") + << Line("}") + ; + checkIndent(data); +} + +void tst_QMLCodeFormatter::functionExpression4() +{ + QList<Line> data; + data << Line("Rectangle {") + << Line(" function foo(a, b, c) {") + << Line(" baz = function() {") + << Line(" bar = 2") + << Line(" }") + << Line(" baz = function()") + << Line(" {") + << Line(" bar = 2") + << Line(" }") + << Line(" var buz = new function() {") + << Line(" this.bar = function() {") + << Line(" bar = 2") + << Line(" }") + << Line(" this.bar = function()") + << Line(" {") + << Line(" bar = 2") + << Line(" }") + << Line(" }") + << Line(" }") + << Line("}") + ; + checkIndent(data); +} + +void tst_QMLCodeFormatter::functionExpression5() +{ + QList<Line> data; + data << Line("Rectangle {") + << Line(" property var foo: function() {") + << Line(" bar = 2") + << Line(" }") + << Line(" property var foo: function()") + << Line(" {") + << Line(" bar = 2") + << Line(" }") + << Line("}") + ; + checkIndent(data); +} + void tst_QMLCodeFormatter::propertyDeclarations() { QList<Line> data; |