diff --git a/test/auto/qchart/tst_qchart.cpp b/test/auto/qchart/tst_qchart.cpp index be266c4..c744827 100644 --- a/test/auto/qchart/tst_qchart.cpp +++ b/test/auto/qchart/tst_qchart.cpp @@ -13,6 +13,7 @@ QTCOMMERCIALCHART_USE_NAMESPACE Q_DECLARE_METATYPE(QChartAxis*) Q_DECLARE_METATYPE(QSeries*) +Q_DECLARE_METATYPE(QChart::AnimationOption) class tst_QChart : public QObject { @@ -58,8 +59,6 @@ private slots: void scrollRight(); void scrollUp_data(); void scrollUp(); - void setAnimationOptions_data(); - void setAnimationOptions(); void setBackgroundBrush_data(); void setBackgroundBrush(); void setBackgroundPen_data(); @@ -88,6 +87,9 @@ private slots: void zoomOut(); private: + void createTestData(); + +private: QChartView* m_view; QChart* m_chart; }; @@ -106,7 +108,15 @@ void tst_QChart::init() { m_view = new QChartView(new QChart()); m_chart = m_view->chart(); +} +void tst_QChart::createTestData() +{ + QLineSeries* series0 = new QLineSeries(this); + *series0 << QPointF(0, 0) << QPointF(100, 100); + m_chart->addSeries(series0); + m_view->show(); + QTest::qWaitForWindowShown(m_view); } void tst_QChart::cleanup() @@ -190,31 +200,29 @@ void tst_QChart::addSeries() { QFETCH(QSeries*, series); QFETCH(QChartAxis*, axis); + 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); } -Q_DECLARE_METATYPE(QChart::AnimationOptions) void tst_QChart::animationOptions_data() { -#if 0 - QTest::addColumn("animationOptions"); - QTest::newRow("null") << QChart::AnimationOptions(); -#endif + QTest::addColumn("animationOptions"); + QTest::newRow("AllAnimations") << QChart::AllAnimations; + QTest::newRow("NoAnimation") << QChart::NoAnimation; + QTest::newRow("GridAxisAnimations") << QChart::GridAxisAnimations; + QTest::newRow("SeriesAnimations") << QChart::SeriesAnimations; } -// public QChart::AnimationOptions animationOptions() const void tst_QChart::animationOptions() { -#if 0 - QFETCH(QChart::AnimationOptions, animationOptions); + createTestData(); + QFETCH(QChart::AnimationOption, animationOptions); + m_chart->setAnimationOptions(animationOptions); + QCOMPARE(m_chart->animationOptions(), animationOptions); - SubQChart chart; - - QCOMPARE(chart.animationOptions(), animationOptions); -#endif - QSKIP("Test is not implemented.", SkipAll); } void tst_QChart::axisX_data() @@ -484,27 +492,6 @@ void tst_QChart::scrollUp() QSKIP("Test is not implemented.", SkipAll); } -void tst_QChart::setAnimationOptions_data() -{ -#if 0 - QTest::addColumn("options"); - QTest::newRow("null") << QChart::AnimationOptions(); -#endif -} - -// public void setAnimationOptions(QChart::AnimationOptions options) -void tst_QChart::setAnimationOptions() -{ -#if 0 - QFETCH(QChart::AnimationOptions, options); - - SubQChart chart; - - chart.setAnimationOptions(options); -#endif - QSKIP("Test is not implemented.", SkipAll); -} - void tst_QChart::setBackgroundBrush_data() { #if 0 diff --git a/test/auto/qchartview/tst_qchartview.cpp b/test/auto/qchartview/tst_qchartview.cpp index a43cdda..a0c787e 100644 --- a/test/auto/qchartview/tst_qchartview.cpp +++ b/test/auto/qchartview/tst_qchartview.cpp @@ -116,9 +116,9 @@ void tst_QChartView::rubberBand_data() QTest::addColumn("minY"); QTest::addColumn("maxY"); - QTest::newRow("HorizonalRubberBand") << QChartView::RubberBands(QChartView::HorizonalRubberBand) << 0 << 1 << 10 << 90 << 0<< 100; - QTest::newRow("VerticalRubberBand") << QChartView::RubberBands(QChartView::VerticalRubberBand) << 1 << 0 << 0 << 100 << 10<< 90; - QTest::newRow("RectangleRubberBand") << QChartView::RubberBands(QChartView::RectangleRubberBand) << 1 << 1 <<10 << 90 << 10<< 90; + QTest::newRow("HorizonalRubberBand") << QChartView::RubberBands(QChartView::HorizonalRubberBand) << 0 << 1 << 20 << 180 << 0<< 200; + QTest::newRow("VerticalRubberBand") << QChartView::RubberBands(QChartView::VerticalRubberBand) << 1 << 0 << 0 << 200 << 20<< 180; + QTest::newRow("RectangleRubberBand") << QChartView::RubberBands(QChartView::RectangleRubberBand) << 1 << 1 <<20 << 180 << 20<< 180; } void tst_QChartView::rubberBand() @@ -136,10 +136,10 @@ void tst_QChartView::rubberBand() QCOMPARE(m_view->rubberBand(), rubberBand); QLineSeries* line = new QLineSeries(); - *line << QPointF(0, 0) << QPointF(100, 100); + *line << QPointF(0, 0) << QPointF(200, 200); m_view->chart()->addSeries(line); - m_view->resize(100 + padding.left() + padding.right(), 100 + padding.top()+ padding.bottom()); + m_view->resize(200 + padding.left() + padding.right(), 200 + padding.top()+ padding.bottom()); m_view->show(); //this is hack since view does not get events otherwise