##// END OF EJS Templates
Renamed QML QtQuick tests to match the naming convention
Tero Ahola -
r2228:c51862848e08
parent child
Show More
@@ -1,79 +1,79
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22 import QtQuickTest 1.0
23 23 import QtCommercial.Chart 1.1
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 name: "ChartView Properties"
31 name: "tst_qml-qtquicktest ChartView Properties"
32 32 when: windowShown
33 33
34 34 function test_chartViewProperties() {
35 35 compare(chartView.animationOptions, ChartView.NoAnimation, "ChartView.animationOptions");
36 36 verify(chartView.backgroundColor != undefined);
37 37 verify(chartView.bottomMargin > 0, "ChartView.bottomMargin");
38 38 verify(chartView.topMargin > 0, "ChartView.topMargin");
39 39 verify(chartView.leftMargin > 0, "ChartView.leftMargin");
40 40 verify(chartView.rightMargin > 0, "ChartView.rightMargin");
41 41 compare(chartView.count, 0, "ChartView.count");
42 42 compare(chartView.dropShadowEnabled, false, "ChartView.dropShadowEnabled");
43 43 verify(chartView.plotArea.height > 0, "ChartView.plotArea.height");
44 44 verify(chartView.plotArea.width > 0, "ChartView.plotArea.width");
45 45 verify(chartView.plotArea.x > 0, "ChartView.plotArea.x");
46 46 verify(chartView.plotArea.y > 0, "ChartView.plotArea.y");
47 47 compare(chartView.theme, ChartView.ChartThemeLight, "ChartView.theme");
48 48 compare(chartView.title, "", "ChartView.title");
49 49 compare(chartView.title, "", "ChartView.title");
50 50 verify(chartView.titleColor != undefined, "ChartView.titleColor");
51 51 compare(chartView.titleFont.bold, false, "ChartView.titleFont.bold");
52 52 // Legend
53 53 compare(chartView.legend.visible, true, "ChartView.legend.visible");
54 54 compare(chartView.legend.alignment, Qt.AlignTop, "ChartView.legend.alignment");
55 55 compare(chartView.legend.backgroundVisible, false, "ChartView.legend.backgroundVisible");
56 56 verify(chartView.legend.borderColor != undefined, "ChartView.legend.borderColor");
57 57 verify(chartView.legend.color != undefined, "ChartView.legend.color");
58 58 // Legend font
59 59 compare(chartView.legend.font.bold, false, "ChartView.legend.font.bold");
60 60 compare(chartView.legend.font.capitalization, Font.MixedCase, "ChartView.legend.font.capitalization");
61 61 compare(chartView.legend.font.family, "arial", "ChartView.legend.font.family");
62 62 compare(chartView.legend.font.italic, false, "ChartView.legend.font.italic");
63 63 compare(chartView.legend.font.letterSpacing, 0.0, "ChartView.legend.font.letterSpacing");
64 64 verify(chartView.legend.font.pixelSize > 0
65 65 && chartView.legend.font.pixelSize < 50, "ChartView.legend.font.pixelSize");
66 66 verify(chartView.legend.font.pointSize > 0
67 67 && chartView.legend.font.pointSize < 50, "ChartView.legend.font.pointSize");
68 68 compare(chartView.legend.font.strikeout, false, "ChartView.legend.font.strikeout");
69 69 compare(chartView.legend.font.underline, false, "ChartView.legend.font.underline");
70 70 compare(chartView.legend.font.weight, Font.Normal, "ChartView.legend.font.weight");
71 71 compare(chartView.legend.font.wordSpacing, 0.0, "ChartView.legend.font.wordSpacing");
72 72 }
73 73 }
74 74
75 75 ChartView {
76 76 id: chartView
77 77 anchors.fill: parent
78 78 }
79 79 }
@@ -1,158 +1,158
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22 import QtQuickTest 1.0
23 23 import QtCommercial.Chart 1.1
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 name: "ChartView Functions"
31 name: "tst_qml-qtquicktest ChartView Functions"
32 32 when: windowShown
33 33
34 34 function test_chartViewSeriesAndAxes() {
35 35 // Create XY series
36 36 var line = chartView.createSeries(ChartView.SeriesTypeLine, "line");
37 37 verify(line != null && line != undefined);
38 38 var spline = chartView.createSeries(ChartView.SeriesTypeSpline, "spline");
39 39 verify(spline != null && spline != undefined);
40 40 var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter");
41 41 verify(scatter != null && scatter != undefined);
42 42
43 43 // Create a series with specific axes
44 44 var line2 = chartView.createSeries(ChartView.SeriesTypeLine, "line2", chartView.axisX(line), chartView.axisY(line));
45 45
46 46 // Check that all the XY series use the same axes
47 47 verify(chartView.axisX(line) != null);
48 48 verify(chartView.axisY(line) != null);
49 49 compare(chartView.axisX(line), chartView.axisX(line2));
50 50 compare(chartView.axisY(line), chartView.axisY(line2));
51 51 compare(chartView.axisX(line), chartView.axisX(spline));
52 52 compare(chartView.axisY(line), chartView.axisY(spline));
53 53 compare(chartView.axisX(line), chartView.axisX(scatter));
54 54 compare(chartView.axisY(line), chartView.axisY(scatter));
55 55
56 56 var bar = chartView.createSeries(ChartView.SeriesTypeBar, "bar");
57 57 verify(bar != null && bar != undefined);
58 58 var stackedbar = chartView.createSeries(ChartView.SeriesTypeStackedBar, "stackedbar");
59 59 verify(stackedbar != null && stackedbar != undefined);
60 60 var percentbar = chartView.createSeries(ChartView.SeriesTypePercentBar, "percentbar");
61 61 verify(percentbar != null && percentbar != undefined);
62 62 var horizontalbar = chartView.createSeries(ChartView.SeriesTypeHorizontalBar, "horizontalbar");
63 63 verify(horizontalbar != null && horizontalbar != undefined);
64 64 var horizontalstackedbar = chartView.createSeries(ChartView.SeriesTypeHorizontalStackedBar, "horizontalstackedbar");
65 65 verify(horizontalstackedbar != null && horizontalstackedbar != undefined);
66 66 var horizontalpercentbar = chartView.createSeries(ChartView.SeriesTypeHorizontalPercentBar, "horizontalpercentbar");
67 67 verify(horizontalpercentbar != null && horizontalpercentbar != undefined);
68 68 var area = chartView.createSeries(ChartView.SeriesTypeArea, "area");
69 69 verify(area != null && area != undefined);
70 70
71 71 // Remove all series
72 72 chartView.removeAllSeries();
73 73 compare(chartView.count, 0);
74 74 }
75 75
76 76 function test_chartViewRange() {
77 77 // Set initial values
78 78 chartView.createSeries(ChartView.SeriesTypeLine, "line");
79 79 verify(chartView.axisX() != null);
80 80 verify(chartView.axisY() != null);
81 81 chartView.axisX().min = 1.0;
82 82 chartView.axisX().max = 2.0;
83 83 chartView.axisY().min = 1.0;
84 84 chartView.axisY().max = 2.0;
85 85
86 86 var xMax = chartView.axisX().max;
87 87 var xMin = chartView.axisX().min;
88 88 var yMax = chartView.axisY().max;
89 89 var yMin = chartView.axisY().min;
90 90
91 91 // zoom x 2.5
92 92 chartView.zoom(1.5);
93 93 verify(chartView.axisX().max < xMax);
94 94 verify(chartView.axisX().min > xMin);
95 95 verify(chartView.axisY().max < yMax);
96 96 verify(chartView.axisY().min > yMin);
97 97 xMax = chartView.axisX().max;
98 98 xMin = chartView.axisX().min;
99 99 yMax = chartView.axisY().max;
100 100 yMin = chartView.axisY().min;
101 101
102 102 // zoom x 0.5
103 103 chartView.zoom(0.5);
104 104 verify(chartView.axisX().max > xMax);
105 105 verify(chartView.axisX().min < xMin);
106 106 verify(chartView.axisY().max > yMax);
107 107 verify(chartView.axisY().min < yMin);
108 108 xMax = chartView.axisX().max;
109 109 xMin = chartView.axisX().min;
110 110 yMax = chartView.axisY().max;
111 111 yMin = chartView.axisY().min;
112 112
113 113 // Scroll up
114 114 chartView.scrollUp(10);
115 115 compare(chartView.axisX().max, xMax);
116 116 compare(chartView.axisX().min, xMin);
117 117 verify(chartView.axisY().max > yMax);
118 118 verify(chartView.axisY().min > yMin);
119 119 xMax = chartView.axisX().max;
120 120 xMin = chartView.axisX().min;
121 121 yMax = chartView.axisY().max;
122 122 yMin = chartView.axisY().min;
123 123
124 124 // Scroll down
125 125 chartView.scrollDown(10);
126 126 compare(chartView.axisX().max, xMax);
127 127 compare(chartView.axisX().min, xMin);
128 128 verify(chartView.axisY().max < yMax);
129 129 verify(chartView.axisY().min < yMin);
130 130 xMax = chartView.axisX().max;
131 131 xMin = chartView.axisX().min;
132 132 yMax = chartView.axisY().max;
133 133 yMin = chartView.axisY().min;
134 134
135 135 chartView.scrollLeft(10);
136 136 verify(chartView.axisX().max < xMax);
137 137 verify(chartView.axisX().min < xMin);
138 138 compare(chartView.axisY().max, yMax);
139 139 compare(chartView.axisY().min, yMin);
140 140 xMax = chartView.axisX().max;
141 141 xMin = chartView.axisX().min;
142 142 yMax = chartView.axisY().max;
143 143 yMin = chartView.axisY().min;
144 144
145 145 chartView.scrollRight(10);
146 146 verify(chartView.axisX().max > xMax);
147 147 verify(chartView.axisX().min > xMin);
148 148 compare(chartView.axisY().max, yMax);
149 149 compare(chartView.axisY().min, yMin);
150 150 }
151 151 }
152 152
153 153 ChartView {
154 154 id: chartView
155 155 anchors.fill: parent
156 156 title: "Chart"
157 157 }
158 158 }
@@ -1,73 +1,73
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22 import QtQuickTest 1.0
23 23 import QtCommercial.Chart 1.1
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 name: "ChartView Signals"
31 name: "tst_qml-qtquicktest ChartView Signals"
32 32 when: windowShown
33 33
34 34 // Verify onSeriesAdded and onSeriesRemoved signals
35 35 function test_chartView() {
36 36 var series = chartView.createSeries(ChartView.SeriesTypeLine, "line");
37 37 seriesAddedSpy.wait();
38 38 compare(seriesAddedSpy.count, 1, "ChartView.onSeriesAdded");
39 39
40 40 // Modifying layout triggers more than one plotAreaChanged signal
41 41 chartView.titleFont.pixelSize = 50;
42 42 verify(plotAreaChangedSpy.count > 0, "ChartView.onPlotAreaChanged");
43 43
44 44 chartView.removeSeries(series);
45 45 seriesRemovedSpy.wait();
46 46 compare(seriesRemovedSpy.count, 1, "ChartView.onSeriesAdded");
47 47 }
48 48 }
49 49
50 50 ChartView {
51 51 id: chartView
52 52 anchors.fill: parent
53 53 title: "Chart"
54 54
55 55 SignalSpy {
56 56 id: plotAreaChangedSpy
57 57 target: chartView
58 58 signalName: "plotAreaChanged"
59 59 }
60 60
61 61 SignalSpy {
62 62 id: seriesAddedSpy
63 63 target: chartView
64 64 signalName: "seriesAdded"
65 65 }
66 66
67 67 SignalSpy {
68 68 id: seriesRemovedSpy
69 69 target: chartView
70 70 signalName: "seriesRemoved"
71 71 }
72 72 }
73 73 }
@@ -1,131 +1,131
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22 import QtQuickTest 1.0
23 23 import QtCommercial.Chart 1.1
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 name: "PieSeries"
31 name: "tst_qml-qtquicktest PieSeries"
32 32 when: windowShown
33 33
34 34 function test_properties() {
35 35 compare(pieSeries.endAngle, 360);
36 36 compare(pieSeries.holeSize, 0);
37 37 compare(pieSeries.horizontalPosition, 0.5);
38 38 compare(pieSeries.size, 0.7);
39 39 compare(pieSeries.startAngle, 0);
40 40 compare(pieSeries.sum, 0);
41 41 compare(pieSeries.verticalPosition, 0.5);
42 42 }
43 43
44 44 function test_sliceproperties() {
45 45 var slice = pieSeries.append("slice", 10);
46 46 compare(slice.angleSpan, 360.0);
47 47 verify(slice.borderColor != undefined);
48 48 compare(slice.borderWidth, 0);
49 49 verify(slice.color != undefined);
50 50 compare(slice.explodeDistanceFactor, 0.15);
51 51 compare(slice.exploded, false);
52 52 compare(slice.label, "slice");
53 53 compare(slice.labelArmLengthFactor, 0.15);
54 54 verify(slice.labelColor != undefined);
55 55 compare(slice.labelFont.bold, false);
56 56 compare(slice.labelPosition, PieSlice.LabelOutside);
57 57 compare(slice.labelVisible, false);
58 58 compare(slice.percentage, 1.0);
59 59 compare(slice.startAngle, 0.0);
60 60 compare(slice.value, 10.0);
61 61 }
62 62
63 63 function test_append() {
64 64 addedSpy.clear();
65 65 countChangedSpy.clear();
66 66 sumChangedSpy.clear();
67 67 var count = 50;
68 68 for (var i = 0; i < count; i++)
69 69 pieSeries.append("slice" + i, Math.random());
70 70 compare(addedSpy.count, count);
71 71 compare(countChangedSpy.count, count);
72 72 compare(sumChangedSpy.count, count);
73 73 pieSeries.clear();
74 74 }
75 75
76 76 function test_remove() {
77 77 removedSpy.clear();
78 78 countChangedSpy.clear();
79 79 sumChangedSpy.clear();
80 80 var count = 50;
81 81 for (var i = 0; i < count; i++)
82 82 pieSeries.append("slice" + i, Math.random());
83 83 for (var j = 0; j < count; j++)
84 84 pieSeries.remove(pieSeries.at(0));
85 85 compare(removedSpy.count, count);
86 86 compare(countChangedSpy.count, 2 * count);
87 87 compare(sumChangedSpy.count, 2 * count);
88 88 compare(pieSeries.count, 0);
89 89 }
90 90
91 91 function test_find() {
92 92 var count = 50;
93 93 for (var i = 0; i < count; i++)
94 94 pieSeries.append("slice" + i, Math.random());
95 95 for (var j = 0; j < count; j++)
96 96 compare(pieSeries.find("slice" + j).label, "slice" + j);
97 97 pieSeries.clear();
98 98 }
99 99 }
100 100
101 101 ChartView {
102 102 id: chartView
103 103 anchors.fill: parent
104 104
105 105 PieSeries {
106 106 id: pieSeries
107 107 name: "pie"
108 108
109 109 SignalSpy {
110 110 id: addedSpy
111 111 target: pieSeries
112 112 signalName: "added"
113 113 }
114 114 SignalSpy {
115 115 id: removedSpy
116 116 target: pieSeries
117 117 signalName: "removed"
118 118 }
119 119 SignalSpy {
120 120 id: sumChangedSpy
121 121 target: pieSeries
122 122 signalName: "sumChanged"
123 123 }
124 124 SignalSpy {
125 125 id: countChangedSpy
126 126 target: pieSeries
127 127 signalName: "countChanged"
128 128 }
129 129 }
130 130 }
131 131 }
@@ -1,259 +1,259
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22 import QtQuickTest 1.0
23 23 import QtCommercial.Chart 1.1
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 name: "XY Series"
31 name: "tst_qml-qtquicktest XY Series"
32 32 when: windowShown
33 33
34 34 function test_properties() {
35 35 verify(lineSeries.color != undefined);
36 36 compare(lineSeries.pointsVisible, false);
37 37 // TODO: Should the properties be set or not?
38 38 // verify(lineSeries.axisX != null);
39 39 // verify(lineSeries.axisY != null);
40 40 compare(lineSeries.capStyle, Qt.SquareCap);
41 41 compare(lineSeries.style, Qt.SolidLine);
42 42 compare(lineSeries.width, 2.0);
43 43
44 44 verify(splineSeries.color != undefined);
45 45 compare(splineSeries.pointsVisible, false);
46 46 // TODO: Should the properties be set or not?
47 47 // verify(splineSeries.axisX != null);
48 48 // verify(splineSeries.axisY != null);
49 49 compare(splineSeries.capStyle, Qt.SquareCap);
50 50 compare(splineSeries.style, Qt.SolidLine);
51 51 compare(splineSeries.width, 2.0);
52 52
53 53 verify(scatterSeries.color != undefined);
54 54 // TODO: Should the properties be set or not?
55 55 // verify(scatterSeries.axisX != null);
56 56 // verify(scatterSeries.axisY != null);
57 57 verify(scatterSeries.borderColor != undefined);
58 58 compare(scatterSeries.borderWidth, 2.0);
59 59 compare(scatterSeries.markerShape, ScatterSeries.MarkerShapeCircle);
60 60 compare(scatterSeries.markerSize, 15.0);
61 61
62 62 verify(areaSeries.color != undefined);
63 63 verify(areaSeries.borderColor != undefined);
64 64 compare(areaSeries.borderWidth, 2.0);
65 65 }
66 66
67 67 function test_append() {
68 68 lineSeriesPointAddedSpy.clear();
69 69 splineSeriesPointAddedSpy.clear();
70 70 scatterSeriesPointAddedSpy.clear();
71 71 var count = append();
72 72 compare(lineSeries.count, count);
73 73 compare(splineSeries.count, count);
74 74 compare(scatterSeries.count, count);
75 75 tryCompare(lineSeriesPointAddedSpy.count, count);
76 76 tryCompare(splineSeriesPointAddedSpy.count, count);
77 77 tryCompare(scatterSeriesPointAddedSpy.count, count);
78 78 clear();
79 79 compare(lineSeries.count, 0);
80 80 compare(splineSeries.count, 0);
81 81 compare(scatterSeries.count, 0);
82 82 }
83 83
84 84 function test_replace() {
85 85 var count = append();
86 86 for (var i = 0; i < count; i++) {
87 87 lineSeries.replace(lineSeries.at(i).x, lineSeries.at(i).y, i, Math.random());
88 88 splineSeries.replace(splineSeries.at(i).x, splineSeries.at(i).y, i, Math.random());
89 89 scatterSeries.replace(scatterSeries.at(i).x, scatterSeries.at(i).y, i, Math.random());
90 90 }
91 91 compare(lineSeries.count, count);
92 92 compare(splineSeries.count, count);
93 93 compare(scatterSeries.count, count);
94 94 tryCompare(lineSeriesPointReplacedSpy.count, count);
95 95 tryCompare(splineSeriesPointReplacedSpy.count, count);
96 96 tryCompare(scatterSeriesPointReplacedSpy.count, count);
97 97 clear();
98 98 }
99 99
100 100 function test_insert() {
101 101 var count = append();
102 102 lineSeriesPointAddedSpy.clear();
103 103 splineSeriesPointAddedSpy.clear();
104 104 scatterSeriesPointAddedSpy.clear();
105 105 for (var i = 0; i < count; i++) {
106 106 lineSeries.insert(i * 2, i, Math.random());
107 107 splineSeries.insert(i * 2, i, Math.random());
108 108 scatterSeries.insert(i * 2, i, Math.random());
109 109 }
110 110 compare(lineSeries.count, count * 2);
111 111 compare(splineSeries.count, count * 2);
112 112 compare(scatterSeries.count, count * 2);
113 113 tryCompare(lineSeriesPointAddedSpy.count, count);
114 114 tryCompare(splineSeriesPointAddedSpy.count, count);
115 115 tryCompare(scatterSeriesPointAddedSpy.count, count);
116 116 clear();
117 117 }
118 118
119 119 function test_remove() {
120 120 lineSeriesPointRemovedSpy.clear();
121 121 splineSeriesPointRemovedSpy.clear();
122 122 scatterSeriesPointRemovedSpy.clear();
123 123 var count = append();
124 124 for (var i = 0; i < count; i++) {
125 125 lineSeries.remove(lineSeries.at(0).x, lineSeries.at(0).y);
126 126 splineSeries.remove(splineSeries.at(0).x, splineSeries.at(0).y);
127 127 scatterSeries.remove(scatterSeries.at(0).x, scatterSeries.at(0).y);
128 128 }
129 129 compare(lineSeries.count, 0);
130 130 compare(splineSeries.count, 0);
131 131 compare(scatterSeries.count, 0);
132 132 tryCompare(lineSeriesPointRemovedSpy.count, count);
133 133 tryCompare(splineSeriesPointRemovedSpy.count, count);
134 134 tryCompare(scatterSeriesPointRemovedSpy.count, count);
135 135 }
136 136
137 137 // Not a test function, called from test functions
138 138 function append() {
139 139 var count = 100;
140 140 chartView.axisX().min = 0;
141 141 chartView.axisX().max = 100;
142 142 chartView.axisY().min = 0;
143 143 chartView.axisY().max = 1;
144 144
145 145 for (var i = 0; i < count; i++) {
146 146 lineSeries.append(i, Math.random());
147 147 splineSeries.append(i, Math.random());
148 148 scatterSeries.append(i, Math.random());
149 149 }
150 150
151 151 return count;
152 152 }
153 153
154 154 // Not a test function, called from test functions
155 155 function clear() {
156 156 lineSeries.clear();
157 157 splineSeries.clear();
158 158 scatterSeries.clear();
159 159 }
160 160 }
161 161
162 162 ChartView {
163 163 id: chartView
164 164 anchors.fill: parent
165 165
166 166 LineSeries {
167 167 id: lineSeries
168 168 name: "line"
169 169
170 170 SignalSpy {
171 171 id: lineSeriesPointAddedSpy
172 172 target: lineSeries
173 173 signalName: "pointAdded"
174 174 }
175 175
176 176 SignalSpy {
177 177 id: lineSeriesPointReplacedSpy
178 178 target: lineSeries
179 179 signalName: "pointReplaced"
180 180 }
181 181
182 182 SignalSpy {
183 183 id: lineSeriesPointsReplacedSpy
184 184 target: lineSeries
185 185 signalName: "pointsReplaced"
186 186 }
187 187
188 188 SignalSpy {
189 189 id: lineSeriesPointRemovedSpy
190 190 target: lineSeries
191 191 signalName: "pointRemoved"
192 192 }
193 193 }
194 194
195 195 AreaSeries {
196 196 id: areaSeries
197 197 name: "area"
198 198 upperSeries: lineSeries
199 199 }
200 200
201 201 SplineSeries {
202 202 id: splineSeries
203 203 name: "spline"
204 204
205 205 SignalSpy {
206 206 id: splineSeriesPointAddedSpy
207 207 target: splineSeries
208 208 signalName: "pointAdded"
209 209 }
210 210
211 211 SignalSpy {
212 212 id: splineSeriesPointReplacedSpy
213 213 target: splineSeries
214 214 signalName: "pointReplaced"
215 215 }
216 216
217 217 SignalSpy {
218 218 id: splineSeriesPointsReplacedSpy
219 219 target: splineSeries
220 220 signalName: "pointsReplaced"
221 221 }
222 222
223 223 SignalSpy {
224 224 id: splineSeriesPointRemovedSpy
225 225 target: splineSeries
226 226 signalName: "pointRemoved"
227 227 }
228 228 }
229 229
230 230 ScatterSeries {
231 231 id: scatterSeries
232 232 name: "scatter"
233 233
234 234 SignalSpy {
235 235 id: scatterSeriesPointAddedSpy
236 236 target: scatterSeries
237 237 signalName: "pointAdded"
238 238 }
239 239
240 240 SignalSpy {
241 241 id: scatterSeriesPointReplacedSpy
242 242 target: scatterSeries
243 243 signalName: "pointReplaced"
244 244 }
245 245
246 246 SignalSpy {
247 247 id: scatterSeriesPointsReplacedSpy
248 248 target: scatterSeries
249 249 signalName: "pointsReplaced"
250 250 }
251 251
252 252 SignalSpy {
253 253 id: scatterSeriesPointRemovedSpy
254 254 target: scatterSeries
255 255 signalName: "pointRemoved"
256 256 }
257 257 }
258 258 }
259 259 }
General Comments 0
You need to be logged in to leave comments. Login now