@@ -61,6 +61,7 private slots: | |||||
61 | void mousehovered_data(); |
|
61 | void mousehovered_data(); | |
62 | void mousehovered(); |
|
62 | void mousehovered(); | |
63 | void clearWithAnimations(); |
|
63 | void clearWithAnimations(); | |
|
64 | void destruction(); | |||
64 |
|
65 | |||
65 | private: |
|
66 | private: | |
66 | QBarSeries* m_barseries; |
|
67 | QBarSeries* m_barseries; | |
@@ -565,6 +566,21 void tst_QBarSeries::clearWithAnimations() | |||||
565 | series->clear(); |
|
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 | QTEST_MAIN(tst_QBarSeries) |
|
584 | QTEST_MAIN(tst_QBarSeries) | |
569 |
|
585 | |||
570 | #include "tst_qbarseries.moc" |
|
586 | #include "tst_qbarseries.moc" |
@@ -54,6 +54,7 private slots: | |||||
54 | void clickedSignal(); |
|
54 | void clickedSignal(); | |
55 | void hoverSignal(); |
|
55 | void hoverSignal(); | |
56 | void sliceSeries(); |
|
56 | void sliceSeries(); | |
|
57 | void destruction(); | |||
57 |
|
58 | |||
58 | private: |
|
59 | private: | |
59 | void verifyCalculatedData(const QPieSeries &series, bool *ok); |
|
60 | void verifyCalculatedData(const QPieSeries &series, bool *ok); | |
@@ -283,6 +284,7 void tst_qpieseries::insert() | |||||
283 | for (int i=0; i<m_series->count(); i++) { |
|
284 | for (int i=0; i<m_series->count(); i++) { | |
284 | QCOMPARE(m_series->slices().at(i)->value(), (qreal) i+1); |
|
285 | QCOMPARE(m_series->slices().at(i)->value(), (qreal) i+1); | |
285 | QCOMPARE(m_series->slices().at(i)->label(), QString("slice ") + QString::number(i+1)); |
|
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 | QCOMPARE(slice->series(), m_series); |
|
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 | QTEST_MAIN(tst_qpieseries) |
|
592 | QTEST_MAIN(tst_qpieseries) | |
571 |
|
593 | |||
572 | #include "tst_qpieseries.moc" |
|
594 | #include "tst_qpieseries.moc" |
General Comments 0
You need to be logged in to leave comments.
Login now