aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlformat/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qmlformat/data')
-rw-r--r--tests/auto/qml/qmlformat/data/Annotations.formatted.nosort.qml106
-rw-r--r--tests/auto/qml/qmlformat/data/Annotations.formatted.qml106
-rw-r--r--tests/auto/qml/qmlformat/data/Annotations.qml76
-rw-r--r--tests/auto/qml/qmlformat/data/Example1.formatted.nosort.qml8
-rw-r--r--tests/auto/qml/qmlformat/data/Example1.formatted.qml8
-rw-r--r--tests/auto/qml/qmlformat/data/largeBindings.formatted.qml9
-rw-r--r--tests/auto/qml/qmlformat/data/largeBindings.qml11
-rw-r--r--tests/auto/qml/qmlformat/data/readOnlyProps.formatted.qml29
-rw-r--r--tests/auto/qml/qmlformat/data/readOnlyProps.qml15
-rw-r--r--tests/auto/qml/qmlformat/data/statesAndTransitions.formatted.qml16
-rw-r--r--tests/auto/qml/qmlformat/data/statesAndTransitions.qml10
11 files changed, 388 insertions, 6 deletions
diff --git a/tests/auto/qml/qmlformat/data/Annotations.formatted.nosort.qml b/tests/auto/qml/qmlformat/data/Annotations.formatted.nosort.qml
new file mode 100644
index 0000000000..a05c2125dc
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/Annotations.formatted.nosort.qml
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Charts module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![2]
+import QtQuick 2.0
+//![2]
+import QtCharts 2.0
+
+@Pippo {
+ atg1: 3
+}
+@Annotation2 {
+}
+Item {
+ //![1]
+
+ @AnnotateMore {
+ property int x: 5
+ }
+ @AnnotateALot {
+ }
+
+ property variant othersSlice: 0
+ @Annotate {
+ }
+
+ anchors.fill: parent
+ @SuperComplete {
+ binding: late
+ }
+ Component.onCompleted: {
+ // You can also manipulate slices dynamically, like append a slice or set a slice exploded
+ othersSlice = pieSeries.append("Others", 52);
+ pieSeries.find("Volkswagen").exploded = true;
+ }
+ //![1]
+ ChartView {
+ id: chart
+
+ title: "Top-5 car brand shares in Finland"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ @ExtraAnnotation {
+ signal pippo()
+ }
+ PieSeries {
+ id: pieSeries
+
+ PieSlice {
+ label: "Volkswagen"
+ value: 13.5
+ }
+
+ PieSlice {
+ label: "Toyota"
+ value: 10.9
+ }
+
+ PieSlice {
+ label: "Ford"
+ value: 8.6
+ }
+
+ PieSlice {
+ label: "Skoda"
+ value: 8.2
+ }
+
+ PieSlice {
+ label: "Volvo"
+ value: 6.8
+ }
+
+ }
+
+ }
+
+}
diff --git a/tests/auto/qml/qmlformat/data/Annotations.formatted.qml b/tests/auto/qml/qmlformat/data/Annotations.formatted.qml
new file mode 100644
index 0000000000..a142d4cb74
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/Annotations.formatted.qml
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Charts module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![2]
+import QtCharts 2.0
+//![2]
+import QtQuick 2.0
+
+@Pippo {
+ atg1: 3
+}
+@Annotation2 {
+}
+Item {
+ //![1]
+
+ @AnnotateMore {
+ property int x: 5
+ }
+ @AnnotateALot {
+ }
+
+ property variant othersSlice: 0
+ @Annotate {
+ }
+
+ anchors.fill: parent
+ @SuperComplete {
+ binding: late
+ }
+ Component.onCompleted: {
+ // You can also manipulate slices dynamically, like append a slice or set a slice exploded
+ othersSlice = pieSeries.append("Others", 52);
+ pieSeries.find("Volkswagen").exploded = true;
+ }
+ //![1]
+ ChartView {
+ id: chart
+
+ title: "Top-5 car brand shares in Finland"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ @ExtraAnnotation {
+ signal pippo()
+ }
+ PieSeries {
+ id: pieSeries
+
+ PieSlice {
+ label: "Volkswagen"
+ value: 13.5
+ }
+
+ PieSlice {
+ label: "Toyota"
+ value: 10.9
+ }
+
+ PieSlice {
+ label: "Ford"
+ value: 8.6
+ }
+
+ PieSlice {
+ label: "Skoda"
+ value: 8.2
+ }
+
+ PieSlice {
+ label: "Volvo"
+ value: 6.8
+ }
+
+ }
+
+ }
+
+}
diff --git a/tests/auto/qml/qmlformat/data/Annotations.qml b/tests/auto/qml/qmlformat/data/Annotations.qml
new file mode 100644
index 0000000000..2d3d7d2cfd
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/Annotations.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Charts module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![2]
+import QtQuick 2.0
+//![2]
+import QtCharts 2.0
+
+@Pippo{ atg1:3 }
+@Annotation2{}
+Item {
+ @Annotate{}
+ anchors.fill: parent
+ @AnnotateMore{
+ property int x: 5
+ }
+ @AnnotateALot{}
+ property variant othersSlice: 0
+
+ //![1]
+ ChartView {
+ id: chart
+ title: "Top-5 car brand shares in Finland"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+@ExtraAnnotation{
+ signal pippo
+}
+ PieSeries {
+ id: pieSeries
+ PieSlice { label: "Volkswagen"; value: 13.5 }
+ PieSlice { label: "Toyota"; value: 10.9 }
+ PieSlice { label: "Ford"; value: 8.6 }
+ PieSlice { label: "Skoda"; value: 8.2 }
+ PieSlice { label: "Volvo"; value: 6.8 }
+ }
+ }
+
+@SuperComplete{
+binding: late
+}
+ Component.onCompleted: {
+ // You can also manipulate slices dynamically, like append a slice or set a slice exploded
+ othersSlice = pieSeries.append("Others", 52.0);
+ pieSeries.find("Volkswagen").exploded = true;
+ }
+ //![1]
+}
diff --git a/tests/auto/qml/qmlformat/data/Example1.formatted.nosort.qml b/tests/auto/qml/qmlformat/data/Example1.formatted.nosort.qml
index 080cec438e..34d58cf571 100644
--- a/tests/auto/qml/qmlformat/data/Example1.formatted.nosort.qml
+++ b/tests/auto/qml/qmlformat/data/Example1.formatted.nosort.qml
@@ -91,11 +91,11 @@ Item {
x = 100;
break;
}
- if (x == 50)
+ if (x == 50)
console.log("true");
- else if (x == 50)
+ else if (x == 50)
console.log("other thing");
- else
+ else
console.log("false");
if (x == 50) {
@@ -132,6 +132,7 @@ Item {
Rectangle {
}
]
+
Text {
required property string batman
@@ -143,6 +144,7 @@ Item {
// This comment is related to the property animation
PropertyAnimation on x {
id: foo
+
x: 3
y: x + 3
}
diff --git a/tests/auto/qml/qmlformat/data/Example1.formatted.qml b/tests/auto/qml/qmlformat/data/Example1.formatted.qml
index 4b65b9add6..b06734eb0b 100644
--- a/tests/auto/qml/qmlformat/data/Example1.formatted.qml
+++ b/tests/auto/qml/qmlformat/data/Example1.formatted.qml
@@ -91,11 +91,11 @@ Item {
x = 100;
break;
}
- if (x == 50)
+ if (x == 50)
console.log("true");
- else if (x == 50)
+ else if (x == 50)
console.log("other thing");
- else
+ else
console.log("false");
if (x == 50) {
@@ -132,6 +132,7 @@ Item {
Rectangle {
}
]
+
Text {
required property string batman
@@ -143,6 +144,7 @@ Item {
// This comment is related to the property animation
PropertyAnimation on x {
id: foo
+
x: 3
y: x + 3
}
diff --git a/tests/auto/qml/qmlformat/data/largeBindings.formatted.qml b/tests/auto/qml/qmlformat/data/largeBindings.formatted.qml
new file mode 100644
index 0000000000..d8e4ffb087
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/largeBindings.formatted.qml
@@ -0,0 +1,9 @@
+QtObject {
+ small1: 3
+ small2: foo
+ // THIS NEEDS TO BE LAST
+ largeBinding: {
+ var x = 300;
+ console.log(x);
+ }
+}
diff --git a/tests/auto/qml/qmlformat/data/largeBindings.qml b/tests/auto/qml/qmlformat/data/largeBindings.qml
new file mode 100644
index 0000000000..a2249f6815
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/largeBindings.qml
@@ -0,0 +1,11 @@
+QtObject
+{
+ // THIS NEEDS TO BE LAST
+ largeBinding: {
+ var x = 300;
+ console.log(x);
+ }
+
+ small1: 3
+ small2: foo
+}
diff --git a/tests/auto/qml/qmlformat/data/readOnlyProps.formatted.qml b/tests/auto/qml/qmlformat/data/readOnlyProps.formatted.qml
new file mode 100644
index 0000000000..6e7cc31dcf
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/readOnlyProps.formatted.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+QtObject {
+ // Testing UiObjectBinding
+ readonly property Item
+ item: Item {
+ id: test
+
+ signal foo()
+ }
+ // End comment
+
+ // Testing UiArrayBinding
+ readonly property list<Item> array: [
+ Item {
+ id: test1
+
+ signal foo()
+ },
+ Item {
+ id: test2
+
+ signal bar()
+ }
+ ]
+ // Testing UiScriptBinding
+ readonly property int script: Math.sin(Math.PI)
+ property bool normalProperty: true
+}
diff --git a/tests/auto/qml/qmlformat/data/readOnlyProps.qml b/tests/auto/qml/qmlformat/data/readOnlyProps.qml
new file mode 100644
index 0000000000..8a32dd131e
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/readOnlyProps.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+QtObject {
+ // Testing UiObjectBinding
+ readonly property Item item: Item { id: test; signal foo() }
+ // End comment
+
+ // Testing UiArrayBinding
+ readonly property list<Item> array: [ Item { id: test1; signal foo() }, Item { id: test2; signal bar() } ]
+
+ // Testing UiScriptBinding
+ readonly property int script: Math.sin(Math.PI)
+
+ property bool normalProperty: true
+}
diff --git a/tests/auto/qml/qmlformat/data/statesAndTransitions.formatted.qml b/tests/auto/qml/qmlformat/data/statesAndTransitions.formatted.qml
new file mode 100644
index 0000000000..bd063ac498
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/statesAndTransitions.formatted.qml
@@ -0,0 +1,16 @@
+QtObject {
+ id: foo
+
+ // This needs to be *before* states and transitions after formatting
+ Item {
+ }
+
+ states: [
+ State {
+ }
+ ]
+ transitions: [
+ Transition {
+ }
+ ]
+}
diff --git a/tests/auto/qml/qmlformat/data/statesAndTransitions.qml b/tests/auto/qml/qmlformat/data/statesAndTransitions.qml
new file mode 100644
index 0000000000..648bdce6b9
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/statesAndTransitions.qml
@@ -0,0 +1,10 @@
+QtObject {
+ id: foo
+
+ states: [ State {} ]
+ transitions: [ Transition {} ]
+
+ // This needs to be *before* states and transitions after formatting
+ Item {}
+
+}