aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlformat
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2020-09-04 11:22:12 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2020-09-04 12:33:24 +0200
commit5d9b0d30df831649ceed58fee778bb37ac6f630e (patch)
tree0865b0f5b604989df379b93b98bc1f60d728e453 /tests/auto/qml/qmlformat
parent18b13c9126a3cbc32c616621802165591a5e2f5f (diff)
qmlformat: Fix multiline comment attachment
Pick-to: 5.15 Change-Id: I3ba8a4cd683df3309dd6df31b1fd426a0875f8fa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlformat')
-rw-r--r--tests/auto/qml/qmlformat/data/multilineComment.formatted.qml12
-rw-r--r--tests/auto/qml/qmlformat/data/multilineComment.qml10
-rw-r--r--tests/auto/qml/qmlformat/tst_qmlformat.cpp2
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlformat/data/multilineComment.formatted.qml b/tests/auto/qml/qmlformat/data/multilineComment.formatted.qml
new file mode 100644
index 0000000000..830ff32095
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/multilineComment.formatted.qml
@@ -0,0 +1,12 @@
+Item {
+ Item {
+ }
+
+ // This is a multiline comment.
+ // it should stay attached to Commented instead of getting orphaned.
+ //
+ // This should also stick to Commented
+ Commented {
+ }
+
+}
diff --git a/tests/auto/qml/qmlformat/data/multilineComment.qml b/tests/auto/qml/qmlformat/data/multilineComment.qml
new file mode 100644
index 0000000000..27439c41fa
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/multilineComment.qml
@@ -0,0 +1,10 @@
+Item {
+ Item {}
+
+ /* This is a multiline comment.
+ it should stay attached to Commented instead of getting orphaned.
+ */
+ // This should also stick to Commented
+ Commented {}
+
+}
diff --git a/tests/auto/qml/qmlformat/tst_qmlformat.cpp b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
index 1069ac448f..ad1d33336d 100644
--- a/tests/auto/qml/qmlformat/tst_qmlformat.cpp
+++ b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
@@ -229,6 +229,8 @@ void TestQmlformat::testFormat_data()
<< "QtBug85003.formatted.qml" << false << true;
QTest::newRow("nested functions") << "nestedFunctions.qml"
<< "nestedFunctions.formatted.qml" << false << true;
+ QTest::newRow("multiline comments") << "multilineComment.qml"
+ << "multilineComment.formatted.qml" << false << true;
}
void TestQmlformat::testFormat()