diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2020-06-17 14:06:11 +0200 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2020-06-18 12:46:17 +0200 |
commit | df1f4c9a9f3e3c60fdd43513fdc4926c0cbaa553 (patch) | |
tree | feb139f73c591a838684a68d247c1dc89c1c402e /tests/auto/qml/qmlformat/data | |
parent | 58ed7422f550d32b5ace9edc7a4887727f53493a (diff) |
qmlformat: Fix nested ifs
Fixes: QTBUG-85077
Change-Id: Ia2fec64a389fd7355f3fcf9438408b021c5abef4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlformat/data')
-rw-r--r-- | tests/auto/qml/qmlformat/data/nestedIf.formatted.qml | 29 | ||||
-rw-r--r-- | tests/auto/qml/qmlformat/data/nestedIf.qml | 30 |
2 files changed, 59 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlformat/data/nestedIf.formatted.qml b/tests/auto/qml/qmlformat/data/nestedIf.formatted.qml new file mode 100644 index 0000000000..6c17f18a9c --- /dev/null +++ b/tests/auto/qml/qmlformat/data/nestedIf.formatted.qml @@ -0,0 +1,29 @@ +Item { + Component.onCompleted: { + // Make sure that nested if statements get properly braced + if (a) { + if (b) + foo(); + else + bar(); + } else if (x == 3) { + stuff(); + } else { + foo_bar(); + } + // Same for "for" + if (a) { + for (x in y) { + bar(); + y(); + } + } + // ...and while + if (b) { + while (y in x) { + foo(); + x(); + } + } + } +} diff --git a/tests/auto/qml/qmlformat/data/nestedIf.qml b/tests/auto/qml/qmlformat/data/nestedIf.qml new file mode 100644 index 0000000000..9388dd42f6 --- /dev/null +++ b/tests/auto/qml/qmlformat/data/nestedIf.qml @@ -0,0 +1,30 @@ +Item { +Component.onCompleted: { + // Make sure that nested if statements get properly braced + if (a) { + if (b) + foo(); + else + bar(); + } else if (x == 3) + stuff(); + else + foo_bar(); + + // Same for "for" + if (a) { + for (x in y) { + bar(); + y(); + } + } + + // ...and while + if (b) { + while (y in x) { + foo(); + x(); + } + } +} +}
\ No newline at end of file |