##// END OF EJS Templates
Added missing count property to QBarCategoryAxis
Tero Ahola -
r2249:707325ca7e43
parent child
Show More
@@ -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 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries");
126 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries");
127 qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries");
127 qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries");
128 qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet");
128 qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet");
129 qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis");
129 #ifndef QT_ON_ARM
130 #ifndef QT_ON_ARM
130 qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis");
131 qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis");
131 #endif
132 #endif
@@ -100,11 +100,20 QTCOMMERCIALCHART_BEGIN_NAMESPACE
100 Defines the maximum value on the axis.
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 \fn void QBarCategoryAxis::categoriesChanged()
113 \fn void QBarCategoryAxis::categoriesChanged()
106 Axis emits signal when the categories of the axis has changed.
114 Axis emits signal when the categories of the axis has changed.
107 */
115 */
116
108 /*!
117 /*!
109 \fn void QBarCategoryAxis::minChanged(const QString &min)
118 \fn void QBarCategoryAxis::minChanged(const QString &min)
110 Axis emits signal when \a min of axis has changed.
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 \fn void QBarCategoryAxis::rangeChanged(const QString &min, const QString &max)
145 \fn void QBarCategoryAxis::rangeChanged(const QString &min, const QString &max)
128 Axis emits signal when \a min or \a max of axis has changed.
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 setRange(d->m_minCategory, d->m_categories.last());
202 setRange(d->m_minCategory, d->m_categories.last());
185
203
186 emit categoriesChanged();
204 emit categoriesChanged();
205 emit countChanged();
187 }
206 }
188
207
189 /*!
208 /*!
@@ -209,6 +228,7 void QBarCategoryAxis::append(const QString &category)
209 setRange(d->m_minCategory, d->m_categories.last());
228 setRange(d->m_minCategory, d->m_categories.last());
210
229
211 emit categoriesChanged();
230 emit categoriesChanged();
231 emit countChanged();
212 }
232 }
213
233
214 /*!
234 /*!
@@ -234,6 +254,7 void QBarCategoryAxis::remove(const QString &category)
234 setRange(QString::null, QString::null);
254 setRange(QString::null, QString::null);
235 }
255 }
236 emit categoriesChanged();
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 emit categoriesChanged();
288 emit categoriesChanged();
289 emit countChanged();
268 }
290 }
269
291
270 /*!
292 /*!
271 Replaces \a oldCategory with \a newCategory. If \a oldCategory does not exits on the axis nothing is done.
293 Replaces \a oldCategory with \a newCategory. If \a oldCategory does not exits on the axis nothing is done.
272 A \a newVategory has to be valid QStrings and can not be duplicated. In case of replacing minimum or maximum category,
294 A \a newCategory has to be valid QStrings and can not be duplicated. In case of replacing minimum or maximum category,
273 minimum and maximum of axis is updated accordingly.
295 minimum and maximum of axis is updated accordingly.
274 */
296 */
275 void QBarCategoryAxis::replace(const QString &oldCategory, const QString &newCategory)
297 void QBarCategoryAxis::replace(const QString &oldCategory, const QString &newCategory)
@@ -288,6 +310,7 void QBarCategoryAxis::replace(const QString &oldCategory, const QString &newCat
288 d->emitUpdated();
310 d->emitUpdated();
289 }
311 }
290 emit categoriesChanged();
312 emit categoriesChanged();
313 emit countChanged();
291 }
314 }
292 }
315 }
293
316
@@ -300,6 +323,7 void QBarCategoryAxis::clear()
300 d->m_categories.clear();
323 d->m_categories.clear();
301 setRange(QString::null, QString::null);
324 setRange(QString::null, QString::null);
302 emit categoriesChanged();
325 emit categoriesChanged();
326 emit countChanged();
303 }
327 }
304
328
305 /*!
329 /*!
@@ -33,6 +33,7 class QTCOMMERCIALCHART_EXPORT QBarCategoryAxis : public QAbstractAxis
33 Q_PROPERTY(QStringList categories READ categories WRITE setCategories NOTIFY categoriesChanged)
33 Q_PROPERTY(QStringList categories READ categories WRITE setCategories NOTIFY categoriesChanged)
34 Q_PROPERTY(QString min READ min WRITE setMin NOTIFY minChanged)
34 Q_PROPERTY(QString min READ min WRITE setMin NOTIFY minChanged)
35 Q_PROPERTY(QString max READ max WRITE setMax NOTIFY maxChanged)
35 Q_PROPERTY(QString max READ max WRITE setMax NOTIFY maxChanged)
36 Q_PROPERTY(int count READ count NOTIFY countChanged)
36
37
37 public:
38 public:
38 explicit QBarCategoryAxis(QObject *parent = 0);
39 explicit QBarCategoryAxis(QObject *parent = 0);
@@ -66,6 +67,7 Q_SIGNALS:
66 void minChanged(const QString &min);
67 void minChanged(const QString &min);
67 void maxChanged(const QString &max);
68 void maxChanged(const QString &max);
68 void rangeChanged(const QString &min, const QString &max);
69 void rangeChanged(const QString &min, const QString &max);
70 void countChanged();
69
71
70 private:
72 private:
71 Q_DECLARE_PRIVATE(QBarCategoryAxis)
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 Constructs an axis object which is a child of \a parent.
105 Constructs an axis object which is a child of \a parent.
88 */
106 */
89 QCategoryAxis::QCategoryAxis(QObject *parent):
107 QCategoryAxis::QCategoryAxis(QObject *parent):
@@ -175,6 +175,7 void tst_QBarCategoriesAxis::append()
175 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
175 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
176 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
176 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
177 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
177 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
178 QSignalSpy spy4(&axis, SIGNAL(countChanged()));
178
179
179 axis.append(categories);
180 axis.append(categories);
180
181
@@ -192,6 +193,7 void tst_QBarCategoriesAxis::append()
192 QCOMPARE(spy1.count(), 1);
193 QCOMPARE(spy1.count(), 1);
193 QCOMPARE(spy2.count(), 1);
194 QCOMPARE(spy2.count(), 1);
194 QCOMPARE(spy3.count(), 1);
195 QCOMPARE(spy3.count(), 1);
196 QCOMPARE(spy4.count(), 1);
195 }
197 }
196
198
197 void tst_QBarCategoriesAxis::append2_data()
199 void tst_QBarCategoriesAxis::append2_data()
@@ -211,6 +213,7 void tst_QBarCategoriesAxis::append2()
211 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
213 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
212 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
214 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
213 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
215 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
216 QSignalSpy spy4(&axis, SIGNAL(countChanged()));
214
217
215 foreach(QString category, categories)
218 foreach(QString category, categories)
216 axis.append(category);
219 axis.append(category);
@@ -229,6 +232,7 void tst_QBarCategoriesAxis::append2()
229 QCOMPARE(spy1.count(), categories.count());
232 QCOMPARE(spy1.count(), categories.count());
230 QCOMPARE(spy2.count(), 1);
233 QCOMPARE(spy2.count(), 1);
231 QCOMPARE(spy3.count(), categories.count());
234 QCOMPARE(spy3.count(), categories.count());
235 QCOMPARE(spy4.count(), categories.count());
232 }
236 }
233
237
234 void tst_QBarCategoriesAxis::at_data()
238 void tst_QBarCategoriesAxis::at_data()
@@ -254,6 +258,7 void tst_QBarCategoriesAxis::at()
254 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
258 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
255 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
259 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
256 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
260 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
261 QSignalSpy spy4(&axis, SIGNAL(countChanged()));
257
262
258 QCOMPARE(axis.at(index), string);
263 QCOMPARE(axis.at(index), string);
259
264
@@ -271,6 +276,7 void tst_QBarCategoriesAxis::at()
271 QCOMPARE(spy1.count(), 0);
276 QCOMPARE(spy1.count(), 0);
272 QCOMPARE(spy2.count(), 0);
277 QCOMPARE(spy2.count(), 0);
273 QCOMPARE(spy3.count(), 0);
278 QCOMPARE(spy3.count(), 0);
279 QCOMPARE(spy4.count(), 0);
274 }
280 }
275
281
276 void tst_QBarCategoriesAxis::categories_data()
282 void tst_QBarCategoriesAxis::categories_data()
@@ -289,6 +295,7 void tst_QBarCategoriesAxis::categories()
289 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
295 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
290 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
296 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
291 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
297 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
298 QSignalSpy spy4(&axis, SIGNAL(countChanged()));
292
299
293 axis.setCategories(categories);
300 axis.setCategories(categories);
294 QCOMPARE(axis.categories(), categories);
301 QCOMPARE(axis.categories(), categories);
@@ -307,7 +314,7 void tst_QBarCategoriesAxis::categories()
307 QCOMPARE(spy1.count(), 1);
314 QCOMPARE(spy1.count(), 1);
308 QCOMPARE(spy2.count(), 1);
315 QCOMPARE(spy2.count(), 1);
309 QCOMPARE(spy3.count(), 1);
316 QCOMPARE(spy3.count(), 1);
310
317 QCOMPARE(spy4.count(), 1);
311 }
318 }
312
319
313 void tst_QBarCategoriesAxis::clear_data()
320 void tst_QBarCategoriesAxis::clear_data()
@@ -329,6 +336,7 void tst_QBarCategoriesAxis::clear()
329 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
336 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
330 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
337 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
331 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
338 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
339 QSignalSpy spy4(&axis, SIGNAL(countChanged()));
332
340
333 axis.clear();
341 axis.clear();
334 QCOMPARE(axis.categories(), QStringList());
342 QCOMPARE(axis.categories(), QStringList());
@@ -353,6 +361,7 void tst_QBarCategoriesAxis::clear()
353 QCOMPARE(spy1.count(), 3);
361 QCOMPARE(spy1.count(), 3);
354 QCOMPARE(spy2.count(), 3);
362 QCOMPARE(spy2.count(), 3);
355 QCOMPARE(spy3.count(), 3);
363 QCOMPARE(spy3.count(), 3);
364 QCOMPARE(spy4.count(), 3);
356 }
365 }
357
366
358 void tst_QBarCategoriesAxis::count_data()
367 void tst_QBarCategoriesAxis::count_data()
@@ -375,6 +384,7 void tst_QBarCategoriesAxis::count()
375 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
384 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
376 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
385 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
377 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
386 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
387 QSignalSpy spy4(&axis, SIGNAL(countChanged()));
378
388
379 QCOMPARE(axis.count(), count);
389 QCOMPARE(axis.count(), count);
380
390
@@ -382,6 +392,7 void tst_QBarCategoriesAxis::count()
382 QCOMPARE(spy1.count(), 0);
392 QCOMPARE(spy1.count(), 0);
383 QCOMPARE(spy2.count(), 0);
393 QCOMPARE(spy2.count(), 0);
384 QCOMPARE(spy3.count(), 0);
394 QCOMPARE(spy3.count(), 0);
395 QCOMPARE(spy4.count(), 0);
385
396
386 m_chart->setAxisX(&axis, m_series);
397 m_chart->setAxisX(&axis, m_series);
387 m_view->show();
398 m_view->show();
@@ -411,6 +422,7 void tst_QBarCategoriesAxis::insert()
411 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
422 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
412 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
423 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
413 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
424 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
425 QSignalSpy spy4(&axis, SIGNAL(countChanged()));
414
426
415 axis.insert(index, category);
427 axis.insert(index, category);
416 QCOMPARE(axis.at(index),category);
428 QCOMPARE(axis.at(index),category);
@@ -419,6 +431,7 void tst_QBarCategoriesAxis::insert()
419 QCOMPARE(spy1.count(), 0);
431 QCOMPARE(spy1.count(), 0);
420 QCOMPARE(spy2.count(), 0);
432 QCOMPARE(spy2.count(), 0);
421 QCOMPARE(spy3.count(), 0);
433 QCOMPARE(spy3.count(), 0);
434 QCOMPARE(spy4.count(), 1);
422
435
423 m_chart->setAxisX(&axis, m_series);
436 m_chart->setAxisX(&axis, m_series);
424 m_view->show();
437 m_view->show();
@@ -451,6 +464,7 void tst_QBarCategoriesAxis::remove()
451 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
464 QSignalSpy spy1(&axis, SIGNAL(maxChanged(QString)));
452 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
465 QSignalSpy spy2(&axis, SIGNAL(minChanged(QString)));
453 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
466 QSignalSpy spy3(&axis, SIGNAL(rangeChanged(QString,QString)));
467 QSignalSpy spy4(&axis, SIGNAL(countChanged()));
454
468
455 axis.remove(category);
469 axis.remove(category);
456 QCOMPARE(axis.categories(),result);
470 QCOMPARE(axis.categories(),result);
@@ -459,6 +473,7 void tst_QBarCategoriesAxis::remove()
459 QCOMPARE(spy1.count(), maxCount);
473 QCOMPARE(spy1.count(), maxCount);
460 QCOMPARE(spy2.count(), minCount);
474 QCOMPARE(spy2.count(), minCount);
461 QCOMPARE(spy3.count(), rangeCount);
475 QCOMPARE(spy3.count(), rangeCount);
476 QCOMPARE(spy4.count(), 1);
462 }
477 }
463
478
464 void tst_QBarCategoriesAxis::max_raw_data()
479 void tst_QBarCategoriesAxis::max_raw_data()
@@ -478,6 +493,7 void tst_QBarCategoriesAxis::max_raw()
478 QSignalSpy spy1(m_baraxis, SIGNAL(maxChanged(QString)));
493 QSignalSpy spy1(m_baraxis, SIGNAL(maxChanged(QString)));
479 QSignalSpy spy2(m_baraxis, SIGNAL(minChanged(QString)));
494 QSignalSpy spy2(m_baraxis, SIGNAL(minChanged(QString)));
480 QSignalSpy spy3(m_baraxis, SIGNAL(rangeChanged(QString,QString)));
495 QSignalSpy spy3(m_baraxis, SIGNAL(rangeChanged(QString,QString)));
496 QSignalSpy spy4(m_baraxis, SIGNAL(countChanged()));
481
497
482 m_baraxis->setMax(max);
498 m_baraxis->setMax(max);
483 QCOMPARE(m_baraxis->max(), max);
499 QCOMPARE(m_baraxis->max(), max);
@@ -486,6 +502,7 void tst_QBarCategoriesAxis::max_raw()
486 QCOMPARE(spy1.count(), 1);
502 QCOMPARE(spy1.count(), 1);
487 QCOMPARE(spy2.count(), 0);
503 QCOMPARE(spy2.count(), 0);
488 QCOMPARE(spy3.count(), 1);
504 QCOMPARE(spy3.count(), 1);
505 QCOMPARE(spy4.count(), 0);
489 }
506 }
490
507
491 void tst_QBarCategoriesAxis::max_data()
508 void tst_QBarCategoriesAxis::max_data()
@@ -529,6 +546,7 void tst_QBarCategoriesAxis::min_raw()
529 QSignalSpy spy1(m_baraxis, SIGNAL(maxChanged(QString)));
546 QSignalSpy spy1(m_baraxis, SIGNAL(maxChanged(QString)));
530 QSignalSpy spy2(m_baraxis, SIGNAL(minChanged(QString)));
547 QSignalSpy spy2(m_baraxis, SIGNAL(minChanged(QString)));
531 QSignalSpy spy3(m_baraxis, SIGNAL(rangeChanged(QString,QString)));
548 QSignalSpy spy3(m_baraxis, SIGNAL(rangeChanged(QString,QString)));
549 QSignalSpy spy4(m_baraxis, SIGNAL(countChanged()));
532
550
533 m_baraxis->setMin(min);
551 m_baraxis->setMin(min);
534 QCOMPARE(m_baraxis->min(), min);
552 QCOMPARE(m_baraxis->min(), min);
@@ -537,7 +555,7 void tst_QBarCategoriesAxis::min_raw()
537 QCOMPARE(spy1.count(), 0);
555 QCOMPARE(spy1.count(), 0);
538 QCOMPARE(spy2.count(), 1);
556 QCOMPARE(spy2.count(), 1);
539 QCOMPARE(spy3.count(), 1);
557 QCOMPARE(spy3.count(), 1);
540
558 QCOMPARE(spy4.count(), 0);
541 }
559 }
542
560
543 void tst_QBarCategoriesAxis::min_data()
561 void tst_QBarCategoriesAxis::min_data()
@@ -585,6 +603,7 void tst_QBarCategoriesAxis::range_raw()
585 QSignalSpy spy1(m_baraxis, SIGNAL(maxChanged(QString)));
603 QSignalSpy spy1(m_baraxis, SIGNAL(maxChanged(QString)));
586 QSignalSpy spy2(m_baraxis, SIGNAL(minChanged(QString)));
604 QSignalSpy spy2(m_baraxis, SIGNAL(minChanged(QString)));
587 QSignalSpy spy3(m_baraxis, SIGNAL(rangeChanged(QString,QString)));
605 QSignalSpy spy3(m_baraxis, SIGNAL(rangeChanged(QString,QString)));
606 QSignalSpy spy4(m_baraxis, SIGNAL(countChanged()));
588
607
589 m_baraxis->setRange(min, max);
608 m_baraxis->setRange(min, max);
590 QCOMPARE(m_baraxis->min(), min);
609 QCOMPARE(m_baraxis->min(), min);
@@ -594,6 +613,7 void tst_QBarCategoriesAxis::range_raw()
594 QCOMPARE(spy1.count(), 1);
613 QCOMPARE(spy1.count(), 1);
595 QCOMPARE(spy2.count(), 1);
614 QCOMPARE(spy2.count(), 1);
596 QCOMPARE(spy3.count(), 1);
615 QCOMPARE(spy3.count(), 1);
616 QCOMPARE(spy4.count(), 0);
597 }
617 }
598
618
599 void tst_QBarCategoriesAxis::range_data()
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
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 import QtQuick 1.0
21 import QtQuick 1.0
22 import QtQuickTest 1.0
22 import QtQuickTest 1.0
23 import QtCommercial.Chart 1.2
23 import QtCommercial.Chart 1.1
24
24
25 Rectangle {
25 Rectangle {
26 width: 400
26 width: 400
@@ -28,7 +28,7 Rectangle {
28
28
29 TestCase {
29 TestCase {
30 id: tc1
30 id: tc1
31 name: "tst_qml-qtquicktest ValuesAxis"
31 name: "tst_qml-qtquicktest ValueAxis 1.1"
32 when: windowShown
32 when: windowShown
33
33
34 function test_minMax() {
34 function test_minMax() {
@@ -45,12 +45,12 Rectangle {
45
45
46 LineSeries {
46 LineSeries {
47 id: lineSeries1
47 id: lineSeries1
48 axisX: ValuesAxis {
48 axisX: ValueAxis {
49 id: axisX
49 id: axisX
50 min: 0
50 min: 0
51 max: 10
51 max: 10
52 }
52 }
53 axisY: ValuesAxis {
53 axisY: ValueAxis {
54 id: axisY
54 id: axisY
55 min: 0
55 min: 0
56 max: 10
56 max: 10
General Comments 0
You need to be logged in to leave comments. Login now