@@ -0,0 +1,87 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | import QtQuick 1.0 | |
|
22 | import QtQuickTest 1.0 | |
|
23 | import QtCommercial.Chart 1.2 | |
|
24 | ||
|
25 | Rectangle { | |
|
26 | width: 400 | |
|
27 | height: 300 | |
|
28 | ||
|
29 | TestCase { | |
|
30 | id: tc1 | |
|
31 | name: "tst_qml-qtquicktest BarCategoryAxis" | |
|
32 | when: windowShown | |
|
33 | ||
|
34 | function test_minMax() { | |
|
35 | compare(barSeries1.axisX.min, "Jan", "AxisX min"); | |
|
36 | compare(barSeries1.axisX.max, "Jun", "AxisX max"); | |
|
37 | compare(barSeries1.axisY.min, 0, "AxisY min"); | |
|
38 | compare(barSeries1.axisY.max, 10, "AxisY max"); | |
|
39 | } | |
|
40 | ||
|
41 | function test_categories() { | |
|
42 | compare(barSeries1.axisX.count, 6, "AxisX count"); | |
|
43 | ||
|
44 | // Replace categories | |
|
45 | var cat = barSeries1.axisX.categories; | |
|
46 | barSeries1.axisX.categories = ["Tam", "Hel", "Maa", "Huh"]; | |
|
47 | compare(barSeries1.axisX.count, 4, "AxisX count"); | |
|
48 | compare(categoriesCountChangedSpy.count, 1, "onCountChanged"); | |
|
49 | compare(categoriesChangedSpy.count, 1, "onCategoriesChanged"); | |
|
50 | ||
|
51 | // Reset the original categories | |
|
52 | barSeries1.axisX.categories = cat; | |
|
53 | compare(barSeries1.axisX.count, 6, "AxisX count"); | |
|
54 | compare(categoriesCountChangedSpy.count, 2, "onCountChanged"); | |
|
55 | compare(categoriesChangedSpy.count, 2, "onCategoriesChanged"); | |
|
56 | } | |
|
57 | } | |
|
58 | ||
|
59 | ChartView { | |
|
60 | id: chartView | |
|
61 | anchors.fill: parent | |
|
62 | ||
|
63 | BarSeries { | |
|
64 | id: barSeries1 | |
|
65 | axisX: BarCategoryAxis { | |
|
66 | id: axisX | |
|
67 | categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ] | |
|
68 | } | |
|
69 | axisY: ValuesAxis { | |
|
70 | id: axisY | |
|
71 | min: 0 | |
|
72 | max: 10 | |
|
73 | } | |
|
74 | } | |
|
75 | ||
|
76 | SignalSpy { | |
|
77 | id: categoriesCountChangedSpy | |
|
78 | target: axisX | |
|
79 | signalName: "countChanged" | |
|
80 | } | |
|
81 | SignalSpy { | |
|
82 | id: categoriesChangedSpy | |
|
83 | target: axisX | |
|
84 | signalName: "categoriesChanged" | |
|
85 | } | |
|
86 | } | |
|
87 | } |
@@ -0,0 +1,87 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | import QtQuick 1.0 | |
|
22 | import QtQuickTest 1.0 | |
|
23 | import QtCommercial.Chart 1.1 | |
|
24 | ||
|
25 | Rectangle { | |
|
26 | width: 400 | |
|
27 | height: 300 | |
|
28 | ||
|
29 | TestCase { | |
|
30 | id: tc1 | |
|
31 | name: "tst_qml-qtquicktest BarCategoryAxis 1.1" | |
|
32 | when: windowShown | |
|
33 | ||
|
34 | function test_minMax() { | |
|
35 | compare(barSeries1.axisX.min, "Jan", "AxisX min"); | |
|
36 | compare(barSeries1.axisX.max, "Jun", "AxisX max"); | |
|
37 | compare(barSeries1.axisY.min, 0, "AxisY min"); | |
|
38 | compare(barSeries1.axisY.max, 10, "AxisY max"); | |
|
39 | } | |
|
40 | ||
|
41 | function test_categories() { | |
|
42 | compare(barSeries1.axisX.count, 6, "AxisX count"); | |
|
43 | ||
|
44 | // Replace categories | |
|
45 | var cat = barSeries1.axisX.categories; | |
|
46 | barSeries1.axisX.categories = ["Tam", "Hel", "Maa", "Huh"]; | |
|
47 | compare(barSeries1.axisX.count, 4, "AxisX count"); | |
|
48 | compare(categoriesCountChangedSpy.count, 1, "onCountChanged"); | |
|
49 | compare(categoriesChangedSpy.count, 1, "onCategoriesChanged"); | |
|
50 | ||
|
51 | // Reset the original categories | |
|
52 | barSeries1.axisX.categories = cat; | |
|
53 | compare(barSeries1.axisX.count, 6, "AxisX count"); | |
|
54 | compare(categoriesCountChangedSpy.count, 2, "onCountChanged"); | |
|
55 | compare(categoriesChangedSpy.count, 2, "onCategoriesChanged"); | |
|
56 | } | |
|
57 | } | |
|
58 | ||
|
59 | ChartView { | |
|
60 | id: chartView | |
|
61 | anchors.fill: parent | |
|
62 | ||
|
63 | BarSeries { | |
|
64 | id: barSeries1 | |
|
65 | axisX: BarCategoryAxis { | |
|
66 | id: axisX | |
|
67 | categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ] | |
|
68 | } | |
|
69 | axisY: ValuesAxis { | |
|
70 | id: axisY | |
|
71 | min: 0 | |
|
72 | max: 10 | |
|
73 | } | |
|
74 | } | |
|
75 | ||
|
76 | SignalSpy { | |
|
77 | id: categoriesCountChangedSpy | |
|
78 | target: axisX | |
|
79 | signalName: "countChanged" | |
|
80 | } | |
|
81 | SignalSpy { | |
|
82 | id: categoriesChangedSpy | |
|
83 | target: axisX | |
|
84 | signalName: "categoriesChanged" | |
|
85 | } | |
|
86 | } | |
|
87 | } |
@@ -0,0 +1,84 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | import QtQuick 1.0 | |
|
22 | import QtQuickTest 1.0 | |
|
23 | import QtCommercial.Chart 1.1 | |
|
24 | ||
|
25 | Rectangle { | |
|
26 | width: 400 | |
|
27 | height: 300 | |
|
28 | ||
|
29 | TestCase { | |
|
30 | id: tc1 | |
|
31 | name: "tst_qml-qtquicktest CategoryAxis 1.1" | |
|
32 | when: windowShown | |
|
33 | ||
|
34 | function test_minMax() { | |
|
35 | compare(lineSeries1.axisX.min, 0, "AxisX min"); | |
|
36 | compare(lineSeries1.axisX.max, 10, "AxisX max"); | |
|
37 | compare(lineSeries1.axisY.min, 0, "AxisY min"); | |
|
38 | compare(lineSeries1.axisY.max, 10, "AxisY max"); | |
|
39 | } | |
|
40 | ||
|
41 | function test_categories() { | |
|
42 | compare(lineSeries1.axisY.startValue, 0, "AxisY start value"); | |
|
43 | compare(lineSeries1.axisY.count, 3, "AxisY count"); | |
|
44 | compare(lineSeries1.axisY.categoriesLabels[0], "label0", "AxisY categories labels"); | |
|
45 | compare(lineSeries1.axisY.categoriesLabels[1], "label1", "AxisY categories labels"); | |
|
46 | compare(lineSeries1.axisY.categoriesLabels[2], "label2", "AxisY categories labels"); | |
|
47 | } | |
|
48 | } | |
|
49 | ||
|
50 | ChartView { | |
|
51 | id: chartView | |
|
52 | anchors.fill: parent | |
|
53 | ||
|
54 | LineSeries { | |
|
55 | id: lineSeries1 | |
|
56 | axisX: ValuesAxis { | |
|
57 | id: axisX | |
|
58 | min: 0 | |
|
59 | max: 10 | |
|
60 | } | |
|
61 | axisY: CategoryAxis { | |
|
62 | id: axisY | |
|
63 | min: 0 | |
|
64 | max: 10 | |
|
65 | startValue: 0 | |
|
66 | CategoryRange { | |
|
67 | label: "label0" | |
|
68 | endValue: 1 | |
|
69 | } | |
|
70 | CategoryRange { | |
|
71 | label: "label1" | |
|
72 | endValue: 3 | |
|
73 | } | |
|
74 | CategoryRange { | |
|
75 | label: "label2" | |
|
76 | endValue: 10 | |
|
77 | } | |
|
78 | } | |
|
79 | XYPoint { x: -1; y: -1 } | |
|
80 | XYPoint { x: 0; y: 0 } | |
|
81 | XYPoint { x: 5; y: 5 } | |
|
82 | } | |
|
83 | } | |
|
84 | } |
@@ -0,0 +1,102 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | import QtQuick 1.0 | |
|
22 | import QtQuickTest 1.0 | |
|
23 | import QtCommercial.Chart 1.2 | |
|
24 | ||
|
25 | Rectangle { | |
|
26 | width: 400 | |
|
27 | height: 300 | |
|
28 | ||
|
29 | TestCase { | |
|
30 | id: tc1 | |
|
31 | name: "tst_qml-qtquicktest ValueAxis" | |
|
32 | when: windowShown | |
|
33 | ||
|
34 | function test_defaultPropertyValues() { | |
|
35 | compare(lineSeries1.axisX.min, 0, "AxisX min"); | |
|
36 | compare(lineSeries1.axisX.max, 10, "AxisX max"); | |
|
37 | compare(lineSeries1.axisY.min, 0, "AxisY min"); | |
|
38 | compare(lineSeries1.axisY.max, 10, "AxisY max"); | |
|
39 | verify(axisX.tickCount > 0, "AxisX tick count"); | |
|
40 | verify(axisY.tickCount > 0, "AxisX tick count"); | |
|
41 | compare(axisX.niceNumbersEnabled, false, "nice numbers"); | |
|
42 | compare(axisX.labelFormat, "", "label format"); | |
|
43 | } | |
|
44 | ||
|
45 | function test_modifyProperties() { | |
|
46 | lineSeries1.axisX.tickCount = 3; | |
|
47 | compare(lineSeries1.axisX.tickCount, 3, "set tick count"); | |
|
48 | ||
|
49 | lineSeries1.axisX.niceNumbersEnabled = true; | |
|
50 | compare(axisX.niceNumbersEnabled, true, "nice numbers"); | |
|
51 | } | |
|
52 | ||
|
53 | function test_signals() { | |
|
54 | axisX.min = 2; | |
|
55 | compare(minChangedSpy.count, 1, "onMinChanged"); | |
|
56 | compare(maxChangedSpy.count, 0, "onMaxChanged"); | |
|
57 | ||
|
58 | axisX.max = 8; | |
|
59 | compare(minChangedSpy.count, 1, "onMinChanged"); | |
|
60 | compare(maxChangedSpy.count, 1, "onMaxChanged"); | |
|
61 | ||
|
62 | // restore original values | |
|
63 | axisX.min = 0; | |
|
64 | axisX.max = 10; | |
|
65 | compare(minChangedSpy.count, 2, "onMinChanged"); | |
|
66 | compare(maxChangedSpy.count, 2, "onMaxChanged"); | |
|
67 | } | |
|
68 | } | |
|
69 | ||
|
70 | ChartView { | |
|
71 | id: chartView | |
|
72 | anchors.fill: parent | |
|
73 | ||
|
74 | LineSeries { | |
|
75 | id: lineSeries1 | |
|
76 | axisX: ValueAxis { | |
|
77 | id: axisX | |
|
78 | min: 0 | |
|
79 | max: 10 | |
|
80 | } | |
|
81 | axisY: ValueAxis { | |
|
82 | id: axisY | |
|
83 | min: 0 | |
|
84 | max: 10 | |
|
85 | } | |
|
86 | XYPoint { x: -1; y: -1 } | |
|
87 | XYPoint { x: 0; y: 0 } | |
|
88 | XYPoint { x: 5; y: 5 } | |
|
89 | } | |
|
90 | ||
|
91 | SignalSpy { | |
|
92 | id: minChangedSpy | |
|
93 | target: axisX | |
|
94 | signalName: "minChanged" | |
|
95 | } | |
|
96 | SignalSpy { | |
|
97 | id: maxChangedSpy | |
|
98 | target: axisX | |
|
99 | signalName: "maxChanged" | |
|
100 | } | |
|
101 | } | |
|
102 | } |
@@ -126,6 +126,7 public: | |||
|
126 | 126 | qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries"); |
|
127 | 127 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries"); |
|
128 | 128 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet"); |
|
129 | qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis"); | |
|
129 | 130 | #ifndef QT_ON_ARM |
|
130 | 131 | qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis"); |
|
131 | 132 | #endif |
@@ -100,11 +100,20 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
100 | 100 | Defines the maximum value on the axis. |
|
101 | 101 | */ |
|
102 | 102 | |
|
103 | /*! | |
|
104 | \property QBarCategoryAxis::count | |
|
105 | The count of categories. | |
|
106 | */ | |
|
107 | /*! | |
|
108 | \qmlproperty int BarCategoryAxis::count | |
|
109 | The count of categories. | |
|
110 | */ | |
|
103 | 111 | |
|
104 | 112 | /*! |
|
105 | 113 | \fn void QBarCategoryAxis::categoriesChanged() |
|
106 | 114 | Axis emits signal when the categories of the axis has changed. |
|
107 | 115 | */ |
|
116 | ||
|
108 | 117 | /*! |
|
109 | 118 | \fn void QBarCategoryAxis::minChanged(const QString &min) |
|
110 | 119 | Axis emits signal when \a min of axis has changed. |
@@ -124,6 +133,15 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
124 | 133 | */ |
|
125 | 134 | |
|
126 | 135 | /*! |
|
136 | \fn void QBarCategoryAxis::countChanged() | |
|
137 | Axis emits signal when the count of categories has changed. | |
|
138 | */ | |
|
139 | /*! | |
|
140 | \qmlsignal BarCategoryAxis::onCountChanged() | |
|
141 | Axis emits signal when the count of categories has changed. | |
|
142 | */ | |
|
143 | ||
|
144 | /*! | |
|
127 | 145 | \fn void QBarCategoryAxis::rangeChanged(const QString &min, const QString &max) |
|
128 | 146 | Axis emits signal when \a min or \a max of axis has changed. |
|
129 | 147 | */ |
@@ -184,6 +202,7 void QBarCategoryAxis::append(const QStringList &categories) | |||
|
184 | 202 | setRange(d->m_minCategory, d->m_categories.last()); |
|
185 | 203 | |
|
186 | 204 | emit categoriesChanged(); |
|
205 | emit countChanged(); | |
|
187 | 206 | } |
|
188 | 207 | |
|
189 | 208 | /*! |
@@ -209,6 +228,7 void QBarCategoryAxis::append(const QString &category) | |||
|
209 | 228 | setRange(d->m_minCategory, d->m_categories.last()); |
|
210 | 229 | |
|
211 | 230 | emit categoriesChanged(); |
|
231 | emit countChanged(); | |
|
212 | 232 | } |
|
213 | 233 | |
|
214 | 234 | /*! |
@@ -234,6 +254,7 void QBarCategoryAxis::remove(const QString &category) | |||
|
234 | 254 | setRange(QString::null, QString::null); |
|
235 | 255 | } |
|
236 | 256 | emit categoriesChanged(); |
|
257 | emit countChanged(); | |
|
237 | 258 | } |
|
238 | 259 | } |
|
239 | 260 | |
@@ -265,11 +286,12 void QBarCategoryAxis::insert(int index, const QString &category) | |||
|
265 | 286 | } |
|
266 | 287 | |
|
267 | 288 | emit categoriesChanged(); |
|
289 | emit countChanged(); | |
|
268 | 290 | } |
|
269 | 291 | |
|
270 | 292 | /*! |
|
271 | 293 | Replaces \a oldCategory with \a newCategory. If \a oldCategory does not exits on the axis nothing is done. |
|
272 |
A \a new |
|
|
294 | A \a newCategory has to be valid QStrings and can not be duplicated. In case of replacing minimum or maximum category, | |
|
273 | 295 | minimum and maximum of axis is updated accordingly. |
|
274 | 296 | */ |
|
275 | 297 | void QBarCategoryAxis::replace(const QString &oldCategory, const QString &newCategory) |
@@ -288,6 +310,7 void QBarCategoryAxis::replace(const QString &oldCategory, const QString &newCat | |||
|
288 | 310 | d->emitUpdated(); |
|
289 | 311 | } |
|
290 | 312 | emit categoriesChanged(); |
|
313 | emit countChanged(); | |
|
291 | 314 | } |
|
292 | 315 | } |
|
293 | 316 | |
@@ -300,6 +323,7 void QBarCategoryAxis::clear() | |||
|
300 | 323 | d->m_categories.clear(); |
|
301 | 324 | setRange(QString::null, QString::null); |
|
302 | 325 | emit categoriesChanged(); |
|
326 | emit countChanged(); | |
|
303 | 327 | } |
|
304 | 328 | |
|
305 | 329 | /*! |
@@ -33,6 +33,7 class QTCOMMERCIALCHART_EXPORT QBarCategoryAxis : public QAbstractAxis | |||
|
33 | 33 | Q_PROPERTY(QStringList categories READ categories WRITE setCategories NOTIFY categoriesChanged) |
|
34 | 34 | Q_PROPERTY(QString min READ min WRITE setMin NOTIFY minChanged) |
|
35 | 35 | Q_PROPERTY(QString max READ max WRITE setMax NOTIFY maxChanged) |
|
36 | Q_PROPERTY(int count READ count NOTIFY countChanged) | |
|
36 | 37 | |
|
37 | 38 | public: |
|
38 | 39 | explicit QBarCategoryAxis(QObject *parent = 0); |
@@ -66,6 +67,7 Q_SIGNALS: | |||
|
66 | 67 | void minChanged(const QString &min); |
|
67 | 68 | void maxChanged(const QString &max); |
|
68 | 69 | void rangeChanged(const QString &min, const QString &max); |
|
70 | void countChanged(); | |
|
69 | 71 | |
|
70 | 72 | private: |
|
71 | 73 | Q_DECLARE_PRIVATE(QBarCategoryAxis) |
@@ -84,6 +84,24 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
84 | 84 | */ |
|
85 | 85 | |
|
86 | 86 | /*! |
|
87 | \property QCategoryAxis::count | |
|
88 | The count of categories. | |
|
89 | */ | |
|
90 | /*! | |
|
91 | \qmlproperty int CategoryAxis::count | |
|
92 | The count of categories. | |
|
93 | */ | |
|
94 | ||
|
95 | /*! | |
|
96 | \property QCategoryAxis::categoriesLabels | |
|
97 | The category labels as a string list. | |
|
98 | */ | |
|
99 | /*! | |
|
100 | \qmlproperty StringList CategoryAxis::categoriesLabels | |
|
101 | The category labels as a list of strings. | |
|
102 | */ | |
|
103 | ||
|
104 | /*! | |
|
87 | 105 | Constructs an axis object which is a child of \a parent. |
|
88 | 106 | */ |
|
89 | 107 | QCategoryAxis::QCategoryAxis(QObject *parent): |
@@ -175,6 +175,7 void tst_QBarCategoriesAxis::append() | |||
|
175 | 175 | QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString))); |
|
176 | 176 | QSignalSpy spy2(&axis, SIGNAL(minChanged(QString))); |
|
177 | 177 | QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString))); |
|
178 | QSignalSpy spy4(&axis, SIGNAL(countChanged())); | |
|
178 | 179 | |
|
179 | 180 | axis.append(categories); |
|
180 | 181 | |
@@ -192,6 +193,7 void tst_QBarCategoriesAxis::append() | |||
|
192 | 193 | QCOMPARE(spy1.count(), 1); |
|
193 | 194 | QCOMPARE(spy2.count(), 1); |
|
194 | 195 | QCOMPARE(spy3.count(), 1); |
|
196 | QCOMPARE(spy4.count(), 1); | |
|
195 | 197 | } |
|
196 | 198 | |
|
197 | 199 | void tst_QBarCategoriesAxis::append2_data() |
@@ -211,6 +213,7 void tst_QBarCategoriesAxis::append2() | |||
|
211 | 213 | QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString))); |
|
212 | 214 | QSignalSpy spy2(&axis, SIGNAL(minChanged(QString))); |
|
213 | 215 | QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString))); |
|
216 | QSignalSpy spy4(&axis, SIGNAL(countChanged())); | |
|
214 | 217 | |
|
215 | 218 | foreach(QString category, categories) |
|
216 | 219 | axis.append(category); |
@@ -229,6 +232,7 void tst_QBarCategoriesAxis::append2() | |||
|
229 | 232 | QCOMPARE(spy1.count(), categories.count()); |
|
230 | 233 | QCOMPARE(spy2.count(), 1); |
|
231 | 234 | QCOMPARE(spy3.count(), categories.count()); |
|
235 | QCOMPARE(spy4.count(), categories.count()); | |
|
232 | 236 | } |
|
233 | 237 | |
|
234 | 238 | void tst_QBarCategoriesAxis::at_data() |
@@ -254,6 +258,7 void tst_QBarCategoriesAxis::at() | |||
|
254 | 258 | QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString))); |
|
255 | 259 | QSignalSpy spy2(&axis, SIGNAL(minChanged(QString))); |
|
256 | 260 | QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString))); |
|
261 | QSignalSpy spy4(&axis, SIGNAL(countChanged())); | |
|
257 | 262 | |
|
258 | 263 | QCOMPARE(axis.at(index), string); |
|
259 | 264 | |
@@ -271,6 +276,7 void tst_QBarCategoriesAxis::at() | |||
|
271 | 276 | QCOMPARE(spy1.count(), 0); |
|
272 | 277 | QCOMPARE(spy2.count(), 0); |
|
273 | 278 | QCOMPARE(spy3.count(), 0); |
|
279 | QCOMPARE(spy4.count(), 0); | |
|
274 | 280 | } |
|
275 | 281 | |
|
276 | 282 | void tst_QBarCategoriesAxis::categories_data() |
@@ -289,6 +295,7 void tst_QBarCategoriesAxis::categories() | |||
|
289 | 295 | QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString))); |
|
290 | 296 | QSignalSpy spy2(&axis, SIGNAL(minChanged(QString))); |
|
291 | 297 | QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString))); |
|
298 | QSignalSpy spy4(&axis, SIGNAL(countChanged())); | |
|
292 | 299 | |
|
293 | 300 | axis.setCategories(categories); |
|
294 | 301 | QCOMPARE(axis.categories(), categories); |
@@ -307,7 +314,7 void tst_QBarCategoriesAxis::categories() | |||
|
307 | 314 | QCOMPARE(spy1.count(), 1); |
|
308 | 315 | QCOMPARE(spy2.count(), 1); |
|
309 | 316 | QCOMPARE(spy3.count(), 1); |
|
310 | ||
|
317 | QCOMPARE(spy4.count(), 1); | |
|
311 | 318 | } |
|
312 | 319 | |
|
313 | 320 | void tst_QBarCategoriesAxis::clear_data() |
@@ -329,6 +336,7 void tst_QBarCategoriesAxis::clear() | |||
|
329 | 336 | QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString))); |
|
330 | 337 | QSignalSpy spy2(&axis, SIGNAL(minChanged(QString))); |
|
331 | 338 | QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString))); |
|
339 | QSignalSpy spy4(&axis, SIGNAL(countChanged())); | |
|
332 | 340 | |
|
333 | 341 | axis.clear(); |
|
334 | 342 | QCOMPARE(axis.categories(), QStringList()); |
@@ -353,6 +361,7 void tst_QBarCategoriesAxis::clear() | |||
|
353 | 361 | QCOMPARE(spy1.count(), 3); |
|
354 | 362 | QCOMPARE(spy2.count(), 3); |
|
355 | 363 | QCOMPARE(spy3.count(), 3); |
|
364 | QCOMPARE(spy4.count(), 3); | |
|
356 | 365 | } |
|
357 | 366 | |
|
358 | 367 | void tst_QBarCategoriesAxis::count_data() |
@@ -375,6 +384,7 void tst_QBarCategoriesAxis::count() | |||
|
375 | 384 | QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString))); |
|
376 | 385 | QSignalSpy spy2(&axis, SIGNAL(minChanged(QString))); |
|
377 | 386 | QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString))); |
|
387 | QSignalSpy spy4(&axis, SIGNAL(countChanged())); | |
|
378 | 388 | |
|
379 | 389 | QCOMPARE(axis.count(), count); |
|
380 | 390 | |
@@ -382,6 +392,7 void tst_QBarCategoriesAxis::count() | |||
|
382 | 392 | QCOMPARE(spy1.count(), 0); |
|
383 | 393 | QCOMPARE(spy2.count(), 0); |
|
384 | 394 | QCOMPARE(spy3.count(), 0); |
|
395 | QCOMPARE(spy4.count(), 0); | |
|
385 | 396 | |
|
386 | 397 | m_chart->setAxisX(&axis, m_series); |
|
387 | 398 | m_view->show(); |
@@ -411,6 +422,7 void tst_QBarCategoriesAxis::insert() | |||
|
411 | 422 | QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString))); |
|
412 | 423 | QSignalSpy spy2(&axis, SIGNAL(minChanged(QString))); |
|
413 | 424 | QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString))); |
|
425 | QSignalSpy spy4(&axis, SIGNAL(countChanged())); | |
|
414 | 426 | |
|
415 | 427 | axis.insert(index, category); |
|
416 | 428 | QCOMPARE(axis.at(index),category); |
@@ -419,6 +431,7 void tst_QBarCategoriesAxis::insert() | |||
|
419 | 431 | QCOMPARE(spy1.count(), 0); |
|
420 | 432 | QCOMPARE(spy2.count(), 0); |
|
421 | 433 | QCOMPARE(spy3.count(), 0); |
|
434 | QCOMPARE(spy4.count(), 1); | |
|
422 | 435 | |
|
423 | 436 | m_chart->setAxisX(&axis, m_series); |
|
424 | 437 | m_view->show(); |
@@ -451,6 +464,7 void tst_QBarCategoriesAxis::remove() | |||
|
451 | 464 | QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString))); |
|
452 | 465 | QSignalSpy spy2(&axis, SIGNAL(minChanged(QString))); |
|
453 | 466 | QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString))); |
|
467 | QSignalSpy spy4(&axis, SIGNAL(countChanged())); | |
|
454 | 468 | |
|
455 | 469 | axis.remove(category); |
|
456 | 470 | QCOMPARE(axis.categories(),result); |
@@ -459,6 +473,7 void tst_QBarCategoriesAxis::remove() | |||
|
459 | 473 | QCOMPARE(spy1.count(), maxCount); |
|
460 | 474 | QCOMPARE(spy2.count(), minCount); |
|
461 | 475 | QCOMPARE(spy3.count(), rangeCount); |
|
476 | QCOMPARE(spy4.count(), 1); | |
|
462 | 477 | } |
|
463 | 478 | |
|
464 | 479 | void tst_QBarCategoriesAxis::max_raw_data() |
@@ -478,6 +493,7 void tst_QBarCategoriesAxis::max_raw() | |||
|
478 | 493 | QSignalSpy spy1(m_baraxis, SIGNAL(maxChanged(QString))); |
|
479 | 494 | QSignalSpy spy2(m_baraxis, SIGNAL(minChanged(QString))); |
|
480 | 495 | QSignalSpy spy3(m_baraxis, SIGNAL(rangeChanged(QString,QString))); |
|
496 | QSignalSpy spy4(m_baraxis, SIGNAL(countChanged())); | |
|
481 | 497 | |
|
482 | 498 | m_baraxis->setMax(max); |
|
483 | 499 | QCOMPARE(m_baraxis->max(), max); |
@@ -486,6 +502,7 void tst_QBarCategoriesAxis::max_raw() | |||
|
486 | 502 | QCOMPARE(spy1.count(), 1); |
|
487 | 503 | QCOMPARE(spy2.count(), 0); |
|
488 | 504 | QCOMPARE(spy3.count(), 1); |
|
505 | QCOMPARE(spy4.count(), 0); | |
|
489 | 506 | } |
|
490 | 507 | |
|
491 | 508 | void tst_QBarCategoriesAxis::max_data() |
@@ -529,6 +546,7 void tst_QBarCategoriesAxis::min_raw() | |||
|
529 | 546 | QSignalSpy spy1(m_baraxis, SIGNAL(maxChanged(QString))); |
|
530 | 547 | QSignalSpy spy2(m_baraxis, SIGNAL(minChanged(QString))); |
|
531 | 548 | QSignalSpy spy3(m_baraxis, SIGNAL(rangeChanged(QString,QString))); |
|
549 | QSignalSpy spy4(m_baraxis, SIGNAL(countChanged())); | |
|
532 | 550 | |
|
533 | 551 | m_baraxis->setMin(min); |
|
534 | 552 | QCOMPARE(m_baraxis->min(), min); |
@@ -537,7 +555,7 void tst_QBarCategoriesAxis::min_raw() | |||
|
537 | 555 | QCOMPARE(spy1.count(), 0); |
|
538 | 556 | QCOMPARE(spy2.count(), 1); |
|
539 | 557 | QCOMPARE(spy3.count(), 1); |
|
540 | ||
|
558 | QCOMPARE(spy4.count(), 0); | |
|
541 | 559 | } |
|
542 | 560 | |
|
543 | 561 | void tst_QBarCategoriesAxis::min_data() |
@@ -585,6 +603,7 void tst_QBarCategoriesAxis::range_raw() | |||
|
585 | 603 | QSignalSpy spy1(m_baraxis, SIGNAL(maxChanged(QString))); |
|
586 | 604 | QSignalSpy spy2(m_baraxis, SIGNAL(minChanged(QString))); |
|
587 | 605 | QSignalSpy spy3(m_baraxis, SIGNAL(rangeChanged(QString,QString))); |
|
606 | QSignalSpy spy4(m_baraxis, SIGNAL(countChanged())); | |
|
588 | 607 | |
|
589 | 608 | m_baraxis->setRange(min, max); |
|
590 | 609 | QCOMPARE(m_baraxis->min(), min); |
@@ -594,6 +613,7 void tst_QBarCategoriesAxis::range_raw() | |||
|
594 | 613 | QCOMPARE(spy1.count(), 1); |
|
595 | 614 | QCOMPARE(spy2.count(), 1); |
|
596 | 615 | QCOMPARE(spy3.count(), 1); |
|
616 | QCOMPARE(spy4.count(), 0); | |
|
597 | 617 | } |
|
598 | 618 | |
|
599 | 619 | void tst_QBarCategoriesAxis::range_data() |
|
1 | NO CONTENT: file renamed from tests/auto/qml-qtquicktest/tst_categoriesaxis.qml to tests/auto/qml-qtquicktest/tst_categoryaxis.qml |
@@ -20,7 +20,7 | |||
|
20 | 20 | |
|
21 | 21 | import QtQuick 1.0 |
|
22 | 22 | import QtQuickTest 1.0 |
|
23 |
import QtCommercial.Chart 1. |
|
|
23 | import QtCommercial.Chart 1.1 | |
|
24 | 24 | |
|
25 | 25 | Rectangle { |
|
26 | 26 | width: 400 |
@@ -28,7 +28,7 Rectangle { | |||
|
28 | 28 | |
|
29 | 29 | TestCase { |
|
30 | 30 | id: tc1 |
|
31 |
name: "tst_qml-qtquicktest Value |
|
|
31 | name: "tst_qml-qtquicktest ValueAxis 1.1" | |
|
32 | 32 | when: windowShown |
|
33 | 33 | |
|
34 | 34 | function test_minMax() { |
@@ -45,12 +45,12 Rectangle { | |||
|
45 | 45 | |
|
46 | 46 | LineSeries { |
|
47 | 47 | id: lineSeries1 |
|
48 |
axisX: Value |
|
|
48 | axisX: ValueAxis { | |
|
49 | 49 | id: axisX |
|
50 | 50 | min: 0 |
|
51 | 51 | max: 10 |
|
52 | 52 | } |
|
53 |
axisY: Value |
|
|
53 | axisY: ValueAxis { | |
|
54 | 54 | id: axisY |
|
55 | 55 | min: 0 |
|
56 | 56 | max: 10 |
General Comments 0
You need to be logged in to leave comments.
Login now