From c6df0fc3daa87fb4de30df602be49212f700af86 2012-04-30 08:36:16 From: Michal Klocek Date: 2012-04-30 08:36:16 Subject: [PATCH] Adds missing test cases to qlineseries --- diff --git a/test/auto/qlineseries/tst_qlineseries.cpp b/test/auto/qlineseries/tst_qlineseries.cpp index ae7b4e0..e2f0515 100644 --- a/test/auto/qlineseries/tst_qlineseries.cpp +++ b/test/auto/qlineseries/tst_qlineseries.cpp @@ -62,10 +62,18 @@ class tst_QLineSeries : public QObject void remove_chart(); void remove_chart_animation_data(); void remove_chart_animation(); - void removeAll_data(); - void removeAll(); - void replace_data(); - void replace(); + void removeAll_raw_data(); + void removeAll_raw(); + void removeAll_chart_data(); + void removeAll_chart(); + void removeAll_chart_animation_data(); + void removeAll_chart_animation(); + void replace_raw_data(); + void replace_raw(); + void replace_chart_data(); + void replace_chart(); + void replace_chart_animation_data(); + void replace_chart_animation(); void setModel_data(); void setModel(); void setModelMapping_data(); @@ -194,8 +202,9 @@ void tst_QLineSeries::append_chart() { m_view->show(); m_chart->addSeries(m_series); - append_raw(); QTest::qWaitForWindowShown(m_view); + append_raw(); + } void tst_QLineSeries::append_chart_animation_data() @@ -336,8 +345,8 @@ void tst_QLineSeries::remove_chart() { m_view->show(); m_chart->addSeries(m_series); - remove_raw(); QTest::qWaitForWindowShown(m_view); + remove_raw(); } void tst_QLineSeries::remove_chart_animation_data() @@ -352,67 +361,111 @@ void tst_QLineSeries::remove_chart_animation() } -void tst_QLineSeries::removeAll_data() +void tst_QLineSeries::removeAll_raw_data() { append_data(); } -void tst_QLineSeries::removeAll() +void tst_QLineSeries::removeAll_raw() { -#if 0 - QFETCH(int, foo); + QFETCH(QList, points); + QSignalSpy spy0(m_series, SIGNAL(clicked(QPointF const&))); + m_series->append(points); + QCOMPARE(spy0.count(), 0); + QCOMPARE(m_series->points(), points); + QTest::qWait(200); + m_series->removeAll(); + QTest::qWait(200); + QCOMPARE(spy0.count(), 0); + QCOMPARE(m_series->points().count(), 0); +} - SubQXYSeries series; +void tst_QLineSeries::removeAll_chart_data() +{ + append_data(); +} - QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); - QSignalSpy spy1(&series, SIGNAL(selected())); +void tst_QLineSeries::removeAll_chart() +{ + m_view->show(); + m_chart->addSeries(m_series); + QTest::qWaitForWindowShown(m_view); + removeAll_raw(); +} - series.removeAll(); +void tst_QLineSeries::removeAll_chart_animation_data() +{ + append_data(); +} - QCOMPARE(spy0.count(), 0); - QCOMPARE(spy1.count(), 0); -#endif - QSKIP("Test is not implemented.", SkipAll); +void tst_QLineSeries::removeAll_chart_animation() +{ + m_chart->setAnimationOptions(QChart::AllAnimations); + removeAll_chart(); } -void tst_QLineSeries::replace_data() +void tst_QLineSeries::replace_raw_data() { - QTest::addColumn("point"); - QTest::newRow("null") << QPointF(); + append_data(); } -void tst_QLineSeries::replace() +void tst_QLineSeries::replace_raw() { -#if 0 - QFETCH(QPointF, point); + QFETCH(QList, points); + QSignalSpy spy0(m_series, SIGNAL(clicked(QPointF const&))); + m_series->append(points); + QCOMPARE(spy0.count(), 0); + QCOMPARE(m_series->points(), points); + QTest::qWait(200); + + foreach(const QPointF& point,points) + { + m_series->replace(point.x(),point.y(),point.x(),0); + QTest::qWait(200); + } - SubQXYSeries series; + QList newPoints = m_series->points(); - QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); - QSignalSpy spy1(&series, SIGNAL(selected())); + QCOMPARE(newPoints.count(), points.count()); + + for(int i =0 ; ishow(); + m_chart->addSeries(m_series); + QTest::qWaitForWindowShown(m_view); + replace_raw(); +} + +void tst_QLineSeries::replace_chart_animation_data() +{ + append_data(); +} + +void tst_QLineSeries::replace_chart_animation() +{ + m_chart->setAnimationOptions(QChart::AllAnimations); + replace_chart(); } void tst_QLineSeries::setModel_data() { - // QTest::addColumn("model"); - // QTest::addColumn("expected"); - // QTest::newRow("null") << 0 << 0; - // QTest::newRow("QStandardItemModel") << new QStandardItemModel() << new QStandardItemModel(); } void tst_QLineSeries::setModel() { - // QFETCH(QStandardItemModel *, model); - // QFETCH(QStandardItemModel *, expected); - QLineSeries series; series.setModel(0); QVERIFY2(series.model() == 0, "Model should be unset");