@@ -13,6 +13,7 QTCOMMERCIALCHART_USE_NAMESPACE | |||||
13 |
|
13 | |||
14 | Q_DECLARE_METATYPE(QChartAxis*) |
|
14 | Q_DECLARE_METATYPE(QChartAxis*) | |
15 | Q_DECLARE_METATYPE(QSeries*) |
|
15 | Q_DECLARE_METATYPE(QSeries*) | |
|
16 | Q_DECLARE_METATYPE(QChart::AnimationOption) | |||
16 |
|
17 | |||
17 | class tst_QChart : public QObject |
|
18 | class tst_QChart : public QObject | |
18 | { |
|
19 | { | |
@@ -58,8 +59,6 private slots: | |||||
58 | void scrollRight(); |
|
59 | void scrollRight(); | |
59 | void scrollUp_data(); |
|
60 | void scrollUp_data(); | |
60 | void scrollUp(); |
|
61 | void scrollUp(); | |
61 | void setAnimationOptions_data(); |
|
|||
62 | void setAnimationOptions(); |
|
|||
63 | void setBackgroundBrush_data(); |
|
62 | void setBackgroundBrush_data(); | |
64 | void setBackgroundBrush(); |
|
63 | void setBackgroundBrush(); | |
65 | void setBackgroundPen_data(); |
|
64 | void setBackgroundPen_data(); | |
@@ -88,6 +87,9 private slots: | |||||
88 | void zoomOut(); |
|
87 | void zoomOut(); | |
89 |
|
88 | |||
90 | private: |
|
89 | private: | |
|
90 | void createTestData(); | |||
|
91 | ||||
|
92 | private: | |||
91 | QChartView* m_view; |
|
93 | QChartView* m_view; | |
92 | QChart* m_chart; |
|
94 | QChart* m_chart; | |
93 | }; |
|
95 | }; | |
@@ -106,7 +108,15 void tst_QChart::init() | |||||
106 | { |
|
108 | { | |
107 | m_view = new QChartView(new QChart()); |
|
109 | m_view = new QChartView(new QChart()); | |
108 | m_chart = m_view->chart(); |
|
110 | m_chart = m_view->chart(); | |
|
111 | } | |||
109 |
|
112 | |||
|
113 | void tst_QChart::createTestData() | |||
|
114 | { | |||
|
115 | QLineSeries* series0 = new QLineSeries(this); | |||
|
116 | *series0 << QPointF(0, 0) << QPointF(100, 100); | |||
|
117 | m_chart->addSeries(series0); | |||
|
118 | m_view->show(); | |||
|
119 | QTest::qWaitForWindowShown(m_view); | |||
110 | } |
|
120 | } | |
111 |
|
121 | |||
112 | void tst_QChart::cleanup() |
|
122 | void tst_QChart::cleanup() | |
@@ -190,31 +200,29 void tst_QChart::addSeries() | |||||
190 | { |
|
200 | { | |
191 | QFETCH(QSeries*, series); |
|
201 | QFETCH(QSeries*, series); | |
192 | QFETCH(QChartAxis*, axis); |
|
202 | QFETCH(QChartAxis*, axis); | |
|
203 | m_view->show(); | |||
|
204 | QTest::qWaitForWindowShown(m_view); | |||
193 | if(!axis) axis = m_chart->axisY(); |
|
205 | if(!axis) axis = m_chart->axisY(); | |
194 | m_chart->addSeries(series,axis); |
|
206 | //m_chart->addSeries(series,axis); | |
195 | QCOMPARE(m_chart->axisY(series),axis); |
|
207 | QCOMPARE(m_chart->axisY(series),axis); | |
196 | } |
|
208 | } | |
197 |
|
209 | |||
198 | Q_DECLARE_METATYPE(QChart::AnimationOptions) |
|
|||
199 | void tst_QChart::animationOptions_data() |
|
210 | void tst_QChart::animationOptions_data() | |
200 | { |
|
211 | { | |
201 | #if 0 |
|
212 | QTest::addColumn<QChart::AnimationOption>("animationOptions"); | |
202 | QTest::addColumn<QChart::AnimationOptions>("animationOptions"); |
|
213 | QTest::newRow("AllAnimations") << QChart::AllAnimations; | |
203 |
QTest::newRow(" |
|
214 | QTest::newRow("NoAnimation") << QChart::NoAnimation; | |
204 | #endif |
|
215 | QTest::newRow("GridAxisAnimations") << QChart::GridAxisAnimations; | |
|
216 | QTest::newRow("SeriesAnimations") << QChart::SeriesAnimations; | |||
205 | } |
|
217 | } | |
206 |
|
218 | |||
207 | // public QChart::AnimationOptions animationOptions() const |
|
|||
208 | void tst_QChart::animationOptions() |
|
219 | void tst_QChart::animationOptions() | |
209 | { |
|
220 | { | |
210 | #if 0 |
|
221 | createTestData(); | |
211 |
QFETCH(QChart::AnimationOption |
|
222 | QFETCH(QChart::AnimationOption, animationOptions); | |
|
223 | m_chart->setAnimationOptions(animationOptions); | |||
|
224 | QCOMPARE(m_chart->animationOptions(), animationOptions); | |||
212 |
|
225 | |||
213 | SubQChart chart; |
|
|||
214 |
|
||||
215 | QCOMPARE(chart.animationOptions(), animationOptions); |
|
|||
216 | #endif |
|
|||
217 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
218 | } |
|
226 | } | |
219 |
|
227 | |||
220 | void tst_QChart::axisX_data() |
|
228 | void tst_QChart::axisX_data() | |
@@ -484,27 +492,6 void tst_QChart::scrollUp() | |||||
484 | QSKIP("Test is not implemented.", SkipAll); |
|
492 | QSKIP("Test is not implemented.", SkipAll); | |
485 | } |
|
493 | } | |
486 |
|
494 | |||
487 | void tst_QChart::setAnimationOptions_data() |
|
|||
488 | { |
|
|||
489 | #if 0 |
|
|||
490 | QTest::addColumn<QChart::AnimationOptions>("options"); |
|
|||
491 | QTest::newRow("null") << QChart::AnimationOptions(); |
|
|||
492 | #endif |
|
|||
493 | } |
|
|||
494 |
|
||||
495 | // public void setAnimationOptions(QChart::AnimationOptions options) |
|
|||
496 | void tst_QChart::setAnimationOptions() |
|
|||
497 | { |
|
|||
498 | #if 0 |
|
|||
499 | QFETCH(QChart::AnimationOptions, options); |
|
|||
500 |
|
||||
501 | SubQChart chart; |
|
|||
502 |
|
||||
503 | chart.setAnimationOptions(options); |
|
|||
504 | #endif |
|
|||
505 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
506 | } |
|
|||
507 |
|
||||
508 | void tst_QChart::setBackgroundBrush_data() |
|
495 | void tst_QChart::setBackgroundBrush_data() | |
509 | { |
|
496 | { | |
510 | #if 0 |
|
497 | #if 0 |
@@ -116,9 +116,9 void tst_QChartView::rubberBand_data() | |||||
116 | QTest::addColumn<int>("minY"); |
|
116 | QTest::addColumn<int>("minY"); | |
117 | QTest::addColumn<int>("maxY"); |
|
117 | QTest::addColumn<int>("maxY"); | |
118 |
|
118 | |||
119 |
QTest::newRow("HorizonalRubberBand") << QChartView::RubberBands(QChartView::HorizonalRubberBand) << 0 << 1 << |
|
119 | QTest::newRow("HorizonalRubberBand") << QChartView::RubberBands(QChartView::HorizonalRubberBand) << 0 << 1 << 20 << 180 << 0<< 200; | |
120 |
QTest::newRow("VerticalRubberBand") << QChartView::RubberBands(QChartView::VerticalRubberBand) << 1 << 0 << 0 << |
|
120 | QTest::newRow("VerticalRubberBand") << QChartView::RubberBands(QChartView::VerticalRubberBand) << 1 << 0 << 0 << 200 << 20<< 180; | |
121 |
QTest::newRow("RectangleRubberBand") << QChartView::RubberBands(QChartView::RectangleRubberBand) << 1 << 1 << |
|
121 | QTest::newRow("RectangleRubberBand") << QChartView::RubberBands(QChartView::RectangleRubberBand) << 1 << 1 <<20 << 180 << 20<< 180; | |
122 | } |
|
122 | } | |
123 |
|
123 | |||
124 | void tst_QChartView::rubberBand() |
|
124 | void tst_QChartView::rubberBand() | |
@@ -136,10 +136,10 void tst_QChartView::rubberBand() | |||||
136 | QCOMPARE(m_view->rubberBand(), rubberBand); |
|
136 | QCOMPARE(m_view->rubberBand(), rubberBand); | |
137 |
|
137 | |||
138 | QLineSeries* line = new QLineSeries(); |
|
138 | QLineSeries* line = new QLineSeries(); | |
139 |
*line << QPointF(0, 0) << QPointF( |
|
139 | *line << QPointF(0, 0) << QPointF(200, 200); | |
140 |
|
140 | |||
141 | m_view->chart()->addSeries(line); |
|
141 | m_view->chart()->addSeries(line); | |
142 |
m_view->resize( |
|
142 | m_view->resize(200 + padding.left() + padding.right(), 200 + padding.top()+ padding.bottom()); | |
143 | m_view->show(); |
|
143 | m_view->show(); | |
144 |
|
144 | |||
145 | //this is hack since view does not get events otherwise |
|
145 | //this is hack since view does not get events otherwise |
General Comments 0
You need to be logged in to leave comments.
Login now