##// END OF EJS Templates
Updates tst_qvaluesaxis test cases
Michal Klocek -
r1700:d1f113b2af85
parent child
Show More
@@ -200,7 +200,7 void QValuesAxis::setRange(qreal min, qreal max)
200 void QValuesAxis::setTicksCount(int count)
200 void QValuesAxis::setTicksCount(int count)
201 {
201 {
202 Q_D(QValuesAxis);
202 Q_D(QValuesAxis);
203 if (d->m_tickCount != count) {
203 if (d->m_tickCount != count && count >=2) {
204 d->m_tickCount = count;
204 d->m_tickCount = count;
205 d->emitUpdated();
205 d->emitUpdated();
206 }
206 }
@@ -221,7 +221,7 void QValuesAxis::setNiceNumbersEnabled(bool enable)
221 Q_D(QValuesAxis);
221 Q_D(QValuesAxis);
222 if (d->m_niceNumbers != enable){
222 if (d->m_niceNumbers != enable){
223 d->m_niceNumbers = enable;
223 d->m_niceNumbers = enable;
224 if(enable) setRange(d->min(),d->max());
224 if(enable && !qFuzzyIsNull(d->m_max - d->m_min)) setRange(d->min(),d->max());
225 }
225 }
226 }
226 }
227
227
@@ -656,78 +656,6 void tst_Domain::move()
656 TRY_COMPARE(spy2.count(), (dy != 0 ? 1 : 0));
656 TRY_COMPARE(spy2.count(), (dy != 0 ? 1 : 0));
657 }
657 }
658
658
659 /*
660 void tst_Domain::handleAxisXChanged_data()
661 {
662 QTest::addColumn<qreal>("min");
663 QTest::addColumn<qreal>("max");
664 QTest::addColumn<int>("tickCount");
665 QTest::addColumn<bool>("niceNumbers");
666 QTest::addColumn<qreal>("resultMin");
667 QTest::addColumn<qreal>("resultMax");
668 QTest::addColumn<int>("resultTickCount");
669 QTest::newRow("0,100,5,false") << 0.0 << 100.0 << 5 << false << 0.0 << 100.0 << 5;
670 QTest::newRow("0,100,5,true") << 0.0 << 100.0 << 5 << true << 0.0 << 100.0 << 6;
671 QTest::newRow("0.1,99,5,true") << 0.1 << 99.0 << 5 << true << 0.0 << 100.0 << 6;
672 QTest::newRow("5,93.5,true") << 5.0 << 93.5 << 5 << true << 0.0 << 100.0 << 6;
673 }
674
675 void tst_Domain::handleAxisXChanged()
676 {
677 QFETCH(qreal, min);
678 QFETCH(qreal, max);
679 QFETCH(int, tickCount);
680 QFETCH(bool, niceNumbers);
681 QFETCH(qreal, resultMin);
682 QFETCH(qreal, resultMax);
683 QFETCH(int, resultTickCount);
684
685 Domain domain;
686 QSignalSpy spy0(&domain, SIGNAL(updated()));
687 QSignalSpy spy1(&domain, SIGNAL(rangeXChanged(qreal,qreal)));
688 QSignalSpy spy2(&domain, SIGNAL(rangeYChanged(qreal,qreal)));
689
690 // domain.handleAxisXChanged(min, max, tickCount, niceNumbers);
691
692 QCOMPARE(resultMin, domain.minX());
693 QCOMPARE(resultMax, domain.maxX());
694 // QCOMPARE(resultTickCount, domain.tickXCount());
695 TRY_COMPARE(spy0.count(), 1);
696 TRY_COMPARE(spy1.count(), 1);
697 TRY_COMPARE(spy2.count(), 0);
698
699 }
700
701 void tst_Domain::handleAxisYChanged_data()
702 {
703 handleAxisXChanged_data();
704 }
705
706 void tst_Domain::handleAxisYChanged()
707 {
708 QFETCH(qreal, min);
709 QFETCH(qreal, max);
710 QFETCH(int, tickCount);
711 QFETCH(bool, niceNumbers);
712 QFETCH(qreal, resultMin);
713 QFETCH(qreal, resultMax);
714 QFETCH(int, resultTickCount);
715
716 Domain domain;
717 QSignalSpy spy0(&domain, SIGNAL(updated()));
718 QSignalSpy spy1(&domain, SIGNAL(rangeXChanged(qreal,qreal)));
719 QSignalSpy spy2(&domain, SIGNAL(rangeYChanged(qreal,qreal)));
720
721 // domain.handleAxisYChanged(min, max, tickCount, niceNumbers);
722
723 QCOMPARE(resultMin, domain.minY());
724 QCOMPARE(resultMax, domain.maxY());
725 // QCOMPARE(resultTickCount, domain.tickYCount());
726 TRY_COMPARE(spy0.count(), 1);
727 TRY_COMPARE(spy1.count(), 0);
728 TRY_COMPARE(spy2.count(), 1);
729 }
730 */
731 QTEST_MAIN(tst_Domain)
659 QTEST_MAIN(tst_Domain)
732 #include "tst_domain.moc"
660 #include "tst_domain.moc"
733
661
@@ -1,30 +1,30
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 "qvaluesaxis.h"
22 #include "qvaluesaxis.h"
23 #include <qlineseries.h>
23 #include <qlineseries.h>
24
24
25 class tst_QValuesAxis : public tst_QAbstractAxis
25 class tst_QValuesAxis: 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();
@@ -36,51 +36,48 private slots:
36 void qvaluesaxis_data();
36 void qvaluesaxis_data();
37 void qvaluesaxis();
37 void qvaluesaxis();
38
38
39 void max_raw_data();
40 void max_raw();
39 void max_data();
41 void max_data();
40 void max();
42 void max();
43 void max_animation_data();
44 void max_animation();
45 void min_raw_data();
46 void min_raw();
41 void min_data();
47 void min_data();
42 void min();
48 void min();
49 void min_animation_data();
50 void min_animation();
43 void niceNumbersEnabled_data();
51 void niceNumbersEnabled_data();
44 void niceNumbersEnabled();
52 void niceNumbersEnabled();
45 void setNiceNumbersEnabled_data();
53 void range_raw_data();
46 void setNiceNumbersEnabled();
54 void range_raw();
47 void setRange_data();
55 void range_data();
48 void setRange();
56 void range();
49 void setTicksCount_data();
57 void range_animation_data();
50 void setTicksCount();
58 void range_animation();
51 void ticksCount_data();
59 void ticksCount_data();
52 void ticksCount();
60 void ticksCount();
53 void type_data();
54 void type();
55 void maxChanged_data();
56 void maxChanged();
57 void minChanged_data();
58 void minChanged();
59 void rangeChanged_data();
60 void rangeChanged();
61
61
62 private:
62 private:
63 QValuesAxis* m_valuesaxis;
63 QValuesAxis* m_valuesaxis;
64 QLineSeries* m_series;
64 QLineSeries* m_series;
65 };
65 };
66
66
67
68 void tst_QValuesAxis::initTestCase()
67 void tst_QValuesAxis::initTestCase()
69 {
68 {
70 }
69 }
71
70
72
73 void tst_QValuesAxis::cleanupTestCase()
71 void tst_QValuesAxis::cleanupTestCase()
74 {
72 {
75 }
73 }
76
74
77
78 void tst_QValuesAxis::init()
75 void tst_QValuesAxis::init()
79 {
76 {
80 m_valuesaxis = new QValuesAxis();
77 m_valuesaxis = new QValuesAxis();
81 tst_QAbstractAxis::init(m_valuesaxis);
78 tst_QAbstractAxis::init(m_valuesaxis);
82 m_series = new QLineSeries();
79 m_series = new QLineSeries();
83 *m_series << QPointF(-100,-100) << QPointF(0,0) << QPointF(100,100);
80 *m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100);
84 m_chart->addSeries(m_series);
81 m_chart->addSeries(m_series);
85 m_chart->createDefaultAxes();
82 m_chart->createDefaultAxes();
86 }
83 }
@@ -90,7 +87,7 void tst_QValuesAxis::cleanup()
90 delete m_series;
87 delete m_series;
91 delete m_valuesaxis;
88 delete m_valuesaxis;
92 m_series = 0;
89 m_series = 0;
93 m_valuesaxis = 0 ;
90 m_valuesaxis = 0;
94 tst_QAbstractAxis::cleanup();
91 tst_QAbstractAxis::cleanup();
95 }
92 }
96
93
@@ -108,7 +105,7 void tst_QValuesAxis::qvaluesaxis()
108 QCOMPARE(m_valuesaxis->ticksCount(), 5);
105 QCOMPARE(m_valuesaxis->ticksCount(), 5);
109 QCOMPARE(m_valuesaxis->type(), QAbstractAxis::AxisTypeValues);
106 QCOMPARE(m_valuesaxis->type(), QAbstractAxis::AxisTypeValues);
110
107
111 m_chart->setAxisX(m_valuesaxis,m_series);
108 m_chart->setAxisX(m_valuesaxis, m_series);
112 m_view->show();
109 m_view->show();
113 QTest::qWaitForWindowShown(m_view);
110 QTest::qWaitForWindowShown(m_view);
114
111
@@ -118,313 +115,235 void tst_QValuesAxis::qvaluesaxis()
118 QCOMPARE(m_valuesaxis->ticksCount(), 5);
115 QCOMPARE(m_valuesaxis->ticksCount(), 5);
119 }
116 }
120
117
121 void tst_QValuesAxis::max_data()
118 void tst_QValuesAxis::max_raw_data()
122 {
119 {
123 QTest::addColumn<qreal>("max");
120 QTest::addColumn<qreal>("max");
124 QTest::newRow("null") << 0.0;
121 QTest::newRow("1.0") << 1.0;
122 QTest::newRow("50.0") << 50.0;
123 QTest::newRow("101.0") << 101.0;
125 }
124 }
126
125
127 // public qreal max() const
126 void tst_QValuesAxis::max_raw()
128 void tst_QValuesAxis::max()
129 {
127 {
130 #if 0
131 QFETCH(qreal, max);
128 QFETCH(qreal, max);
132
129
133 SubQValuesAxis axis;
130 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
134
131 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
135 QSignalSpy spy0(&axis, SIGNAL(maxChanged(qreal)));
132 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal, qreal)));
136 QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal)));
137 QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal)));
138
133
139 QCOMPARE(axis.max(), max);
134 m_valuesaxis->setMax(max);
135 QVERIFY2(qFuzzyIsNull(m_valuesaxis->max() - max), "Not equal");
140
136
141 QCOMPARE(spy0.count(), 0);
137 QCOMPARE(spy0.count(), 1);
142 QCOMPARE(spy1.count(), 0);
138 QCOMPARE(spy1.count(), 0);
143 QCOMPARE(spy2.count(), 0);
139 QCOMPARE(spy2.count(), 1);
144 #endif
145 QSKIP("Test is not implemented.", SkipAll);
146 }
147
148 void tst_QValuesAxis::min_data()
149 {
150 QTest::addColumn<qreal>("min");
151 QTest::newRow("null") << 0.0;
152 }
153
154 // public qreal min() const
155 void tst_QValuesAxis::min()
156 {
157 #if 0
158 QFETCH(qreal, min);
159
160 SubQValuesAxis axis;
161
140
162 QSignalSpy spy0(&axis, SIGNAL(maxChanged(qreal)));
163 QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal)));
164 QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal)));
165
166 QCOMPARE(axis.min(), min);
167
168 QCOMPARE(spy0.count(), 0);
169 QCOMPARE(spy1.count(), 0);
170 QCOMPARE(spy2.count(), 0);
171 #endif
172 QSKIP("Test is not implemented.", SkipAll);
173 }
141 }
174
142
175 void tst_QValuesAxis::niceNumbersEnabled_data()
143 void tst_QValuesAxis::max_data()
176 {
144 {
177 QTest::addColumn<bool>("niceNumbersEnabled");
145 max_raw_data();
178 QTest::newRow("true") << true;
179 QTest::newRow("false") << false;
180 }
146 }
181
147
182 // public bool niceNumbersEnabled() const
148 void tst_QValuesAxis::max()
183 void tst_QValuesAxis::niceNumbersEnabled()
184 {
149 {
185 #if 0
150 m_chart->setAxisX(m_valuesaxis, m_series);
186 QFETCH(bool, niceNumbersEnabled);
151 m_view->show();
187
152 QTest::qWaitForWindowShown(m_view);
188 SubQValuesAxis axis;
153 max_raw();
189
190 QSignalSpy spy0(&axis, SIGNAL(maxChanged(qreal)));
191 QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal)));
192 QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal)));
193
194 QCOMPARE(axis.niceNumbersEnabled(), niceNumbersEnabled);
195
196 QCOMPARE(spy0.count(), 0);
197 QCOMPARE(spy1.count(), 0);
198 QCOMPARE(spy2.count(), 0);
199 #endif
200 QSKIP("Test is not implemented.", SkipAll);
201 }
154 }
202
155
203
156 void tst_QValuesAxis::max_animation_data()
204 void tst_QValuesAxis::setNiceNumbersEnabled_data()
205 {
157 {
206 QTest::addColumn<bool>("enable");
158 max_data();
207 QTest::newRow("true") << true;
208 QTest::newRow("false") << false;
209 }
159 }
210
160
211 // public void setNiceNumbersEnabled(bool enable = true)
161 void tst_QValuesAxis::max_animation()
212 void tst_QValuesAxis::setNiceNumbersEnabled()
213 {
162 {
214 #if 0
163 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
215 QFETCH(bool, enable);
164 max();
216
217 SubQValuesAxis axis;
218
219 QSignalSpy spy0(&axis, SIGNAL(maxChanged(qreal)));
220 QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal)));
221 QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal)));
222
223 axis.setNiceNumbersEnabled(enable);
224
225 QCOMPARE(spy0.count(), 0);
226 QCOMPARE(spy1.count(), 0);
227 QCOMPARE(spy2.count(), 0);
228 #endif
229 QSKIP("Test is not implemented.", SkipAll);
230 }
165 }
231
166
232 void tst_QValuesAxis::setRange_data()
167 void tst_QValuesAxis::min_raw_data()
233 {
168 {
234 QTest::addColumn<qreal>("min");
169 QTest::addColumn<qreal>("min");
235 QTest::addColumn<qreal>("max");
170 QTest::newRow("-1.0") << -1.0;
236 QTest::newRow("null") << 0.0 << 0.0;
171 QTest::newRow("-50.0") << -50.0;
172 QTest::newRow("-101.0") << -101.0;
237 }
173 }
238
174
239 // public void setRange(qreal min, qreal max)
175 void tst_QValuesAxis::min_raw()
240 void tst_QValuesAxis::setRange()
241 {
176 {
242 #if 0
243 QFETCH(qreal, min);
177 QFETCH(qreal, min);
244 QFETCH(qreal, max);
245
178
246 SubQValuesAxis axis;
179 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
180 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
181 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal, qreal)));
247
182
248 QSignalSpy spy0(&axis, SIGNAL(maxChanged(qreal)));
183 m_valuesaxis->setMin(min);
249 QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal)));
184 QVERIFY2(qFuzzyIsNull(m_valuesaxis->min() - min), "Not equal");
250 QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal)));
251
252 axis.setRange(min, max);
253
185
254 QCOMPARE(spy0.count(), 0);
186 QCOMPARE(spy0.count(), 0);
255 QCOMPARE(spy1.count(), 0);
187 QCOMPARE(spy1.count(), 1);
256 QCOMPARE(spy2.count(), 0);
188 QCOMPARE(spy2.count(), 1);
257 #endif
258 QSKIP("Test is not implemented.", SkipAll);
259 }
189 }
260
190
261 void tst_QValuesAxis::setTicksCount_data()
191 void tst_QValuesAxis::min_data()
262 {
192 {
263 QTest::addColumn<int>("count");
193 min_raw_data();
264 QTest::newRow("0") << 0;
265 QTest::newRow("-1") << -1;
266 }
194 }
267
195
268 // public void setTicksCount(int count)
196 void tst_QValuesAxis::min()
269 void tst_QValuesAxis::setTicksCount()
270 {
197 {
271 #if 0
198 m_chart->setAxisX(m_valuesaxis, m_series);
272 QFETCH(int, count);
199 m_view->show();
273
200 QTest::qWaitForWindowShown(m_view);
274 SubQValuesAxis axis;
201 min_raw();
275
276 QSignalSpy spy0(&axis, SIGNAL(maxChanged(qreal)));
277 QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal)));
278 QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal)));
279
280 axis.setTicksCount(count);
281
282 QCOMPARE(spy0.count(), 0);
283 QCOMPARE(spy1.count(), 0);
284 QCOMPARE(spy2.count(), 0);
285 #endif
286 QSKIP("Test is not implemented.", SkipAll);
287 }
202 }
288
203
289 void tst_QValuesAxis::ticksCount_data()
204 void tst_QValuesAxis::min_animation_data()
290 {
205 {
291 QTest::addColumn<int>("ticksCount");
206 min_data();
292 QTest::newRow("0") << 0;
293 QTest::newRow("-1") << -1;
294 }
207 }
295
208
296 // public int ticksCount() const
209 void tst_QValuesAxis::min_animation()
297 void tst_QValuesAxis::ticksCount()
298 {
210 {
299 #if 0
211 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
300 QFETCH(int, ticksCount);
212 min();
301
302 SubQValuesAxis axis;
303
304 QSignalSpy spy0(&axis, SIGNAL(maxChanged(qreal)));
305 QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal)));
306 QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal)));
307
308 QCOMPARE(axis.ticksCount(), ticksCount);
309
310 QCOMPARE(spy0.count(), 0);
311 QCOMPARE(spy1.count(), 0);
312 QCOMPARE(spy2.count(), 0);
313 #endif
314 QSKIP("Test is not implemented.", SkipAll);
315 }
213 }
316
214
317 Q_DECLARE_METATYPE(QAbstractAxis::AxisType)
215 void tst_QValuesAxis::niceNumbersEnabled_data()
318 void tst_QValuesAxis::type_data()
319 {
216 {
320 #if 0
217 QTest::addColumn<bool>("niceNumbersEnabled");
321 QTest::addColumn<AxisType>("type");
218 QTest::addColumn<qreal>("min");
322 QTest::newRow("null") << AxisType();
219 QTest::addColumn<qreal>("max");
323 #endif
220 QTest::addColumn<int>("ticks");
221 QTest::addColumn<qreal>("expectedMin");
222 QTest::addColumn<qreal>("expectedMax");
223 QTest::addColumn<int>("expectedTicks");
224 QTest::newRow("true 0.1 , 99.0 , 5") << true << 0.1 << 99.0 << 5 << 0.0 << 100.0 << 6;
225 QTest::newRow("true 1 , 10.0 , 5") << true << 1.0 << 10.0 << 5 << 0.0 << 10.0 << 6;
226 QTest::newRow("true 0.1 , 6.6 , 5") << true << 0.1 << 6.6 << 5 << 0.0 << 8.0 << 5;
227 QTest::newRow("false 0.1 , 6.6 , 5") << false << 0.1 << 6.6 << 5 << 0.1 << 6.6 << 5;
228 QTest::newRow("true 0.1, 99, 5") << true << 0.1 << 99.0 << 5 << 0.0 << 100.0 << 6;
229 QTest::newRow("true 5, 93.5 , 5") << true << 5.0 << 93.5 << 5 << 0.0 << 100.0 << 6;
324 }
230 }
325
231
326 // public AxisType type() const
232 void tst_QValuesAxis::niceNumbersEnabled()
327 void tst_QValuesAxis::type()
328 {
233 {
329 #if 0
234 QFETCH(bool, niceNumbersEnabled);
330 QFETCH(AxisType, type);
235 QFETCH(qreal, min);
331
236 QFETCH(qreal, max);
332 SubQValuesAxis axis;
237 QFETCH(int, ticks);
238 QFETCH(qreal, expectedMin);
239 QFETCH(qreal, expectedMax);
240 QFETCH(int, expectedTicks);
333
241
334 QSignalSpy spy0(&axis, SIGNAL(maxChanged(qreal)));
242 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
335 QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal)));
243 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
336 QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal)));
244 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal, qreal)));
337
245
338 QCOMPARE(axis.type(), type);
246 m_valuesaxis->setNiceNumbersEnabled(niceNumbersEnabled);
247 QCOMPARE(m_valuesaxis->niceNumbersEnabled(), niceNumbersEnabled);
339
248
340 QCOMPARE(spy0.count(), 0);
249 QCOMPARE(spy0.count(), 0);
341 QCOMPARE(spy1.count(), 0);
250 QCOMPARE(spy1.count(), 0);
342 QCOMPARE(spy2.count(), 0);
251 QCOMPARE(spy2.count(), 0);
343 #endif
252
344 QSKIP("Test is not implemented.", SkipAll);
253 m_valuesaxis->setTicksCount(ticks);
254 m_valuesaxis->setRange(min, max);
255 QVERIFY2(qFuzzyIsNull(m_valuesaxis->min() - expectedMin), "Min not equal");
256 QVERIFY2(qFuzzyIsNull(m_valuesaxis->max() - expectedMax), "Max not equal");
257 QCOMPARE(m_valuesaxis->ticksCount(), expectedTicks);
258
259 QCOMPARE(spy0.count(), 1);
260 QCOMPARE(spy1.count(), 1);
261 QCOMPARE(spy2.count(), 1);
262
345 }
263 }
346
264
347 void tst_QValuesAxis::maxChanged_data()
265 void tst_QValuesAxis::range_raw_data()
348 {
266 {
267 QTest::addColumn<qreal>("min");
349 QTest::addColumn<qreal>("max");
268 QTest::addColumn<qreal>("max");
350 QTest::newRow("null") << 0.0;
269 QTest::newRow("1.0 - 101.0") << -1.0 << 101.0;
270 QTest::newRow("25.0 - 75.0") << 25.0 << 75.0;
271 QTest::newRow("101.0") << 40.0 << 60.0;
351 }
272 }
352
273
353 // protected void maxChanged(qreal max)
274 void tst_QValuesAxis::range_raw()
354 void tst_QValuesAxis::maxChanged()
355 {
275 {
356 #if 0
276 QFETCH(qreal, min);
357 QFETCH(qreal, max);
277 QFETCH(qreal, max);
358
278
359 SubQValuesAxis axis;
279 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
360
280 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
361 QSignalSpy spy0(&axis, SIGNAL(maxChanged(qreal)));
281 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal, qreal)));
362 QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal)));
363 QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal)));
364
282
365 axis.call_maxChanged(max);
283 m_valuesaxis->setRange(min, max);
284 QVERIFY2(qFuzzyIsNull(m_valuesaxis->min() - min), "Min not equal");
285 QVERIFY2(qFuzzyIsNull(m_valuesaxis->max() - max), "Max not equal");
366
286
367 QCOMPARE(spy0.count(), 0);
287 QCOMPARE(spy0.count(), 1);
368 QCOMPARE(spy1.count(), 0);
288 QCOMPARE(spy1.count(), 1);
369 QCOMPARE(spy2.count(), 0);
289 QCOMPARE(spy2.count(), 1);
370 #endif
371 QSKIP("Test is not implemented.", SkipAll);
372 }
290 }
373
291
374 void tst_QValuesAxis::minChanged_data()
292 void tst_QValuesAxis::range_data()
375 {
293 {
376 QTest::addColumn<qreal>("min");
294 range_raw_data();
377 QTest::newRow("null") << 0.0;
378 }
295 }
379
296
380 // protected void minChanged(qreal min)
297 void tst_QValuesAxis::range()
381 void tst_QValuesAxis::minChanged()
382 {
298 {
383 #if 0
299 m_chart->setAxisX(m_valuesaxis, m_series);
384 QFETCH(qreal, min);
300 m_view->show();
385
301 QTest::qWaitForWindowShown(m_view);
386 SubQValuesAxis axis;
302 range_raw();
387
303 }
388 QSignalSpy spy0(&axis, SIGNAL(maxChanged(qreal)));
389 QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal)));
390 QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal)));
391
392 axis.call_minChanged(min);
393
304
394 QCOMPARE(spy0.count(), 0);
305 void tst_QValuesAxis::range_animation_data()
395 QCOMPARE(spy1.count(), 0);
306 {
396 QCOMPARE(spy2.count(), 0);
307 range_data();
397 #endif
398 QSKIP("Test is not implemented.", SkipAll);
399 }
308 }
400
309
401 void tst_QValuesAxis::rangeChanged_data()
310 void tst_QValuesAxis::range_animation()
402 {
311 {
403 QTest::addColumn<qreal>("min");
312 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
404 QTest::addColumn<qreal>("max");
313 range();
405 QTest::newRow("null") << 0.0 << 0.0;
406 }
314 }
407
315
408 // protected void rangeChanged(qreal min, qreal max)
316 void tst_QValuesAxis::ticksCount_data()
409 void tst_QValuesAxis::rangeChanged()
410 {
317 {
411 #if 0
318 QTest::addColumn<int>("ticksCount");
412 QFETCH(qreal, min);
319 QTest::addColumn<int>("expectedCount");
413 QFETCH(qreal, max);
320 QTest::newRow("0") << 2;
321 QTest::newRow("1") << 2;
322 QTest::newRow("2") << 2;
323 QTest::newRow("3") << 3;
324 QTest::newRow("-1") << 2;
325 }
414
326
415 SubQValuesAxis axis;
327 void tst_QValuesAxis::ticksCount()
328 {
329 QFETCH(int, ticksCount);
416
330
417 QSignalSpy spy0(&axis, SIGNAL(maxChanged(qreal)));
331 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
418 QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal)));
332 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
419 QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal)));
333 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal, qreal)));
420
334
421 axis.call_rangeChanged(min, max);
335 m_valuesaxis->setTicksCount(ticksCount);
336 QCOMPARE(m_valuesaxis->ticksCount(), ticksCount);
422
337
423 QCOMPARE(spy0.count(), 0);
338 QCOMPARE(spy0.count(), 0);
424 QCOMPARE(spy1.count(), 0);
339 QCOMPARE(spy1.count(), 0);
425 QCOMPARE(spy2.count(), 0);
340 QCOMPARE(spy2.count(), 0);
426 #endif
341
427 QSKIP("Test is not implemented.", SkipAll);
342 m_chart->setAxisX(m_valuesaxis, m_series);
343 m_view->show();
344 QTest::qWaitForWindowShown(m_view);
345
346 QCOMPARE(m_valuesaxis->ticksCount(), ticksCount);
428 }
347 }
429
348
430 QTEST_MAIN(tst_QValuesAxis)
349 QTEST_MAIN(tst_QValuesAxis)
General Comments 0
You need to be logged in to leave comments. Login now