@@ -200,7 +200,7 void QValuesAxis::setRange(qreal min, qreal max) | |||
|
200 | 200 | void QValuesAxis::setTicksCount(int count) |
|
201 | 201 | { |
|
202 | 202 | Q_D(QValuesAxis); |
|
203 | if (d->m_tickCount != count) { | |
|
203 | if (d->m_tickCount != count && count >=2) { | |
|
204 | 204 | d->m_tickCount = count; |
|
205 | 205 | d->emitUpdated(); |
|
206 | 206 | } |
@@ -221,7 +221,7 void QValuesAxis::setNiceNumbersEnabled(bool enable) | |||
|
221 | 221 | Q_D(QValuesAxis); |
|
222 | 222 | if (d->m_niceNumbers != enable){ |
|
223 | 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 | 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 | 659 | QTEST_MAIN(tst_Domain) |
|
732 | 660 | #include "tst_domain.moc" |
|
733 | 661 |
@@ -36,45 +36,42 private slots: | |||
|
36 | 36 | void qvaluesaxis_data(); |
|
37 | 37 | void qvaluesaxis(); |
|
38 | 38 | |
|
39 | void max_raw_data(); | |
|
40 | void max_raw(); | |
|
39 | 41 | void max_data(); |
|
40 | 42 | void max(); |
|
43 | void max_animation_data(); | |
|
44 | void max_animation(); | |
|
45 | void min_raw_data(); | |
|
46 | void min_raw(); | |
|
41 | 47 | void min_data(); |
|
42 | 48 | void min(); |
|
49 | void min_animation_data(); | |
|
50 | void min_animation(); | |
|
43 | 51 | void niceNumbersEnabled_data(); |
|
44 | 52 | void niceNumbersEnabled(); |
|
45 |
void |
|
|
46 | void setNiceNumbersEnabled(); | |
|
47 |
void |
|
|
48 |
void |
|
|
49 |
void |
|
|
50 |
void |
|
|
53 | void range_raw_data(); | |
|
54 | void range_raw(); | |
|
55 | void range_data(); | |
|
56 | void range(); | |
|
57 | void range_animation_data(); | |
|
58 | void range_animation(); | |
|
51 | 59 | void ticksCount_data(); |
|
52 | 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 | 62 | private: |
|
63 | 63 | QValuesAxis* m_valuesaxis; |
|
64 | 64 | QLineSeries* m_series; |
|
65 | 65 | }; |
|
66 | 66 | |
|
67 | ||
|
68 | 67 | void tst_QValuesAxis::initTestCase() |
|
69 | 68 | { |
|
70 | 69 | } |
|
71 | 70 | |
|
72 | ||
|
73 | 71 | void tst_QValuesAxis::cleanupTestCase() |
|
74 | 72 | { |
|
75 | 73 | } |
|
76 | 74 | |
|
77 | ||
|
78 | 75 | void tst_QValuesAxis::init() |
|
79 | 76 | { |
|
80 | 77 | m_valuesaxis = new QValuesAxis(); |
@@ -118,313 +115,235 void tst_QValuesAxis::qvaluesaxis() | |||
|
118 | 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 | 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 | |
|
128 | void tst_QValuesAxis::max() | |
|
126 | void tst_QValuesAxis::max_raw() | |
|
129 | 127 | { |
|
130 | #if 0 | |
|
131 | 128 | QFETCH(qreal, max); |
|
132 | 129 | |
|
133 | SubQValuesAxis axis; | |
|
134 | ||
|
135 |
QSignalSpy spy |
|
|
136 | QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal))); | |
|
137 | QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal))); | |
|
130 | QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal))); | |
|
131 | QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal))); | |
|
132 | QSignalSpy spy2(m_valuesaxis, 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 | 138 | QCOMPARE(spy1.count(), 0); |
|
143 |
QCOMPARE(spy2.count(), |
|
|
144 | #endif | |
|
145 | QSKIP("Test is not implemented.", SkipAll); | |
|
146 | } | |
|
139 | QCOMPARE(spy2.count(), 1); | |
|
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 | |
|
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() | |
|
143 | void tst_QValuesAxis::max_data() | |
|
176 | 144 | { |
|
177 | QTest::addColumn<bool>("niceNumbersEnabled"); | |
|
178 | QTest::newRow("true") << true; | |
|
179 | QTest::newRow("false") << false; | |
|
145 | max_raw_data(); | |
|
180 | 146 | } |
|
181 | 147 | |
|
182 | // public bool niceNumbersEnabled() const | |
|
183 | void tst_QValuesAxis::niceNumbersEnabled() | |
|
148 | void tst_QValuesAxis::max() | |
|
184 | 149 | { |
|
185 | #if 0 | |
|
186 | QFETCH(bool, niceNumbersEnabled); | |
|
187 | ||
|
188 | SubQValuesAxis axis; | |
|
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); | |
|
150 | m_chart->setAxisX(m_valuesaxis, m_series); | |
|
151 | m_view->show(); | |
|
152 | QTest::qWaitForWindowShown(m_view); | |
|
153 | max_raw(); | |
|
201 | 154 | } |
|
202 | 155 | |
|
203 | ||
|
204 | void tst_QValuesAxis::setNiceNumbersEnabled_data() | |
|
156 | void tst_QValuesAxis::max_animation_data() | |
|
205 | 157 | { |
|
206 | QTest::addColumn<bool>("enable"); | |
|
207 | QTest::newRow("true") << true; | |
|
208 | QTest::newRow("false") << false; | |
|
158 | max_data(); | |
|
209 | 159 | } |
|
210 | 160 | |
|
211 | // public void setNiceNumbersEnabled(bool enable = true) | |
|
212 | void tst_QValuesAxis::setNiceNumbersEnabled() | |
|
161 | void tst_QValuesAxis::max_animation() | |
|
213 | 162 | { |
|
214 | #if 0 | |
|
215 | QFETCH(bool, enable); | |
|
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); | |
|
163 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); | |
|
164 | max(); | |
|
230 | 165 | } |
|
231 | 166 | |
|
232 |
void tst_QValuesAxis:: |
|
|
167 | void tst_QValuesAxis::min_raw_data() | |
|
233 | 168 | { |
|
234 | 169 | QTest::addColumn<qreal>("min"); |
|
235 | QTest::addColumn<qreal>("max"); | |
|
236 |
QTest::newRow(" |
|
|
170 | QTest::newRow("-1.0") << -1.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) | |
|
240 | void tst_QValuesAxis::setRange() | |
|
175 | void tst_QValuesAxis::min_raw() | |
|
241 | 176 | { |
|
242 | #if 0 | |
|
243 | 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))); | |
|
249 | QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal))); | |
|
250 | QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal))); | |
|
251 | ||
|
252 | axis.setRange(min, max); | |
|
183 | m_valuesaxis->setMin(min); | |
|
184 | QVERIFY2(qFuzzyIsNull(m_valuesaxis->min() - min), "Not equal"); | |
|
253 | 185 | |
|
254 | 186 | QCOMPARE(spy0.count(), 0); |
|
255 |
QCOMPARE(spy1.count(), |
|
|
256 |
QCOMPARE(spy2.count(), |
|
|
257 | #endif | |
|
258 | QSKIP("Test is not implemented.", SkipAll); | |
|
187 | QCOMPARE(spy1.count(), 1); | |
|
188 | QCOMPARE(spy2.count(), 1); | |
|
259 | 189 | } |
|
260 | 190 | |
|
261 |
void tst_QValuesAxis:: |
|
|
191 | void tst_QValuesAxis::min_data() | |
|
262 | 192 | { |
|
263 | QTest::addColumn<int>("count"); | |
|
264 | QTest::newRow("0") << 0; | |
|
265 | QTest::newRow("-1") << -1; | |
|
193 | min_raw_data(); | |
|
266 | 194 | } |
|
267 | 195 | |
|
268 | // public void setTicksCount(int count) | |
|
269 | void tst_QValuesAxis::setTicksCount() | |
|
196 | void tst_QValuesAxis::min() | |
|
270 | 197 | { |
|
271 | #if 0 | |
|
272 | QFETCH(int, count); | |
|
273 | ||
|
274 | SubQValuesAxis axis; | |
|
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); | |
|
198 | m_chart->setAxisX(m_valuesaxis, m_series); | |
|
199 | m_view->show(); | |
|
200 | QTest::qWaitForWindowShown(m_view); | |
|
201 | min_raw(); | |
|
287 | 202 | } |
|
288 | 203 | |
|
289 |
void tst_QValuesAxis::ti |
|
|
204 | void tst_QValuesAxis::min_animation_data() | |
|
290 | 205 | { |
|
291 | QTest::addColumn<int>("ticksCount"); | |
|
292 | QTest::newRow("0") << 0; | |
|
293 | QTest::newRow("-1") << -1; | |
|
206 | min_data(); | |
|
294 | 207 | } |
|
295 | 208 | |
|
296 | // public int ticksCount() const | |
|
297 | void tst_QValuesAxis::ticksCount() | |
|
209 | void tst_QValuesAxis::min_animation() | |
|
298 | 210 | { |
|
299 | #if 0 | |
|
300 | QFETCH(int, ticksCount); | |
|
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); | |
|
211 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); | |
|
212 | min(); | |
|
315 | 213 | } |
|
316 | 214 | |
|
317 | Q_DECLARE_METATYPE(QAbstractAxis::AxisType) | |
|
318 | void tst_QValuesAxis::type_data() | |
|
215 | void tst_QValuesAxis::niceNumbersEnabled_data() | |
|
319 | 216 | { |
|
320 | #if 0 | |
|
321 |
QTest::addColumn< |
|
|
322 | QTest::newRow("null") << AxisType(); | |
|
323 | #endif | |
|
217 | QTest::addColumn<bool>("niceNumbersEnabled"); | |
|
218 | QTest::addColumn<qreal>("min"); | |
|
219 | QTest::addColumn<qreal>("max"); | |
|
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 | |
|
327 | void tst_QValuesAxis::type() | |
|
232 | void tst_QValuesAxis::niceNumbersEnabled() | |
|
328 | 233 | { |
|
329 | #if 0 | |
|
330 |
QFETCH( |
|
|
331 | ||
|
332 | SubQValuesAxis axis; | |
|
234 | QFETCH(bool, niceNumbersEnabled); | |
|
235 | QFETCH(qreal, min); | |
|
236 | QFETCH(qreal, max); | |
|
237 | QFETCH(int, ticks); | |
|
238 | QFETCH(qreal, expectedMin); | |
|
239 | QFETCH(qreal, expectedMax); | |
|
240 | QFETCH(int, expectedTicks); | |
|
333 | 241 | |
|
334 |
QSignalSpy spy0( |
|
|
335 |
QSignalSpy spy1( |
|
|
336 |
QSignalSpy spy2( |
|
|
242 | QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal))); | |
|
243 | QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(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 | 249 | QCOMPARE(spy0.count(), 0); |
|
341 | 250 | QCOMPARE(spy1.count(), 0); |
|
342 | 251 | QCOMPARE(spy2.count(), 0); |
|
343 | #endif | |
|
344 | QSKIP("Test is not implemented.", SkipAll); | |
|
252 | ||
|
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 | 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) | |
|
354 | void tst_QValuesAxis::maxChanged() | |
|
274 | void tst_QValuesAxis::range_raw() | |
|
355 | 275 | { |
|
356 | #if 0 | |
|
276 | QFETCH(qreal, min); | |
|
357 | 277 | QFETCH(qreal, max); |
|
358 | 278 | |
|
359 | SubQValuesAxis axis; | |
|
360 | ||
|
361 |
QSignalSpy spy |
|
|
362 | QSignalSpy spy1(&axis, SIGNAL(minChanged(qreal))); | |
|
363 | QSignalSpy spy2(&axis, SIGNAL(rangeChanged(qreal, qreal))); | |
|
279 | QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal))); | |
|
280 | QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal))); | |
|
281 | QSignalSpy spy2(m_valuesaxis, 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(), |
|
|
368 |
QCOMPARE(spy1.count(), |
|
|
369 |
QCOMPARE(spy2.count(), |
|
|
370 | #endif | |
|
371 | QSKIP("Test is not implemented.", SkipAll); | |
|
287 | QCOMPARE(spy0.count(), 1); | |
|
288 | QCOMPARE(spy1.count(), 1); | |
|
289 | QCOMPARE(spy2.count(), 1); | |
|
372 | 290 | } |
|
373 | 291 | |
|
374 |
void tst_QValuesAxis:: |
|
|
292 | void tst_QValuesAxis::range_data() | |
|
375 | 293 | { |
|
376 | QTest::addColumn<qreal>("min"); | |
|
377 | QTest::newRow("null") << 0.0; | |
|
294 | range_raw_data(); | |
|
378 | 295 | } |
|
379 | 296 | |
|
380 | // protected void minChanged(qreal min) | |
|
381 | void tst_QValuesAxis::minChanged() | |
|
297 | void tst_QValuesAxis::range() | |
|
382 | 298 | { |
|
383 | #if 0 | |
|
384 | QFETCH(qreal, min); | |
|
385 | ||
|
386 | SubQValuesAxis axis; | |
|
387 | ||
|
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); | |
|
299 | m_chart->setAxisX(m_valuesaxis, m_series); | |
|
300 | m_view->show(); | |
|
301 | QTest::qWaitForWindowShown(m_view); | |
|
302 | range_raw(); | |
|
303 | } | |
|
393 | 304 | |
|
394 | QCOMPARE(spy0.count(), 0); | |
|
395 | QCOMPARE(spy1.count(), 0); | |
|
396 | QCOMPARE(spy2.count(), 0); | |
|
397 | #endif | |
|
398 | QSKIP("Test is not implemented.", SkipAll); | |
|
305 | void tst_QValuesAxis::range_animation_data() | |
|
306 | { | |
|
307 | range_data(); | |
|
399 | 308 | } |
|
400 | 309 | |
|
401 |
void tst_QValuesAxis::range |
|
|
310 | void tst_QValuesAxis::range_animation() | |
|
402 | 311 | { |
|
403 | QTest::addColumn<qreal>("min"); | |
|
404 | QTest::addColumn<qreal>("max"); | |
|
405 | QTest::newRow("null") << 0.0 << 0.0; | |
|
312 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); | |
|
313 | range(); | |
|
406 | 314 | } |
|
407 | 315 | |
|
408 | // protected void rangeChanged(qreal min, qreal max) | |
|
409 | void tst_QValuesAxis::rangeChanged() | |
|
316 | void tst_QValuesAxis::ticksCount_data() | |
|
410 | 317 | { |
|
411 | #if 0 | |
|
412 | QFETCH(qreal, min); | |
|
413 | QFETCH(qreal, max); | |
|
318 | QTest::addColumn<int>("ticksCount"); | |
|
319 | QTest::addColumn<int>("expectedCount"); | |
|
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( |
|
|
418 |
QSignalSpy spy1( |
|
|
419 |
QSignalSpy spy2( |
|
|
331 | QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal))); | |
|
332 | QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(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 | 338 | QCOMPARE(spy0.count(), 0); |
|
424 | 339 | QCOMPARE(spy1.count(), 0); |
|
425 | 340 | QCOMPARE(spy2.count(), 0); |
|
426 | #endif | |
|
427 | QSKIP("Test is not implemented.", SkipAll); | |
|
341 | ||
|
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 | 349 | QTEST_MAIN(tst_QValuesAxis) |
General Comments 0
You need to be logged in to leave comments.
Login now