diff options
author | Fawzi Mohamed <fawzi@gmx.ch> | 2021-09-03 11:13:07 +0200 |
---|---|---|
committer | Fawzi Mohamed <fawzi@gmx.ch> | 2021-11-09 00:03:09 +0100 |
commit | 7c5cba0f3c33dc53dff24bad5c11084a3ca81be4 (patch) | |
tree | 7284dc985bc32fb22d5899478130539b86d09677 /tests/auto/qml/qmlformat | |
parent | c84c7a31a5228385e35be807d0ebb030a74ed779 (diff) |
qmldom: improve newlines handling with AttributesSequence::Preserve
Improve the preservation of empty lines before an attribute
declaration when reformatting trying to preserve the original
attribute sequence.
Previously we inserted extra newlines when the type of object
attribute did change, in an attempt to create/preserve sections of
attributes with the same type.
The goal was not to change files following the coding guidelines too
much.
The problem was that it was invasive (might add a newline that was not
there), and actually incorrect for property declarations bound to a
value.
Tying to preserve the newlines in the input is actually a much better
policy.
Change-Id: I6bc95229cb7012243930b6b28aa457e331472de9
Pick-to: 6.2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlformat')
9 files changed, 6 insertions, 17 deletions
diff --git a/tests/auto/qml/qmlformat/data/Annotations.formatted.qml b/tests/auto/qml/qmlformat/data/Annotations.formatted.qml index 2fccb05e6e..ca58c90ecf 100644 --- a/tests/auto/qml/qmlformat/data/Annotations.formatted.qml +++ b/tests/auto/qml/qmlformat/data/Annotations.formatted.qml @@ -42,7 +42,6 @@ Item { @Annotate { } anchors.fill: parent - @AnnotateMore { property int x: 5 } @@ -57,7 +56,6 @@ Item { anchors.fill: parent legend.alignment: Qt.AlignBottom antialiasing: true - @ExtraAnnotation { signal pippo } @@ -90,7 +88,6 @@ Item { value: 6.8 } } - @SignalAnnotation { implicit: true } @@ -101,7 +98,6 @@ Item { function foo(x) { return 42; } - @BindingAnn { bType: 1 } @@ -125,7 +121,6 @@ Item { duration: 34 } } - @SuperComplete { binding: late } diff --git a/tests/auto/qml/qmlformat/data/Example1.formatted.2spaces.qml b/tests/auto/qml/qmlformat/data/Example1.formatted.2spaces.qml index 48a1acf483..8b181f607e 100644 --- a/tests/auto/qml/qmlformat/data/Example1.formatted.2spaces.qml +++ b/tests/auto/qml/qmlformat/data/Example1.formatted.2spaces.qml @@ -55,7 +55,6 @@ Item { // More orphans property variant some_array_literal: [30, 20, Math["PI"], [4, 3, 2], "foo", 0.3] - property bool something_computed: function (x) { const PI = 3, DAYS_PER_YEAR = 365.25; var x = 3 + 2; @@ -129,6 +128,7 @@ Item { }() default property bool some_default_bool: 500 % 5 !== 0 // some_default_bool + myFavouriteThings: [ // This is an orphan @@ -147,9 +147,7 @@ Item { Text { text: "Bla" - signal boo(int count, int times, real duration) - required property string batman } diff --git a/tests/auto/qml/qmlformat/data/Example1.formatted.qml b/tests/auto/qml/qmlformat/data/Example1.formatted.qml index a679e8a010..cb8865d94e 100644 --- a/tests/auto/qml/qmlformat/data/Example1.formatted.qml +++ b/tests/auto/qml/qmlformat/data/Example1.formatted.qml @@ -55,7 +55,6 @@ Item { // More orphans property variant some_array_literal: [30, 20, Math["PI"], [4, 3, 2], "foo", 0.3] - property bool something_computed: function (x) { const PI = 3, DAYS_PER_YEAR = 365.25; var x = 3 + 2; @@ -129,6 +128,7 @@ Item { }() default property bool some_default_bool: 500 % 5 !== 0 // some_default_bool + myFavouriteThings: [ // This is an orphan @@ -147,9 +147,7 @@ Item { Text { text: "Bla" - signal boo(int count, int times, real duration) - required property string batman } diff --git a/tests/auto/qml/qmlformat/data/Example1.formatted.tabs.qml b/tests/auto/qml/qmlformat/data/Example1.formatted.tabs.qml index 34b3467cb4..ef964f6f60 100644 --- a/tests/auto/qml/qmlformat/data/Example1.formatted.tabs.qml +++ b/tests/auto/qml/qmlformat/data/Example1.formatted.tabs.qml @@ -55,7 +55,6 @@ Item { // More orphans property variant some_array_literal: [30, 20, Math["PI"], [4, 3, 2], "foo", 0.3] - property bool something_computed: function (x) { const PI = 3, DAYS_PER_YEAR = 365.25; var x = 3 + 2; @@ -129,6 +128,7 @@ Item { }() default property bool some_default_bool: 500 % 5 !== 0 // some_default_bool + myFavouriteThings: [ // This is an orphan @@ -147,9 +147,7 @@ Item { Text { text: "Bla" - signal boo(int count, int times, real duration) - required property string batman } diff --git a/tests/auto/qml/qmlformat/data/largeBindings.formatted.qml b/tests/auto/qml/qmlformat/data/largeBindings.formatted.qml index 70283dade6..879bf297b2 100644 --- a/tests/auto/qml/qmlformat/data/largeBindings.formatted.qml +++ b/tests/auto/qml/qmlformat/data/largeBindings.formatted.qml @@ -7,6 +7,7 @@ QtObject { var x = 300; console.log(x); } + small1: 3 small2: foo smallButNeedsBraces: if (foo) { diff --git a/tests/auto/qml/qmlformat/data/nestedFunctions.formatted.qml b/tests/auto/qml/qmlformat/data/nestedFunctions.formatted.qml index 522e844201..5536ecf513 100644 --- a/tests/auto/qml/qmlformat/data/nestedFunctions.formatted.qml +++ b/tests/auto/qml/qmlformat/data/nestedFunctions.formatted.qml @@ -3,6 +3,7 @@ Item { function nested() {} foo(); } + function b() { function nested() {} bar(); diff --git a/tests/auto/qml/qmlformat/data/readOnlyProps.formatted.qml b/tests/auto/qml/qmlformat/data/readOnlyProps.formatted.qml index 3084ab7951..354f2ba979 100644 --- a/tests/auto/qml/qmlformat/data/readOnlyProps.formatted.qml +++ b/tests/auto/qml/qmlformat/data/readOnlyProps.formatted.qml @@ -6,7 +6,6 @@ QtObject { id: test signal foo } - // End comment // Testing UiArrayBinding diff --git a/tests/auto/qml/qmlformat/data/statesAndTransitions.formatted.qml b/tests/auto/qml/qmlformat/data/statesAndTransitions.formatted.qml index f72e9d8195..40cf5068da 100644 --- a/tests/auto/qml/qmlformat/data/statesAndTransitions.formatted.qml +++ b/tests/auto/qml/qmlformat/data/statesAndTransitions.formatted.qml @@ -1,5 +1,6 @@ QtObject { id: foo + states: [ State { } diff --git a/tests/auto/qml/qmlformat/data/verbatimString.formatted.qml b/tests/auto/qml/qmlformat/data/verbatimString.formatted.qml index 65539b538a..84abe38f88 100644 --- a/tests/auto/qml/qmlformat/data/verbatimString.formatted.qml +++ b/tests/auto/qml/qmlformat/data/verbatimString.formatted.qml @@ -1,8 +1,6 @@ Item { property string verbatim1: 'A "verbatim" string!' - property string verbatim2: "A 'verbatim' string\u2757" - property string verbatim3: `400 + 300 is ${400 + 300}. mutliline` |