##// END OF EJS Templates
Adding series destruction tests for bar & pie...
Jani Honkonen -
r1768:c46eb44b5ea1
parent child
Show More
@@ -61,6 +61,7 private slots:
61 61 void mousehovered_data();
62 62 void mousehovered();
63 63 void clearWithAnimations();
64 void destruction();
64 65
65 66 private:
66 67 QBarSeries* m_barseries;
@@ -565,6 +566,21 void tst_QBarSeries::clearWithAnimations()
565 566 series->clear();
566 567 }
567 568
569 void tst_QBarSeries::destruction()
570 {
571 // add a barset
572 QBarSeries *series = new QBarSeries();
573 QBarSet *set = new QBarSet("testset");
574 QSignalSpy spy1(set, SIGNAL(destroyed()));
575 series->append(set);
576
577 // delete the series
578 delete series;
579
580 // check that series deletes the set
581 QCOMPARE(spy1.count(), 1);
582 }
583
568 584 QTEST_MAIN(tst_QBarSeries)
569 585
570 586 #include "tst_qbarseries.moc"
@@ -54,6 +54,7 private slots:
54 54 void clickedSignal();
55 55 void hoverSignal();
56 56 void sliceSeries();
57 void destruction();
57 58
58 59 private:
59 60 void verifyCalculatedData(const QPieSeries &series, bool *ok);
@@ -283,6 +284,7 void tst_qpieseries::insert()
283 284 for (int i=0; i<m_series->count(); i++) {
284 285 QCOMPARE(m_series->slices().at(i)->value(), (qreal) i+1);
285 286 QCOMPARE(m_series->slices().at(i)->label(), QString("slice ") + QString::number(i+1));
287 QVERIFY(m_series->slices().at(i)->parent() == m_series);
286 288 }
287 289 }
288 290
@@ -567,6 +569,26 void tst_qpieseries::sliceSeries()
567 569 QCOMPARE(slice->series(), m_series);
568 570 }
569 571
572 void tst_qpieseries::destruction()
573 {
574 // add some slices
575 QPieSlice *slice1 = m_series->append("slice 1", 1);
576 QPieSlice *slice2 = m_series->append("slice 2", 2);
577 QPieSlice *slice3 = m_series->append("slice 3", 3);
578 QSignalSpy spy1(slice1, SIGNAL(destroyed()));
579 QSignalSpy spy2(slice2, SIGNAL(destroyed()));
580 QSignalSpy spy3(slice3, SIGNAL(destroyed()));
581
582 // destroy series
583 delete m_series;
584 m_series = 0;
585
586 // check that series has destroyed its slices
587 QCOMPARE(spy1.count(), 1);
588 QCOMPARE(spy2.count(), 1);
589 QCOMPARE(spy3.count(), 1);
590 }
591
570 592 QTEST_MAIN(tst_qpieseries)
571 593
572 594 #include "tst_qpieseries.moc"
General Comments 0
You need to be logged in to leave comments. Login now