@@ -1,307 +1,307 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "../qabstractaxis/tst_qabstractaxis.h" |
|
21 | #include "../qabstractaxis/tst_qabstractaxis.h" | |
22 | #include "qcategoryaxis.h" |
|
22 | #include "qcategoryaxis.h" | |
23 | #include <qlineseries.h> |
|
23 | #include <qlineseries.h> | |
24 |
|
24 | |||
25 | class tst_QCategoryAxis: public tst_QAbstractAxis |
|
25 | class tst_QCategoryAxis: public tst_QAbstractAxis | |
26 | { |
|
26 | { | |
27 | Q_OBJECT |
|
27 | Q_OBJECT | |
28 |
|
28 | |||
29 | public slots: |
|
29 | public slots: | |
30 | void initTestCase(); |
|
30 | void initTestCase(); | |
31 | void cleanupTestCase(); |
|
31 | void cleanupTestCase(); | |
32 | void init(); |
|
32 | void init(); | |
33 | void cleanup(); |
|
33 | void cleanup(); | |
34 |
|
34 | |||
35 | private slots: |
|
35 | private slots: | |
36 | void qcategoryaxis_data(); |
|
36 | void qcategoryaxis_data(); | |
37 | void qcategoryaxis(); |
|
37 | void qcategoryaxis(); | |
38 |
|
38 | |||
39 | void max_raw_data(); |
|
39 | void max_raw_data(); | |
40 | void max_raw(); |
|
40 | void max_raw(); | |
41 | void max_data(); |
|
41 | void max_data(); | |
42 | void max(); |
|
42 | void max(); | |
43 | void max_animation_data(); |
|
43 | void max_animation_data(); | |
44 | void max_animation(); |
|
44 | void max_animation(); | |
45 | void min_raw_data(); |
|
45 | void min_raw_data(); | |
46 | void min_raw(); |
|
46 | void min_raw(); | |
47 | void min_data(); |
|
47 | void min_data(); | |
48 | void min(); |
|
48 | void min(); | |
49 | void min_animation_data(); |
|
49 | void min_animation_data(); | |
50 | void min_animation(); |
|
50 | void min_animation(); | |
51 | void range_raw_data(); |
|
51 | void range_raw_data(); | |
52 | void range_raw(); |
|
52 | void range_raw(); | |
53 | void range_data(); |
|
53 | void range_data(); | |
54 | void range(); |
|
54 | void range(); | |
55 | void range_animation_data(); |
|
55 | void range_animation_data(); | |
56 | void range_animation(); |
|
56 | void range_animation(); | |
57 |
|
57 | |||
58 | void interval_data(); |
|
58 | void interval_data(); | |
59 | void interval(); |
|
59 | void interval(); | |
60 |
|
60 | |||
61 | private: |
|
61 | private: | |
62 | QCategoryAxis* m_categoryaxis; |
|
62 | QCategoryAxis* m_categoryaxis; | |
63 | QLineSeries* m_series; |
|
63 | QLineSeries* m_series; | |
64 | }; |
|
64 | }; | |
65 |
|
65 | |||
66 | void tst_QCategoryAxis::initTestCase() |
|
66 | void tst_QCategoryAxis::initTestCase() | |
67 | { |
|
67 | { | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 | void tst_QCategoryAxis::cleanupTestCase() |
|
70 | void tst_QCategoryAxis::cleanupTestCase() | |
71 | { |
|
71 | { | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | void tst_QCategoryAxis::init() |
|
74 | void tst_QCategoryAxis::init() | |
75 | { |
|
75 | { | |
76 | m_categoryaxis = new QCategoryAxis(); |
|
76 | m_categoryaxis = new QCategoryAxis(); | |
77 | m_series = new QLineSeries(); |
|
77 | m_series = new QLineSeries(); | |
78 | *m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100); |
|
78 | *m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100); | |
79 | tst_QAbstractAxis::init(m_categoryaxis, m_series); |
|
79 | tst_QAbstractAxis::init(m_categoryaxis, m_series); | |
80 | m_chart->addSeries(m_series); |
|
80 | m_chart->addSeries(m_series); | |
81 | m_chart->createDefaultAxes(); |
|
81 | m_chart->createDefaultAxes(); | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | void tst_QCategoryAxis::cleanup() |
|
84 | void tst_QCategoryAxis::cleanup() | |
85 | { |
|
85 | { | |
86 | delete m_series; |
|
86 | delete m_series; | |
87 | delete m_categoryaxis; |
|
87 | delete m_categoryaxis; | |
88 | m_series = 0; |
|
88 | m_series = 0; | |
89 | m_categoryaxis = 0; |
|
89 | m_categoryaxis = 0; | |
90 | tst_QAbstractAxis::cleanup(); |
|
90 | tst_QAbstractAxis::cleanup(); | |
91 | } |
|
91 | } | |
92 |
|
92 | |||
93 | void tst_QCategoryAxis::qcategoryaxis_data() |
|
93 | void tst_QCategoryAxis::qcategoryaxis_data() | |
94 | { |
|
94 | { | |
95 | } |
|
95 | } | |
96 |
|
96 | |||
97 | void tst_QCategoryAxis::qcategoryaxis() |
|
97 | void tst_QCategoryAxis::qcategoryaxis() | |
98 | { |
|
98 | { | |
99 | qabstractaxis(); |
|
99 | qabstractaxis(); | |
100 |
|
100 | |||
101 | QVERIFY(qFuzzyIsNull(m_categoryaxis->max())); |
|
101 | QVERIFY(qFuzzyIsNull(m_categoryaxis->max())); | |
102 | QVERIFY(qFuzzyIsNull(m_categoryaxis->min())); |
|
102 | QVERIFY(qFuzzyIsNull(m_categoryaxis->min())); | |
103 | QCOMPARE(m_categoryaxis->type(), QAbstractAxis::AxisTypeCategory); |
|
103 | QCOMPARE(m_categoryaxis->type(), QAbstractAxis::AxisTypeCategory); | |
104 |
|
104 | |||
105 | m_chart->setAxisX(m_categoryaxis, m_series); |
|
105 | m_chart->setAxisX(m_categoryaxis, m_series); | |
106 | m_view->show(); |
|
106 | m_view->show(); | |
107 | QTest::qWaitForWindowShown(m_view); |
|
107 | QTest::qWaitForWindowShown(m_view); | |
108 |
|
108 | |||
109 | QVERIFY(!qFuzzyIsNull(m_categoryaxis->max())); |
|
109 | QVERIFY(!qFuzzyIsNull(m_categoryaxis->max())); | |
110 | QVERIFY(!qFuzzyIsNull(m_categoryaxis->min())); |
|
110 | QVERIFY(!qFuzzyIsNull(m_categoryaxis->min())); | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 | void tst_QCategoryAxis::max_raw_data() |
|
113 | void tst_QCategoryAxis::max_raw_data() | |
114 | { |
|
114 | { | |
115 | QTest::addColumn<qreal>("max"); |
|
115 | QTest::addColumn<qreal>("max"); | |
116 | QTest::newRow("1.0") << (qreal)1.0; |
|
116 | QTest::newRow("1.0") << (qreal)1.0; | |
117 | QTest::newRow("50.0") << (qreal)50.0; |
|
117 | QTest::newRow("50.0") << (qreal)50.0; | |
118 | QTest::newRow("101.0") << (qreal)101.0; |
|
118 | QTest::newRow("101.0") << (qreal)101.0; | |
119 | } |
|
119 | } | |
120 |
|
120 | |||
121 | void tst_QCategoryAxis::max_raw() |
|
121 | void tst_QCategoryAxis::max_raw() | |
122 | { |
|
122 | { | |
123 | QFETCH(qreal, max); |
|
123 | QFETCH(qreal, max); | |
124 |
|
124 | |||
125 | QSignalSpy spy0(m_categoryaxis, SIGNAL(maxChanged(qreal))); |
|
125 | QSignalSpy spy0(m_categoryaxis, SIGNAL(maxChanged(qreal))); | |
126 | QSignalSpy spy1(m_categoryaxis, SIGNAL(minChanged(qreal))); |
|
126 | QSignalSpy spy1(m_categoryaxis, SIGNAL(minChanged(qreal))); | |
127 | QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal, qreal))); |
|
127 | QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal, qreal))); | |
128 |
|
128 | |||
129 | m_categoryaxis->setMax(max); |
|
129 | m_categoryaxis->setMax(max); | |
130 | QVERIFY2(qFuzzyIsNull(m_categoryaxis->max() - max), "Not equal"); |
|
130 | QVERIFY2(qFuzzyIsNull(m_categoryaxis->max() - max), "Not equal"); | |
131 |
|
131 | |||
132 | QCOMPARE(spy0.count(), 1); |
|
132 | QCOMPARE(spy0.count(), 1); | |
133 | QCOMPARE(spy1.count(), 0); |
|
133 | QCOMPARE(spy1.count(), 0); | |
134 | QCOMPARE(spy2.count(), 1); |
|
134 | QCOMPARE(spy2.count(), 1); | |
135 | } |
|
135 | } | |
136 |
|
136 | |||
137 | void tst_QCategoryAxis::max_data() |
|
137 | void tst_QCategoryAxis::max_data() | |
138 | { |
|
138 | { | |
139 | max_raw_data(); |
|
139 | max_raw_data(); | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
142 | void tst_QCategoryAxis::max() |
|
142 | void tst_QCategoryAxis::max() | |
143 | { |
|
143 | { | |
144 | m_chart->setAxisX(m_categoryaxis, m_series); |
|
144 | m_chart->setAxisX(m_categoryaxis, m_series); | |
145 | m_view->show(); |
|
145 | m_view->show(); | |
146 | QTest::qWaitForWindowShown(m_view); |
|
146 | QTest::qWaitForWindowShown(m_view); | |
147 | max_raw(); |
|
147 | max_raw(); | |
148 | } |
|
148 | } | |
149 |
|
149 | |||
150 | void tst_QCategoryAxis::max_animation_data() |
|
150 | void tst_QCategoryAxis::max_animation_data() | |
151 | { |
|
151 | { | |
152 | max_data(); |
|
152 | max_data(); | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 | void tst_QCategoryAxis::max_animation() |
|
155 | void tst_QCategoryAxis::max_animation() | |
156 | { |
|
156 | { | |
157 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); |
|
157 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); | |
158 | max(); |
|
158 | max(); | |
159 | } |
|
159 | } | |
160 |
|
160 | |||
161 | void tst_QCategoryAxis::min_raw_data() |
|
161 | void tst_QCategoryAxis::min_raw_data() | |
162 | { |
|
162 | { | |
163 | QTest::addColumn<qreal>("min"); |
|
163 | QTest::addColumn<qreal>("min"); | |
164 | QTest::newRow("-1.0") << -1.0; |
|
164 | QTest::newRow("-1.0") << (qreal)-1.0; | |
165 | QTest::newRow("-50.0") << -50.0; |
|
165 | QTest::newRow("-50.0") << (qreal)-50.0; | |
166 | QTest::newRow("-101.0") << -101.0; |
|
166 | QTest::newRow("-101.0") << (qreal)-101.0; | |
167 | } |
|
167 | } | |
168 |
|
168 | |||
169 | void tst_QCategoryAxis::min_raw() |
|
169 | void tst_QCategoryAxis::min_raw() | |
170 | { |
|
170 | { | |
171 | QFETCH(qreal, min); |
|
171 | QFETCH(qreal, min); | |
172 |
|
172 | |||
173 | QSignalSpy spy0(m_categoryaxis, SIGNAL(maxChanged(qreal))); |
|
173 | QSignalSpy spy0(m_categoryaxis, SIGNAL(maxChanged(qreal))); | |
174 | QSignalSpy spy1(m_categoryaxis, SIGNAL(minChanged(qreal))); |
|
174 | QSignalSpy spy1(m_categoryaxis, SIGNAL(minChanged(qreal))); | |
175 | QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal, qreal))); |
|
175 | QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal, qreal))); | |
176 |
|
176 | |||
177 | m_categoryaxis->setMin(min); |
|
177 | m_categoryaxis->setMin(min); | |
178 | QVERIFY2(qFuzzyIsNull(m_categoryaxis->min() - min), "Not equal"); |
|
178 | QVERIFY2(qFuzzyIsNull(m_categoryaxis->min() - min), "Not equal"); | |
179 |
|
179 | |||
180 | QCOMPARE(spy0.count(), 0); |
|
180 | QCOMPARE(spy0.count(), 0); | |
181 | QCOMPARE(spy1.count(), 1); |
|
181 | QCOMPARE(spy1.count(), 1); | |
182 | QCOMPARE(spy2.count(), 1); |
|
182 | QCOMPARE(spy2.count(), 1); | |
183 | } |
|
183 | } | |
184 |
|
184 | |||
185 | void tst_QCategoryAxis::min_data() |
|
185 | void tst_QCategoryAxis::min_data() | |
186 | { |
|
186 | { | |
187 | min_raw_data(); |
|
187 | min_raw_data(); | |
188 | } |
|
188 | } | |
189 |
|
189 | |||
190 | void tst_QCategoryAxis::min() |
|
190 | void tst_QCategoryAxis::min() | |
191 | { |
|
191 | { | |
192 | m_chart->setAxisX(m_categoryaxis, m_series); |
|
192 | m_chart->setAxisX(m_categoryaxis, m_series); | |
193 | m_view->show(); |
|
193 | m_view->show(); | |
194 | QTest::qWaitForWindowShown(m_view); |
|
194 | QTest::qWaitForWindowShown(m_view); | |
195 | min_raw(); |
|
195 | min_raw(); | |
196 | } |
|
196 | } | |
197 |
|
197 | |||
198 | void tst_QCategoryAxis::min_animation_data() |
|
198 | void tst_QCategoryAxis::min_animation_data() | |
199 | { |
|
199 | { | |
200 | min_data(); |
|
200 | min_data(); | |
201 | } |
|
201 | } | |
202 |
|
202 | |||
203 | void tst_QCategoryAxis::min_animation() |
|
203 | void tst_QCategoryAxis::min_animation() | |
204 | { |
|
204 | { | |
205 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); |
|
205 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); | |
206 | min(); |
|
206 | min(); | |
207 | } |
|
207 | } | |
208 |
|
208 | |||
209 | void tst_QCategoryAxis::range_raw_data() |
|
209 | void tst_QCategoryAxis::range_raw_data() | |
210 | { |
|
210 | { | |
211 | QTest::addColumn<qreal>("min"); |
|
211 | QTest::addColumn<qreal>("min"); | |
212 | QTest::addColumn<qreal>("max"); |
|
212 | QTest::addColumn<qreal>("max"); | |
213 | QTest::newRow("1.0 - 101.0") << -1.0 << 101.0; |
|
213 | QTest::newRow("1.0 - 101.0") << (qreal)-1.0 << (qreal)101.0; | |
214 | QTest::newRow("25.0 - 75.0") << 25.0 << 75.0; |
|
214 | QTest::newRow("25.0 - 75.0") << (qreal)25.0 << (qreal)75.0; | |
215 | QTest::newRow("101.0") << 40.0 << 60.0; |
|
215 | QTest::newRow("101.0") << (qreal)40.0 << (qreal)60.0; | |
216 | QTest::newRow("-35.0 - 0.0") << -35.0 << 10.0; |
|
216 | QTest::newRow("-35.0 - 0.0") << (qreal)-35.0 << (qreal)10.0; | |
217 | QTest::newRow("-35.0 - 0.0") << -35.0 << -15.0; |
|
217 | QTest::newRow("-35.0 - 0.0") << (qreal)-35.0 << (qreal)-15.0; | |
218 | QTest::newRow("0.0 - 0.0") << -0.1 << 0.1; |
|
218 | QTest::newRow("0.0 - 0.0") << (qreal)-0.1 << (qreal)0.1; | |
219 | } |
|
219 | } | |
220 |
|
220 | |||
221 | void tst_QCategoryAxis::range_raw() |
|
221 | void tst_QCategoryAxis::range_raw() | |
222 | { |
|
222 | { | |
223 | QFETCH(qreal, min); |
|
223 | QFETCH(qreal, min); | |
224 | QFETCH(qreal, max); |
|
224 | QFETCH(qreal, max); | |
225 |
|
225 | |||
226 | QSignalSpy spy0(m_categoryaxis, SIGNAL(maxChanged(qreal))); |
|
226 | QSignalSpy spy0(m_categoryaxis, SIGNAL(maxChanged(qreal))); | |
227 | QSignalSpy spy1(m_categoryaxis, SIGNAL(minChanged(qreal))); |
|
227 | QSignalSpy spy1(m_categoryaxis, SIGNAL(minChanged(qreal))); | |
228 | QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal, qreal))); |
|
228 | QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal, qreal))); | |
229 |
|
229 | |||
230 | m_categoryaxis->setRange(min, max); |
|
230 | m_categoryaxis->setRange(min, max); | |
231 | QVERIFY2(qFuzzyIsNull(m_categoryaxis->min() - min), "Min not equal"); |
|
231 | QVERIFY2(qFuzzyIsNull(m_categoryaxis->min() - min), "Min not equal"); | |
232 | QVERIFY2(qFuzzyIsNull(m_categoryaxis->max() - max), "Max not equal"); |
|
232 | QVERIFY2(qFuzzyIsNull(m_categoryaxis->max() - max), "Max not equal"); | |
233 |
|
233 | |||
234 | QCOMPARE(spy0.count(), 1); |
|
234 | QCOMPARE(spy0.count(), 1); | |
235 | QCOMPARE(spy1.count(), 1); |
|
235 | QCOMPARE(spy1.count(), 1); | |
236 | QCOMPARE(spy2.count(), 1); |
|
236 | QCOMPARE(spy2.count(), 1); | |
237 | } |
|
237 | } | |
238 |
|
238 | |||
239 | void tst_QCategoryAxis::range_data() |
|
239 | void tst_QCategoryAxis::range_data() | |
240 | { |
|
240 | { | |
241 | range_raw_data(); |
|
241 | range_raw_data(); | |
242 | } |
|
242 | } | |
243 |
|
243 | |||
244 | void tst_QCategoryAxis::range() |
|
244 | void tst_QCategoryAxis::range() | |
245 | { |
|
245 | { | |
246 | m_chart->setAxisX(m_categoryaxis, m_series); |
|
246 | m_chart->setAxisX(m_categoryaxis, m_series); | |
247 | m_view->show(); |
|
247 | m_view->show(); | |
248 | QTest::qWaitForWindowShown(m_view); |
|
248 | QTest::qWaitForWindowShown(m_view); | |
249 | range_raw(); |
|
249 | range_raw(); | |
250 | } |
|
250 | } | |
251 |
|
251 | |||
252 | void tst_QCategoryAxis::range_animation_data() |
|
252 | void tst_QCategoryAxis::range_animation_data() | |
253 | { |
|
253 | { | |
254 | range_data(); |
|
254 | range_data(); | |
255 | } |
|
255 | } | |
256 |
|
256 | |||
257 | void tst_QCategoryAxis::range_animation() |
|
257 | void tst_QCategoryAxis::range_animation() | |
258 | { |
|
258 | { | |
259 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); |
|
259 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); | |
260 | range(); |
|
260 | range(); | |
261 | } |
|
261 | } | |
262 |
|
262 | |||
263 | void tst_QCategoryAxis::interval_data() |
|
263 | void tst_QCategoryAxis::interval_data() | |
264 | { |
|
264 | { | |
265 | // |
|
265 | // | |
266 | } |
|
266 | } | |
267 |
|
267 | |||
268 | void tst_QCategoryAxis::interval() |
|
268 | void tst_QCategoryAxis::interval() | |
269 | { |
|
269 | { | |
270 | // append one correct interval |
|
270 | // append one correct interval | |
271 | m_categoryaxis->append("first", (qreal)45); |
|
271 | m_categoryaxis->append("first", (qreal)45); | |
272 | QCOMPARE(m_categoryaxis->startValue("first"), (qreal)0); |
|
272 | QCOMPARE(m_categoryaxis->startValue("first"), (qreal)0); | |
273 | QCOMPARE(m_categoryaxis->endValue("first"), (qreal)45); |
|
273 | QCOMPARE(m_categoryaxis->endValue("first"), (qreal)45); | |
274 |
|
274 | |||
275 | // append one more correct interval |
|
275 | // append one more correct interval | |
276 | m_categoryaxis->append("second", (qreal)75); |
|
276 | m_categoryaxis->append("second", (qreal)75); | |
277 | QCOMPARE(m_categoryaxis->startValue("second"), (qreal)45); |
|
277 | QCOMPARE(m_categoryaxis->startValue("second"), (qreal)45); | |
278 | QCOMPARE(m_categoryaxis->endValue("second"), (qreal)75); |
|
278 | QCOMPARE(m_categoryaxis->endValue("second"), (qreal)75); | |
279 |
|
279 | |||
280 | // append one incorrect interval |
|
280 | // append one incorrect interval | |
281 | m_categoryaxis->append("third", (qreal)15); |
|
281 | m_categoryaxis->append("third", (qreal)15); | |
282 | QCOMPARE(m_categoryaxis->count(), 2); |
|
282 | QCOMPARE(m_categoryaxis->count(), 2); | |
283 | QCOMPARE(m_categoryaxis->endValue(m_categoryaxis->categoriesLabels().last()), (qreal)75); |
|
283 | QCOMPARE(m_categoryaxis->endValue(m_categoryaxis->categoriesLabels().last()), (qreal)75); | |
284 | // QCOMPARE(intervalMax("first"), (qreal)75); |
|
284 | // QCOMPARE(intervalMax("first"), (qreal)75); | |
285 |
|
285 | |||
286 | // append one more correct interval |
|
286 | // append one more correct interval | |
287 | m_categoryaxis->append("third", (qreal)100); |
|
287 | m_categoryaxis->append("third", (qreal)100); | |
288 | QCOMPARE(m_categoryaxis->count(), 3); |
|
288 | QCOMPARE(m_categoryaxis->count(), 3); | |
289 | QCOMPARE(m_categoryaxis->startValue("third"), (qreal)75); |
|
289 | QCOMPARE(m_categoryaxis->startValue("third"), (qreal)75); | |
290 | QCOMPARE(m_categoryaxis->endValue("third"), (qreal)100); |
|
290 | QCOMPARE(m_categoryaxis->endValue("third"), (qreal)100); | |
291 |
|
291 | |||
292 | // remove one interval |
|
292 | // remove one interval | |
293 | m_categoryaxis->remove("first"); |
|
293 | m_categoryaxis->remove("first"); | |
294 | QCOMPARE(m_categoryaxis->count(), 2); |
|
294 | QCOMPARE(m_categoryaxis->count(), 2); | |
295 | QCOMPARE(m_categoryaxis->startValue("second"), (qreal)0); // second interval should extend to firstInterval minimum |
|
295 | QCOMPARE(m_categoryaxis->startValue("second"), (qreal)0); // second interval should extend to firstInterval minimum | |
296 | QCOMPARE(m_categoryaxis->endValue("second"), (qreal)75); |
|
296 | QCOMPARE(m_categoryaxis->endValue("second"), (qreal)75); | |
297 |
|
297 | |||
298 | // remove one interval |
|
298 | // remove one interval | |
299 | m_categoryaxis->replaceLabel("second", "replaced"); |
|
299 | m_categoryaxis->replaceLabel("second", "replaced"); | |
300 | QCOMPARE(m_categoryaxis->count(), 2); |
|
300 | QCOMPARE(m_categoryaxis->count(), 2); | |
301 | QCOMPARE(m_categoryaxis->startValue("replaced"), (qreal)0); // second interval should extend to firstInterval minimum |
|
301 | QCOMPARE(m_categoryaxis->startValue("replaced"), (qreal)0); // second interval should extend to firstInterval minimum | |
302 | QCOMPARE(m_categoryaxis->endValue("replaced"), (qreal)75); |
|
302 | QCOMPARE(m_categoryaxis->endValue("replaced"), (qreal)75); | |
303 | } |
|
303 | } | |
304 |
|
304 | |||
305 | QTEST_MAIN(tst_QCategoryAxis) |
|
305 | QTEST_MAIN(tst_QCategoryAxis) | |
306 | #include "tst_qcategoryaxis.moc" |
|
306 | #include "tst_qcategoryaxis.moc" | |
307 |
|
307 |
General Comments 0
You need to be logged in to leave comments.
Login now