From 5580e2c7f492ad151a754cf70234e85a1395f921 2012-04-05 08:52:51 From: Michal Klocek Date: 2012-04-05 08:52:51 Subject: [PATCH] Bugfix in barchartmodel max -> return 0if no count --- diff --git a/src/barchart/barchartmodel.cpp b/src/barchart/barchartmodel.cpp index 61f6716..c07ab78 100644 --- a/src/barchart/barchartmodel.cpp +++ b/src/barchart/barchartmodel.cpp @@ -103,8 +103,7 @@ qreal BarChartModel::min() const qreal BarChartModel::max() const { - Q_ASSERT(m_dataModel.count() > 0); - + if (m_dataModel.count() == 0) return 0; // TODO: make min and max members and update them when data changes. // This is slower since they are checked every time, even if data is same since previous call. qreal max = INT_MIN; diff --git a/test/auto/qchart/tst_qchart.cpp b/test/auto/qchart/tst_qchart.cpp index c744827..77742d5 100644 --- a/test/auto/qchart/tst_qchart.cpp +++ b/test/auto/qchart/tst_qchart.cpp @@ -203,7 +203,7 @@ void tst_QChart::addSeries() m_view->show(); QTest::qWaitForWindowShown(m_view); if(!axis) axis = m_chart->axisY(); - //m_chart->addSeries(series,axis); + m_chart->addSeries(series,axis); QCOMPARE(m_chart->axisY(series),axis); } @@ -222,7 +222,6 @@ void tst_QChart::animationOptions() QFETCH(QChart::AnimationOption, animationOptions); m_chart->setAnimationOptions(animationOptions); QCOMPARE(m_chart->animationOptions(), animationOptions); - } void tst_QChart::axisX_data()