@@ -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 |
@@ -36,45 +36,42 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 |
|
53 | void range_raw_data(); | |
46 | void setNiceNumbersEnabled(); |
|
54 | void range_raw(); | |
47 |
void |
|
55 | void range_data(); | |
48 |
void |
|
56 | void range(); | |
49 |
void |
|
57 | void range_animation_data(); | |
50 |
void |
|
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(); | |
@@ -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(" |
|
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 spy |
|
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(), |
|
137 | QCOMPARE(spy0.count(), 1); | |
142 | QCOMPARE(spy1.count(), 0); |
|
138 | QCOMPARE(spy1.count(), 0); | |
143 |
QCOMPARE(spy2.count(), |
|
139 | QCOMPARE(spy2.count(), 1); | |
144 | #endif |
|
|||
145 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
146 | } |
|
|||
147 |
|
140 | |||
148 | void tst_QValuesAxis::min_data() |
|
|||
149 | { |
|
|||
150 | QTest::addColumn<qreal>("min"); |
|
|||
151 | QTest::newRow("null") << 0.0; |
|
|||
152 | } |
|
141 | } | |
153 |
|
142 | |||
154 | // public qreal min() const |
|
143 | void tst_QValuesAxis::max_data() | |
155 | void tst_QValuesAxis::min() |
|
|||
156 | { |
|
|||
157 | #if 0 |
|
|||
158 | QFETCH(qreal, min); |
|
|||
159 |
|
||||
160 | SubQValuesAxis axis; |
|
|||
161 |
|
||||
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 | } |
|
|||
174 |
|
||||
175 | void tst_QValuesAxis::niceNumbersEnabled_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:: |
|
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(" |
|
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(), |
|
187 | QCOMPARE(spy1.count(), 1); | |
256 |
QCOMPARE(spy2.count(), |
|
188 | QCOMPARE(spy2.count(), 1); | |
257 | #endif |
|
|||
258 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
259 | } |
|
189 | } | |
260 |
|
190 | |||
261 |
void tst_QValuesAxis:: |
|
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::ti |
|
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< |
|
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( |
|
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( |
|
242 | QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal))); | |
335 |
QSignalSpy spy1( |
|
243 | QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal))); | |
336 |
QSignalSpy spy2( |
|
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:: |
|
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(" |
|
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 spy |
|
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(), |
|
287 | QCOMPARE(spy0.count(), 1); | |
368 |
QCOMPARE(spy1.count(), |
|
288 | QCOMPARE(spy1.count(), 1); | |
369 |
QCOMPARE(spy2.count(), |
|
289 | QCOMPARE(spy2.count(), 1); | |
370 | #endif |
|
|||
371 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
372 | } |
|
290 | } | |
373 |
|
291 | |||
374 |
void tst_QValuesAxis:: |
|
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::range |
|
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( |
|
331 | QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal))); | |
418 |
QSignalSpy spy1( |
|
332 | QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal))); | |
419 |
QSignalSpy spy2( |
|
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