From b9dcdbcfffe64b88a937cfb8b02e62de80855f15 2012-06-28 11:04:07 From: Michal Klocek Date: 2012-06-28 11:04:07 Subject: [PATCH] Chartdataset fixes + tst update --- diff --git a/src/chartdataset.cpp b/src/chartdataset.cpp index 84cf893..5f642a9 100644 --- a/src/chartdataset.cpp +++ b/src/chartdataset.cpp @@ -127,7 +127,7 @@ void ChartDataSet::removeSeries(QAbstractSeries* series) if(x==-1) { emit axisRemoved(axisX); - axisX->deleteLater(); + delete axisX; } } @@ -140,7 +140,7 @@ void ChartDataSet::removeSeries(QAbstractSeries* series) if(y==-1) { emit axisRemoved(axisY); - axisY->deleteLater(); + delete axisY; } } } diff --git a/tests/auto/chartdataset/tst_chartdataset.cpp b/tests/auto/chartdataset/tst_chartdataset.cpp index c5f19aa..c78759c 100644 --- a/tests/auto/chartdataset/tst_chartdataset.cpp +++ b/tests/auto/chartdataset/tst_chartdataset.cpp @@ -175,9 +175,9 @@ void tst_ChartDataSet::addSeries() void tst_ChartDataSet::setAxisX_data() { - QTest::addColumn >("seriesList"); - QTest::addColumn > ("axisList"); - QTest::addColumn ("axisCount"); + QTest::addColumn >("seriesList"); + QTest::addColumn >("axisList"); + QTest::addColumn("axisCount"); QAbstractSeries* line = new QLineSeries(this); QAbstractSeries* area = new QAreaSeries(static_cast(line)); @@ -188,15 +188,20 @@ void tst_ChartDataSet::setAxisX_data() QAbstractSeries* percent = new QPercentBarSeries(this); QAbstractSeries* stacked = new QStackedBarSeries(this); - QValuesAxis* valueaxis0 = new QValuesAxis(this); - QValuesAxis* valueaxis1 = new QValuesAxis(this); - QValuesAxis* valueaxis2 = new QValuesAxis(this); - QCategoriesAxis* categoriesaxis = new QCategoriesAxis(this); + QTest::newRow("line,spline,scatter: axis 0 axis1 axis 2") + << (QList() << line << spline << scatter) + << (QList() << new QValuesAxis(this) << new QValuesAxis(this) << new QValuesAxis(this)) << 3; + + QTest::newRow("area: axis 0") << (QList() << area) + << (QList() << new QValuesAxis(this)) << 1; - QTest::newRow("line,spline,scatter: axis 0 axis1 axis 2") << ( QList() << line << spline << scatter) << ( QList() << valueaxis0 << valueaxis1 << valueaxis2) << 3; - QTest::newRow("area: axis 0") << ( QList() << area) << ( QList() << valueaxis0) << 1; - QTest::newRow("area, spline, scatter: axis 0 axis1 axis 1") << ( QList() << area << spline << scatter) << ( QList() << valueaxis0 << valueaxis1 << valueaxis1) << 2; - //TODO: add more test cases + QList axes0; + axes0 << new QValuesAxis(this) << new QValuesAxis(this); + axes0 << axes0.last(); + QTest::newRow("line,spline,scatter: axis 0 axis1 axis 1") + << (QList() << line << spline << scatter) + << axes0 << 2; + //TODO: add more test cases } void tst_ChartDataSet::setAxisX() @@ -321,24 +326,12 @@ void tst_ChartDataSet::removeAllSeries_data() QTest::addColumn >("axisList"); QTest::addColumn("axisCount"); - QAbstractSeries* line = new QLineSeries(this); - QAbstractSeries* area = new QAreaSeries(static_cast(line)); - QAbstractSeries* scatter = new QScatterSeries(this); - QAbstractSeries* spline = new QSplineSeries(this); - QAbstractSeries* pie = new QPieSeries(this); - QAbstractSeries* bar = new QBarSeries(this); - QAbstractSeries* percent = new QPercentBarSeries(this); - QAbstractSeries* stacked = new QStackedBarSeries(this); - - QValuesAxis* valueaxis0 = new QValuesAxis(this); - QValuesAxis* valueaxis1 = new QValuesAxis(this); - QValuesAxis* valueaxis2 = new QValuesAxis(this); - QTest::newRow("line,spline,scatter: axis 0 axis1 axis 2") - << (QList() << line << spline << scatter) - << (QList() << valueaxis0 << valueaxis1 << valueaxis2) << 3; + << (QList() << new QLineSeries(this) << new QSplineSeries(this) + << new QScatterSeries(this)) + << (QList() << new QValuesAxis(this) << new QValuesAxis(this) + << new QValuesAxis(this)) << 3; //TODO: - } void tst_ChartDataSet::removeAllSeries()