##// END OF EJS Templates
fix some axis visible errors in tst_qabstractaxis
Jani Honkonen -
r2266:9bbbcc2773e8
parent child
Show More
@@ -1,847 +1,847
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "tst_qabstractaxis.h"
22 22
23 23 Q_DECLARE_METATYPE(QPen)
24 24 Q_DECLARE_METATYPE(Qt::Orientation)
25 25
26 26 void tst_QAbstractAxis::initTestCase()
27 27 {
28 28 }
29 29
30 30 void tst_QAbstractAxis::cleanupTestCase()
31 31 {
32 32 }
33 33
34 34 void tst_QAbstractAxis::init(QAbstractAxis* axis, QAbstractSeries* series)
35 35 {
36 36 m_axis = axis;
37 37 m_series = series;
38 38 m_view = new QChartView(new QChart());
39 39 m_chart = m_view->chart();
40 40 }
41 41
42 42 void tst_QAbstractAxis::cleanup()
43 43 {
44 44 delete m_view;
45 45 m_view = 0;
46 46 m_chart = 0;
47 47 m_axis = 0;
48 48 }
49 49
50 50 void tst_QAbstractAxis::qabstractaxis()
51 51 {
52 52 QCOMPARE(m_axis->linePen(), QPen());
53 53 //TODO QCOMPARE(m_axis->axisPenColor(), QColor());
54 54 QCOMPARE(m_axis->gridLinePen(), QPen());
55 55 QCOMPARE(m_axis->isLineVisible(), true);
56 56 QCOMPARE(m_axis->isGridLineVisible(), true);
57 QCOMPARE(m_axis->isVisible(), false);
57 QCOMPARE(m_axis->isVisible(), true);
58 58 QCOMPARE(m_axis->labelsAngle(), 0);
59 59 QCOMPARE(m_axis->labelsBrush(), QBrush());
60 60 //TODO QCOMPARE(m_axis->labelsColor(), QColor());
61 61 QCOMPARE(m_axis->labelsFont(), QFont());
62 62 QCOMPARE(m_axis->labelsPen(), QPen());
63 63 QCOMPARE(m_axis->labelsVisible(), true);
64 64 QCOMPARE(m_axis->orientation(), Qt::Orientation(0));
65 65 m_axis->setLineVisible(false);
66 66 m_axis->setLinePen(QPen());
67 67 m_axis->setLinePenColor(QColor());
68 68 m_axis->setGridLinePen(QPen());
69 69 m_axis->setGridLineVisible(false);
70 70 m_axis->setLabelsAngle(-1);
71 71 m_axis->setLabelsBrush(QBrush());
72 72 m_axis->setLabelsColor(QColor());
73 73 m_axis->setLabelsFont(QFont());
74 74 m_axis->setLabelsPen(QPen());
75 75 m_axis->setLabelsVisible(false);
76 76 m_axis->setMax(QVariant());
77 77 m_axis->setMin(QVariant());
78 78 m_axis->setRange(QVariant(), QVariant());
79 79 m_axis->setShadesBorderColor(QColor());
80 80 m_axis->setShadesBrush(QBrush());
81 81 m_axis->setShadesColor(QColor());
82 82 m_axis->setShadesPen(QPen());
83 83 m_axis->setShadesVisible(false);
84 84 m_axis->setVisible(false);
85 85 //TODO QCOMPARE(m_axis->shadesBorderColor(), QColor());
86 86 //TODO QCOMPARE(m_axis->shadesBrush(), QBrush());
87 87 //TODO QCOMPARE(m_axis->shadesColor(), QColor());
88 88 QCOMPARE(m_axis->shadesPen(), QPen());
89 89 QCOMPARE(m_axis->shadesVisible(), false);
90 90 m_axis->show();
91 91 m_axis->hide();
92 92 }
93 93
94 94 void tst_QAbstractAxis::axisPen_data()
95 95 {
96 96 QTest::addColumn<QPen>("axisPen");
97 97 QTest::newRow("null") << QPen();
98 98 QTest::newRow("blue") << QPen(Qt::blue);
99 99 QTest::newRow("black") << QPen(Qt::black);
100 100 QTest::newRow("red") << QPen(Qt::red);
101 101 }
102 102
103 103 void tst_QAbstractAxis::axisPen()
104 104 {
105 105 QFETCH(QPen, axisPen);
106 106
107 107 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
108 108 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
109 109 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
110 110 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
111 111 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
112 112 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
113 113 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
114 114 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
115 115 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
116 116
117 117 m_axis->setLinePen(axisPen);
118 118 QCOMPARE(m_axis->linePen(), axisPen);
119 119
120 120 QCOMPARE(spy0.count(), 0);
121 121 QCOMPARE(spy1.count(), 0);
122 122 QCOMPARE(spy2.count(), 0);
123 123 QCOMPARE(spy3.count(), 0);
124 124 QCOMPARE(spy4.count(), 0);
125 125 QCOMPARE(spy5.count(), 0);
126 126 QCOMPARE(spy6.count(), 0);
127 127 QCOMPARE(spy7.count(), 0);
128 128 QCOMPARE(spy8.count(), 0);
129 129
130 130 m_chart->setAxisX(m_axis, m_series);
131 131 m_view->show();
132 132 QTest::qWaitForWindowShown(m_view);
133 133 //TODO QCOMPARE(m_axis->axisPen(), axisPen);
134 134 }
135 135
136 136 void tst_QAbstractAxis::axisPenColor_data()
137 137 {
138 138 }
139 139
140 140 void tst_QAbstractAxis::axisPenColor()
141 141 {
142 142 QSKIP("Test is not implemented. This is deprecated function", SkipAll);
143 143 }
144 144
145 145 void tst_QAbstractAxis::gridLinePen_data()
146 146 {
147 147
148 148 QTest::addColumn<QPen>("gridLinePen");
149 149 QTest::newRow("null") << QPen();
150 150 QTest::newRow("blue") << QPen(Qt::blue);
151 151 QTest::newRow("black") << QPen(Qt::black);
152 152 QTest::newRow("red") << QPen(Qt::red);
153 153
154 154 }
155 155
156 156 void tst_QAbstractAxis::gridLinePen()
157 157 {
158 158 QFETCH(QPen, gridLinePen);
159 159
160 160 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
161 161 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
162 162 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
163 163 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
164 164 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
165 165 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
166 166 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
167 167 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
168 168 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
169 169
170 170 m_axis->setGridLinePen(gridLinePen);
171 171 QCOMPARE(m_axis->gridLinePen(), gridLinePen);
172 172
173 173 QCOMPARE(spy0.count(), 0);
174 174 QCOMPARE(spy1.count(), 0);
175 175 QCOMPARE(spy2.count(), 0);
176 176 QCOMPARE(spy3.count(), 0);
177 177 QCOMPARE(spy4.count(), 0);
178 178 QCOMPARE(spy5.count(), 0);
179 179 QCOMPARE(spy6.count(), 0);
180 180 QCOMPARE(spy7.count(), 0);
181 181 QCOMPARE(spy8.count(), 0);
182 182
183 183 m_chart->setAxisX(m_axis, m_series);
184 184 m_view->show();
185 185 QTest::qWaitForWindowShown(m_view);
186 186 //TODO QCOMPARE(m_axis->gridLinePen(), gridLinePen);
187 187 }
188 188
189 189 void tst_QAbstractAxis::lineVisible_data()
190 190 {
191 191 QTest::addColumn<bool>("lineVisible");
192 192 QTest::newRow("true") << true;
193 193 QTest::newRow("false") << false;
194 194 }
195 195
196 196 void tst_QAbstractAxis::lineVisible()
197 197 {
198 198 QFETCH(bool, lineVisible);
199 199
200 200 m_axis->setLineVisible(!lineVisible);
201 201
202 202 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
203 203 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
204 204 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
205 205 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
206 206 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
207 207 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
208 208 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
209 209 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
210 210 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
211 211
212 212 m_axis->setLineVisible(lineVisible);
213 213 QCOMPARE(m_axis->isLineVisible(), lineVisible);
214 214
215 215 QCOMPARE(spy0.count(), 1);
216 216 QCOMPARE(spy1.count(), 0);
217 217 QCOMPARE(spy2.count(), 0);
218 218 QCOMPARE(spy3.count(), 0);
219 219 QCOMPARE(spy4.count(), 0);
220 220 QCOMPARE(spy5.count(), 0);
221 221 QCOMPARE(spy6.count(), 0);
222 222 QCOMPARE(spy7.count(), 0);
223 223 QCOMPARE(spy8.count(), 0);
224 224
225 225 m_chart->setAxisX(m_axis, m_series);
226 226 m_view->show();
227 227 QTest::qWaitForWindowShown(m_view);
228 228 QCOMPARE(m_axis->isLineVisible(), lineVisible);
229 229 }
230 230
231 231 void tst_QAbstractAxis::gridLineVisible_data()
232 232 {
233 233 QTest::addColumn<bool>("gridLineVisible");
234 234 QTest::newRow("true") << true;
235 235 QTest::newRow("false") << false;
236 236 }
237 237
238 238 void tst_QAbstractAxis::gridLineVisible()
239 239 {
240 240 QFETCH(bool, gridLineVisible);
241 241
242 242 m_axis->setGridLineVisible(!gridLineVisible);
243 243
244 244 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
245 245 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
246 246 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
247 247 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
248 248 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
249 249 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
250 250 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
251 251 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
252 252 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
253 253
254 254 m_axis->setGridLineVisible(gridLineVisible);
255 255 QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible);
256 256
257 257 QCOMPARE(spy0.count(), 0);
258 258 QCOMPARE(spy1.count(), 0);
259 259 QCOMPARE(spy2.count(), 1);
260 260 QCOMPARE(spy3.count(), 0);
261 261 QCOMPARE(spy4.count(), 0);
262 262 QCOMPARE(spy5.count(), 0);
263 263 QCOMPARE(spy6.count(), 0);
264 264 QCOMPARE(spy7.count(), 0);
265 265 QCOMPARE(spy8.count(), 0);
266 266
267 267 m_chart->setAxisX(m_axis, m_series);
268 268 m_view->show();
269 269 QTest::qWaitForWindowShown(m_view);
270 270 QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible);
271 271
272 272 }
273 273
274 274 void tst_QAbstractAxis::visible_data()
275 275 {
276 276 QTest::addColumn<bool>("visible");
277 277 QTest::newRow("true") << true;
278 278 QTest::newRow("false") << false;
279 279 }
280 280
281 281 void tst_QAbstractAxis::visible()
282 282 {
283 283 QFETCH(bool, visible);
284 284
285 285 m_axis->setVisible(!visible);
286 286
287 287 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
288 288 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
289 289 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
290 290 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
291 291 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
292 292 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
293 293 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
294 294 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
295 295 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
296 296
297 297 m_axis->setVisible(visible);
298 298 QCOMPARE(m_axis->isVisible(), visible);
299 299
300 300 QCOMPARE(spy0.count(), 0);
301 301 QCOMPARE(spy1.count(), 0);
302 302 QCOMPARE(spy2.count(), 0);
303 303 QCOMPARE(spy3.count(), 0);
304 304 QCOMPARE(spy4.count(), 0);
305 305 QCOMPARE(spy5.count(), 0);
306 306 QCOMPARE(spy6.count(), 0);
307 307 QCOMPARE(spy7.count(), 0);
308 308 QCOMPARE(spy8.count(), 1);
309 309
310 310 m_chart->setAxisX(m_axis, m_series);
311 311 m_view->show();
312 312 QTest::qWaitForWindowShown(m_view);
313 QCOMPARE(m_axis->isVisible(), true);
313 QCOMPARE(m_axis->isVisible(), visible);
314 314 }
315 315
316 316 void tst_QAbstractAxis::labelsAngle_data()
317 317 {
318 318 QTest::addColumn<int>("labelsAngle");
319 319 QTest::newRow("0") << 0;
320 320 QTest::newRow("45") << 45;
321 321 QTest::newRow("90") << 90;
322 322 }
323 323
324 324 void tst_QAbstractAxis::labelsAngle()
325 325 {
326 326 QFETCH(int, labelsAngle);
327 327
328 328 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
329 329 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
330 330 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
331 331 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
332 332 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
333 333 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
334 334 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
335 335 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
336 336 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
337 337
338 338 m_axis->setLabelsAngle(labelsAngle);
339 339 QCOMPARE(m_axis->labelsAngle(), labelsAngle);
340 340
341 341 QCOMPARE(spy0.count(), 0);
342 342 QCOMPARE(spy1.count(), 0);
343 343 QCOMPARE(spy2.count(), 0);
344 344 QCOMPARE(spy3.count(), 0);
345 345 QCOMPARE(spy4.count(), 0);
346 346 QCOMPARE(spy5.count(), 0);
347 347 QCOMPARE(spy6.count(), 0);
348 348 QCOMPARE(spy7.count(), 0);
349 349 QCOMPARE(spy8.count(), 0);
350 350
351 351 m_chart->setAxisX(m_axis, m_series);
352 352 m_view->show();
353 353 QTest::qWaitForWindowShown(m_view);
354 354 QCOMPARE(m_axis->labelsAngle(), labelsAngle);
355 355 }
356 356
357 357 void tst_QAbstractAxis::labelsBrush_data()
358 358 {
359 359 QTest::addColumn<QBrush>("labelsBrush");
360 360 QTest::newRow("null") << QBrush();
361 361 QTest::newRow("blue") << QBrush(Qt::blue);
362 362 QTest::newRow("black") << QBrush(Qt::black);
363 363
364 364 }
365 365
366 366 void tst_QAbstractAxis::labelsBrush()
367 367 {
368 368
369 369 QFETCH(QBrush, labelsBrush);
370 370
371 371 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
372 372 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
373 373 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
374 374 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
375 375 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
376 376 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
377 377 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
378 378 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
379 379 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
380 380
381 381 m_axis->setLabelsBrush(labelsBrush);
382 382 QCOMPARE(m_axis->labelsBrush(), labelsBrush);
383 383
384 384 QCOMPARE(spy0.count(), 0);
385 385 QCOMPARE(spy1.count(), 0);
386 386 QCOMPARE(spy2.count(), 0);
387 387 QCOMPARE(spy3.count(), 0);
388 388 QCOMPARE(spy4.count(), 0);
389 389 QCOMPARE(spy5.count(), 0);
390 390 //TODO QCOMPARE(spy6.count(), 0);
391 391 QCOMPARE(spy7.count(), 0);
392 392 QCOMPARE(spy8.count(), 0);
393 393
394 394 m_view->show();
395 395 QTest::qWaitForWindowShown(m_view);
396 396 QCOMPARE(m_axis->labelsBrush(), labelsBrush);
397 397
398 398 }
399 399
400 400 void tst_QAbstractAxis::labelsColor_data()
401 401 {
402 402
403 403 }
404 404
405 405 void tst_QAbstractAxis::labelsColor()
406 406 {
407 407 QSKIP("Test is not implemented. This is deprecated function", SkipAll);
408 408 }
409 409
410 410 void tst_QAbstractAxis::labelsFont_data()
411 411 {
412 412 QTest::addColumn<QFont>("labelsFont");
413 413 QTest::newRow("null") << QFont();
414 414 QTest::newRow("serif") << QFont("SansSerif");
415 415 }
416 416
417 417 void tst_QAbstractAxis::labelsFont()
418 418 {
419 419
420 420 QFETCH(QFont, labelsFont);
421 421
422 422 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
423 423 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
424 424 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
425 425 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
426 426 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
427 427 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
428 428 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
429 429 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
430 430 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
431 431
432 432 m_axis->setLabelsFont(labelsFont);
433 433 QCOMPARE(m_axis->labelsFont(), labelsFont);
434 434
435 435 QCOMPARE(spy0.count(), 0);
436 436 QCOMPARE(spy1.count(), 0);
437 437 QCOMPARE(spy2.count(), 0);
438 438 QCOMPARE(spy3.count(), 0);
439 439 QCOMPARE(spy4.count(), 0);
440 440 QCOMPARE(spy5.count(), 0);
441 441 QCOMPARE(spy6.count(), 0);
442 442 QCOMPARE(spy7.count(), 0);
443 443 QCOMPARE(spy8.count(), 0);
444 444
445 445 m_view->show();
446 446 QTest::qWaitForWindowShown(m_view);
447 447 QCOMPARE(m_axis->labelsFont(), labelsFont);
448 448
449 449 }
450 450
451 451 void tst_QAbstractAxis::labelsPen_data()
452 452 {
453 453 QTest::addColumn<QPen>("labelsPen");
454 454 QTest::newRow("null") << QPen();
455 455 QTest::newRow("blue") << QPen(Qt::blue);
456 456 QTest::newRow("black") << QPen(Qt::black);
457 457 QTest::newRow("red") << QPen(Qt::red);
458 458 }
459 459
460 460 void tst_QAbstractAxis::labelsPen()
461 461 {
462 462 QFETCH(QPen, labelsPen);
463 463
464 464 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
465 465 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
466 466 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
467 467 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
468 468 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
469 469 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
470 470 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
471 471 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
472 472 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
473 473
474 474 m_axis->setLabelsPen(labelsPen);
475 475 QCOMPARE(m_axis->labelsPen(), labelsPen);
476 476
477 477 QCOMPARE(spy0.count(), 0);
478 478 QCOMPARE(spy1.count(), 0);
479 479 QCOMPARE(spy2.count(), 0);
480 480 QCOMPARE(spy3.count(), 0);
481 481 QCOMPARE(spy4.count(), 0);
482 482 QCOMPARE(spy5.count(), 0);
483 483 QCOMPARE(spy6.count(), 0);
484 484 QCOMPARE(spy7.count(), 0);
485 485 QCOMPARE(spy8.count(), 0);
486 486
487 487 m_chart->setAxisX(m_axis, m_series);
488 488 m_view->show();
489 489 QTest::qWaitForWindowShown(m_view);
490 490 //TODO QCOMPARE(m_axis->labelsPen(), labelsPen);
491 491 }
492 492
493 493 void tst_QAbstractAxis::labelsVisible_data()
494 494 {
495 495 QTest::addColumn<bool>("labelsVisible");
496 496 QTest::newRow("true") << true;
497 497 QTest::newRow("false") << false;
498 498 }
499 499
500 500 void tst_QAbstractAxis::labelsVisible()
501 501 {
502 502 QFETCH(bool, labelsVisible);
503 503
504 504 m_axis->setLabelsVisible(!labelsVisible);
505 505
506 506 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
507 507 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
508 508 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
509 509 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
510 510 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
511 511 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
512 512 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
513 513 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
514 514 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
515 515
516 516 m_axis->setLabelsVisible(labelsVisible);
517 517 QCOMPARE(m_axis->labelsVisible(), labelsVisible);
518 518
519 519 QCOMPARE(spy0.count(), 0);
520 520 QCOMPARE(spy1.count(), 0);
521 521 QCOMPARE(spy2.count(), 0);
522 522 QCOMPARE(spy3.count(), 0);
523 523 QCOMPARE(spy4.count(), 1);
524 524 QCOMPARE(spy5.count(), 0);
525 525 QCOMPARE(spy6.count(), 0);
526 526 QCOMPARE(spy7.count(), 0);
527 527 QCOMPARE(spy8.count(), 0);
528 528
529 529 m_chart->setAxisX(m_axis, m_series);
530 530 m_view->show();
531 531 QTest::qWaitForWindowShown(m_view);
532 532 QCOMPARE(m_axis->labelsVisible(), labelsVisible);
533 533 }
534 534
535 535 void tst_QAbstractAxis::orientation_data()
536 536 {
537 537 QTest::addColumn<Qt::Orientation>("orientation");
538 538 QTest::newRow("Vertical") << Qt::Vertical;
539 539 QTest::newRow("Horizontal") << Qt::Horizontal;
540 540 }
541 541
542 542 void tst_QAbstractAxis::orientation()
543 543 {
544 544 QFETCH(Qt::Orientation, orientation);
545 545
546 546 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
547 547 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
548 548 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
549 549 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
550 550 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
551 551 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
552 552 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
553 553 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
554 554 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
555 555
556 556 if(orientation==Qt::Vertical){
557 557 m_chart->setAxisY(m_axis,m_series);
558 558 }else{
559 559 m_chart->setAxisX(m_axis,m_series);
560 560 }
561 561 QCOMPARE(m_axis->orientation(), orientation);
562 562
563 563 QCOMPARE(spy0.count(), 0);
564 564 QCOMPARE(spy1.count(), 0);
565 565 QCOMPARE(spy2.count(), 0);
566 566 QCOMPARE(spy3.count(), 0);
567 567 QCOMPARE(spy4.count(), 0);
568 568 QCOMPARE(spy5.count(), 0);
569 569 QCOMPARE(spy6.count(), 0);
570 570 QCOMPARE(spy7.count(), 0);
571 571 QCOMPARE(spy8.count(), 1);
572 572
573 573 m_view->show();
574 574 QTest::qWaitForWindowShown(m_view);
575 575 QCOMPARE(m_axis->orientation(), orientation);
576 576 }
577 577
578 578 void tst_QAbstractAxis::setMax_data()
579 579 {
580 580 //just check if it does not crash
581 581 QTest::addColumn<QVariant>("max");
582 582 QTest::newRow("something") << QVariant("something");
583 583 QTest::newRow("1.0") << QVariant(1.0);
584 584 }
585 585
586 586 void tst_QAbstractAxis::setMax()
587 587 {
588 588 QFETCH(QVariant, max);
589 589 m_axis->setMax(max);
590 590 }
591 591
592 592 void tst_QAbstractAxis::setMin_data()
593 593 {
594 594 //just check if it does not crash
595 595 QTest::addColumn<QVariant>("min");
596 596 QTest::newRow("something") << QVariant("something");
597 597 QTest::newRow("1.0") << QVariant(1.0);
598 598 }
599 599
600 600 // public void setMin(QVariant const& min)
601 601 void tst_QAbstractAxis::setMin()
602 602 {
603 603 QFETCH(QVariant, min);
604 604 m_axis->setMin(min);
605 605 }
606 606
607 607 void tst_QAbstractAxis::setRange_data()
608 608 {
609 609 //just check if it does not crash
610 610 QTest::addColumn<QVariant>("min");
611 611 QTest::addColumn<QVariant>("max");
612 612 QTest::newRow("something") << QVariant("something0") << QVariant("something1");
613 613 QTest::newRow("-1 1") << QVariant(-1.0) << QVariant(1.0);
614 614 }
615 615
616 616 // public void setRange(QVariant const& min, QVariant const& max)
617 617 void tst_QAbstractAxis::setRange()
618 618 {
619 619
620 620 QFETCH(QVariant, min);
621 621 QFETCH(QVariant, max);
622 622 m_axis->setRange(min,max);
623 623 }
624 624
625 625 void tst_QAbstractAxis::shadesBorderColor_data()
626 626 {
627 627
628 628 }
629 629
630 630 void tst_QAbstractAxis::shadesBorderColor()
631 631 {
632 632 QSKIP("Test is not implemented. This is deprecated function", SkipAll);
633 633 }
634 634
635 635 void tst_QAbstractAxis::shadesBrush_data()
636 636 {
637 637 QTest::addColumn<QBrush>("shadesBrush");
638 638 QTest::newRow("null") << QBrush();
639 639 QTest::newRow("blue") << QBrush(Qt::blue);
640 640 QTest::newRow("black") << QBrush(Qt::black);
641 641 }
642 642
643 643 void tst_QAbstractAxis::shadesBrush()
644 644 {
645 645 QFETCH(QBrush, shadesBrush);
646 646
647 647 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
648 648 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
649 649 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
650 650 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
651 651 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
652 652 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
653 653 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
654 654 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
655 655 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
656 656
657 657 m_axis->setShadesBrush(shadesBrush);
658 658 QCOMPARE(m_axis->shadesBrush(), shadesBrush);
659 659
660 660 QCOMPARE(spy0.count(), 0);
661 661 QCOMPARE(spy1.count(), 0);
662 662 QCOMPARE(spy2.count(), 0);
663 663 QCOMPARE(spy3.count(), 0);
664 664 QCOMPARE(spy4.count(), 0);
665 665 QCOMPARE(spy5.count(), 0);
666 666 //TODO QCOMPARE(spy6.count(), 0);
667 667 QCOMPARE(spy7.count(), 0);
668 668 QCOMPARE(spy8.count(), 0);
669 669
670 670 m_view->show();
671 671 QTest::qWaitForWindowShown(m_view);
672 672 QCOMPARE(m_axis->shadesBrush(), shadesBrush);
673 673 }
674 674
675 675 void tst_QAbstractAxis::shadesColor_data()
676 676 {
677 677 }
678 678
679 679 // public QColor shadesColor() const
680 680 void tst_QAbstractAxis::shadesColor()
681 681 {
682 682 QSKIP("Test is not implemented. This is deprecated function", SkipAll);
683 683 }
684 684
685 685 void tst_QAbstractAxis::shadesPen_data()
686 686 {
687 687 QTest::addColumn<QPen>("shadesPen");
688 688 QTest::newRow("null") << QPen();
689 689 QTest::newRow("blue") << QPen(Qt::blue);
690 690 QTest::newRow("black") << QPen(Qt::black);
691 691 QTest::newRow("red") << QPen(Qt::red);
692 692 }
693 693
694 694 void tst_QAbstractAxis::shadesPen()
695 695 {
696 696 QFETCH(QPen, shadesPen);
697 697
698 698 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
699 699 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
700 700 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
701 701 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
702 702 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
703 703 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
704 704 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
705 705 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
706 706 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
707 707
708 708 m_axis->setShadesPen(shadesPen);
709 709 QCOMPARE(m_axis->shadesPen(), shadesPen);
710 710
711 711 QCOMPARE(spy0.count(), 0);
712 712 QCOMPARE(spy1.count(), 0);
713 713 QCOMPARE(spy2.count(), 0);
714 714 QCOMPARE(spy3.count(), 0);
715 715 QCOMPARE(spy4.count(), 0);
716 716 QCOMPARE(spy5.count(), 0);
717 717 QCOMPARE(spy6.count(), 0);
718 718 QCOMPARE(spy7.count(), 0);
719 719 QCOMPARE(spy8.count(), 0);
720 720
721 721 m_chart->setAxisX(m_axis, m_series);
722 722 m_view->show();
723 723 QTest::qWaitForWindowShown(m_view);
724 724 QCOMPARE(m_axis->shadesPen(), shadesPen);
725 725 }
726 726
727 727 void tst_QAbstractAxis::shadesVisible_data()
728 728 {
729 729 QTest::addColumn<bool>("shadesVisible");
730 730 QTest::newRow("true") << true;
731 731 QTest::newRow("false") << false;
732 732 }
733 733
734 734 void tst_QAbstractAxis::shadesVisible()
735 735 {
736 736 QFETCH(bool, shadesVisible);
737 737
738 738 m_axis->setShadesVisible(!shadesVisible);
739 739
740 740 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
741 741 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
742 742 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
743 743 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
744 744 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
745 745 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
746 746 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
747 747 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
748 748 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
749 749
750 750 m_axis->setShadesVisible(shadesVisible);
751 751 QCOMPARE(m_axis->shadesVisible(), shadesVisible);
752 752
753 753 QCOMPARE(spy0.count(), 0);
754 754 QCOMPARE(spy1.count(), 0);
755 755 QCOMPARE(spy2.count(), 0);
756 756 QCOMPARE(spy3.count(), 0);
757 757 QCOMPARE(spy4.count(), 0);
758 758 QCOMPARE(spy5.count(), 0);
759 759 QCOMPARE(spy6.count(), 0);
760 760 QCOMPARE(spy7.count(), 1);
761 761 QCOMPARE(spy8.count(), 0);
762 762
763 763 m_chart->setAxisX(m_axis, m_series);
764 764 m_view->show();
765 765 QTest::qWaitForWindowShown(m_view);
766 766 QCOMPARE(m_axis->shadesVisible(), shadesVisible);
767 767 }
768 768
769 769 void tst_QAbstractAxis::show_data()
770 770 {
771 771
772 772 }
773 773
774 774 void tst_QAbstractAxis::show()
775 775 {
776 776 m_axis->hide();
777 777 QCOMPARE(m_axis->isVisible(), false);
778 778
779 779 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
780 780 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
781 781 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
782 782 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
783 783 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
784 784 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
785 785 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
786 786 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
787 787 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
788 788
789 789 m_axis->show();
790 790
791 791 QCOMPARE(spy0.count(), 0);
792 792 QCOMPARE(spy1.count(), 0);
793 793 QCOMPARE(spy2.count(), 0);
794 794 QCOMPARE(spy3.count(), 0);
795 795 QCOMPARE(spy4.count(), 0);
796 796 QCOMPARE(spy5.count(), 0);
797 797 QCOMPARE(spy6.count(), 0);
798 798 QCOMPARE(spy7.count(), 0);
799 799 QCOMPARE(spy8.count(), 1);
800 800 QCOMPARE(m_axis->isVisible(), true);
801 801 }
802 802
803 803 void tst_QAbstractAxis::hide_data()
804 804 {
805 805
806 806 }
807 807
808 808 void tst_QAbstractAxis::hide()
809 809 {
810 810 m_axis->show();
811 811 QCOMPARE(m_axis->isVisible(),true);
812 812
813 813 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
814 814 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
815 815 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
816 816 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
817 817 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
818 818 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
819 819 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
820 820 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
821 821 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
822 822
823 823 m_axis->hide();
824 824
825 825 QCOMPARE(spy0.count(), 0);
826 826 QCOMPARE(spy1.count(), 0);
827 827 QCOMPARE(spy2.count(), 0);
828 828 QCOMPARE(spy3.count(), 0);
829 829 QCOMPARE(spy4.count(), 0);
830 830 QCOMPARE(spy5.count(), 0);
831 831 QCOMPARE(spy6.count(), 0);
832 832 QCOMPARE(spy7.count(), 0);
833 833 QCOMPARE(spy8.count(), 1);
834 834 QCOMPARE(m_axis->isVisible(),false);
835 835 }
836 836
837 837
838 838
839 839
840 840
841 841
842 842
843 843
844 844
845 845
846 846
847 847
General Comments 0
You need to be logged in to leave comments. Login now