##// END OF EJS Templates
Adds missing test cases to qlineseries
Michal Klocek -
r1099:c6df0fc3daa8
parent child
Show More
@@ -62,10 +62,18 class tst_QLineSeries : public QObject
62 void remove_chart();
62 void remove_chart();
63 void remove_chart_animation_data();
63 void remove_chart_animation_data();
64 void remove_chart_animation();
64 void remove_chart_animation();
65 void removeAll_data();
65 void removeAll_raw_data();
66 void removeAll();
66 void removeAll_raw();
67 void replace_data();
67 void removeAll_chart_data();
68 void replace();
68 void removeAll_chart();
69 void removeAll_chart_animation_data();
70 void removeAll_chart_animation();
71 void replace_raw_data();
72 void replace_raw();
73 void replace_chart_data();
74 void replace_chart();
75 void replace_chart_animation_data();
76 void replace_chart_animation();
69 void setModel_data();
77 void setModel_data();
70 void setModel();
78 void setModel();
71 void setModelMapping_data();
79 void setModelMapping_data();
@@ -194,8 +202,9 void tst_QLineSeries::append_chart()
194 {
202 {
195 m_view->show();
203 m_view->show();
196 m_chart->addSeries(m_series);
204 m_chart->addSeries(m_series);
197 append_raw();
198 QTest::qWaitForWindowShown(m_view);
205 QTest::qWaitForWindowShown(m_view);
206 append_raw();
207
199 }
208 }
200
209
201 void tst_QLineSeries::append_chart_animation_data()
210 void tst_QLineSeries::append_chart_animation_data()
@@ -336,8 +345,8 void tst_QLineSeries::remove_chart()
336 {
345 {
337 m_view->show();
346 m_view->show();
338 m_chart->addSeries(m_series);
347 m_chart->addSeries(m_series);
339 remove_raw();
340 QTest::qWaitForWindowShown(m_view);
348 QTest::qWaitForWindowShown(m_view);
349 remove_raw();
341 }
350 }
342
351
343 void tst_QLineSeries::remove_chart_animation_data()
352 void tst_QLineSeries::remove_chart_animation_data()
@@ -352,67 +361,111 void tst_QLineSeries::remove_chart_animation()
352 }
361 }
353
362
354
363
355 void tst_QLineSeries::removeAll_data()
364 void tst_QLineSeries::removeAll_raw_data()
356 {
365 {
357 append_data();
366 append_data();
358 }
367 }
359
368
360 void tst_QLineSeries::removeAll()
369 void tst_QLineSeries::removeAll_raw()
361 {
370 {
362 #if 0
371 QFETCH(QList<QPointF>, points);
363 QFETCH(int, foo);
372 QSignalSpy spy0(m_series, SIGNAL(clicked(QPointF const&)));
373 m_series->append(points);
374 QCOMPARE(spy0.count(), 0);
375 QCOMPARE(m_series->points(), points);
376 QTest::qWait(200);
377 m_series->removeAll();
378 QTest::qWait(200);
379 QCOMPARE(spy0.count(), 0);
380 QCOMPARE(m_series->points().count(), 0);
381 }
364
382
365 SubQXYSeries series;
383 void tst_QLineSeries::removeAll_chart_data()
384 {
385 append_data();
386 }
366
387
367 QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&)));
388 void tst_QLineSeries::removeAll_chart()
368 QSignalSpy spy1(&series, SIGNAL(selected()));
389 {
390 m_view->show();
391 m_chart->addSeries(m_series);
392 QTest::qWaitForWindowShown(m_view);
393 removeAll_raw();
394 }
369
395
370 series.removeAll();
396 void tst_QLineSeries::removeAll_chart_animation_data()
397 {
398 append_data();
399 }
371
400
372 QCOMPARE(spy0.count(), 0);
401 void tst_QLineSeries::removeAll_chart_animation()
373 QCOMPARE(spy1.count(), 0);
402 {
374 #endif
403 m_chart->setAnimationOptions(QChart::AllAnimations);
375 QSKIP("Test is not implemented.", SkipAll);
404 removeAll_chart();
376 }
405 }
377
406
378 void tst_QLineSeries::replace_data()
407 void tst_QLineSeries::replace_raw_data()
379 {
408 {
380 QTest::addColumn<QPointF>("point");
409 append_data();
381 QTest::newRow("null") << QPointF();
382 }
410 }
383
411
384 void tst_QLineSeries::replace()
412 void tst_QLineSeries::replace_raw()
385 {
413 {
386 #if 0
414 QFETCH(QList<QPointF>, points);
387 QFETCH(QPointF, point);
415 QSignalSpy spy0(m_series, SIGNAL(clicked(QPointF const&)));
416 m_series->append(points);
417 QCOMPARE(spy0.count(), 0);
418 QCOMPARE(m_series->points(), points);
419 QTest::qWait(200);
420
421 foreach(const QPointF& point,points)
422 {
423 m_series->replace(point.x(),point.y(),point.x(),0);
424 QTest::qWait(200);
425 }
388
426
389 SubQXYSeries series;
427 QList<QPointF> newPoints = m_series->points();
390
428
391 QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&)));
429 QCOMPARE(newPoints.count(), points.count());
392 QSignalSpy spy1(&series, SIGNAL(selected()));
430
431 for(int i =0 ; i<points.count() ; ++i) {
432 QCOMPARE(points[i].x(), newPoints[i].x());
433 QCOMPARE(newPoints[i].y(), 0.0);
434 }
435 }
393
436
394 series.replace(point);
395
437
396 QCOMPARE(spy0.count(), 0);
438 void tst_QLineSeries::replace_chart_data()
397 QCOMPARE(spy1.count(), 0);
439 {
398 #endif
440 append_data();
399 QSKIP("Test is not implemented.", SkipAll);
441 }
442
443 void tst_QLineSeries::replace_chart()
444 {
445 m_view->show();
446 m_chart->addSeries(m_series);
447 QTest::qWaitForWindowShown(m_view);
448 replace_raw();
449 }
450
451 void tst_QLineSeries::replace_chart_animation_data()
452 {
453 append_data();
454 }
455
456 void tst_QLineSeries::replace_chart_animation()
457 {
458 m_chart->setAnimationOptions(QChart::AllAnimations);
459 replace_chart();
400 }
460 }
401
461
402 void tst_QLineSeries::setModel_data()
462 void tst_QLineSeries::setModel_data()
403 {
463 {
404 // QTest::addColumn<QStandardItemModel *>("model");
405 // QTest::addColumn<QStandardItemModel *>("expected");
406
464
407 // QTest::newRow("null") << 0 << 0;
408 // QTest::newRow("QStandardItemModel") << new QStandardItemModel() << new QStandardItemModel();
409 }
465 }
410
466
411 void tst_QLineSeries::setModel()
467 void tst_QLineSeries::setModel()
412 {
468 {
413 // QFETCH(QStandardItemModel *, model);
414 // QFETCH(QStandardItemModel *, expected);
415
416 QLineSeries series;
469 QLineSeries series;
417 series.setModel(0);
470 series.setModel(0);
418 QVERIFY2(series.model() == 0, "Model should be unset");
471 QVERIFY2(series.model() == 0, "Model should be unset");
General Comments 0
You need to be logged in to leave comments. Login now