@@ -13,6 +13,7 QTCOMMERCIALCHART_USE_NAMESPACE | |||
|
13 | 13 | |
|
14 | 14 | Q_DECLARE_METATYPE(QChartAxis*) |
|
15 | 15 | Q_DECLARE_METATYPE(QSeries*) |
|
16 | Q_DECLARE_METATYPE(QChart::AnimationOption) | |
|
16 | 17 | |
|
17 | 18 | class tst_QChart : public QObject |
|
18 | 19 | { |
@@ -58,8 +59,6 private slots: | |||
|
58 | 59 | void scrollRight(); |
|
59 | 60 | void scrollUp_data(); |
|
60 | 61 | void scrollUp(); |
|
61 | void setAnimationOptions_data(); | |
|
62 | void setAnimationOptions(); | |
|
63 | 62 | void setBackgroundBrush_data(); |
|
64 | 63 | void setBackgroundBrush(); |
|
65 | 64 | void setBackgroundPen_data(); |
@@ -88,6 +87,9 private slots: | |||
|
88 | 87 | void zoomOut(); |
|
89 | 88 | |
|
90 | 89 | private: |
|
90 | void createTestData(); | |
|
91 | ||
|
92 | private: | |
|
91 | 93 | QChartView* m_view; |
|
92 | 94 | QChart* m_chart; |
|
93 | 95 | }; |
@@ -106,7 +108,15 void tst_QChart::init() | |||
|
106 | 108 | { |
|
107 | 109 | m_view = new QChartView(new QChart()); |
|
108 | 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 | 122 | void tst_QChart::cleanup() |
@@ -190,31 +200,29 void tst_QChart::addSeries() | |||
|
190 | 200 | { |
|
191 | 201 | QFETCH(QSeries*, series); |
|
192 | 202 | QFETCH(QChartAxis*, axis); |
|
203 | m_view->show(); | |
|
204 | QTest::qWaitForWindowShown(m_view); | |
|
193 | 205 | if(!axis) axis = m_chart->axisY(); |
|
194 | m_chart->addSeries(series,axis); | |
|
206 | //m_chart->addSeries(series,axis); | |
|
195 | 207 | QCOMPARE(m_chart->axisY(series),axis); |
|
196 | 208 | } |
|
197 | 209 | |
|
198 | Q_DECLARE_METATYPE(QChart::AnimationOptions) | |
|
199 | 210 | void tst_QChart::animationOptions_data() |
|
200 | 211 | { |
|
201 | #if 0 | |
|
202 | QTest::addColumn<QChart::AnimationOptions>("animationOptions"); | |
|
203 |
QTest::newRow(" |
|
|
204 | #endif | |
|
212 | QTest::addColumn<QChart::AnimationOption>("animationOptions"); | |
|
213 | QTest::newRow("AllAnimations") << QChart::AllAnimations; | |
|
214 | QTest::newRow("NoAnimation") << QChart::NoAnimation; | |
|
215 | QTest::newRow("GridAxisAnimations") << QChart::GridAxisAnimations; | |
|
216 | QTest::newRow("SeriesAnimations") << QChart::SeriesAnimations; | |
|
205 | 217 | } |
|
206 | 218 | |
|
207 | // public QChart::AnimationOptions animationOptions() const | |
|
208 | 219 | void tst_QChart::animationOptions() |
|
209 | 220 | { |
|
210 | #if 0 | |
|
211 |
QFETCH(QChart::AnimationOption |
|
|
221 | createTestData(); | |
|
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 | 228 | void tst_QChart::axisX_data() |
@@ -484,27 +492,6 void tst_QChart::scrollUp() | |||
|
484 | 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 | 495 | void tst_QChart::setBackgroundBrush_data() |
|
509 | 496 | { |
|
510 | 497 | #if 0 |
@@ -116,9 +116,9 void tst_QChartView::rubberBand_data() | |||
|
116 | 116 | QTest::addColumn<int>("minY"); |
|
117 | 117 | QTest::addColumn<int>("maxY"); |
|
118 | 118 | |
|
119 |
QTest::newRow("HorizonalRubberBand") << QChartView::RubberBands(QChartView::HorizonalRubberBand) << 0 << 1 << |
|
|
120 |
QTest::newRow("VerticalRubberBand") << QChartView::RubberBands(QChartView::VerticalRubberBand) << 1 << 0 << 0 << |
|
|
121 |
QTest::newRow("RectangleRubberBand") << QChartView::RubberBands(QChartView::RectangleRubberBand) << 1 << 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 << 200 << 20<< 180; | |
|
121 | QTest::newRow("RectangleRubberBand") << QChartView::RubberBands(QChartView::RectangleRubberBand) << 1 << 1 <<20 << 180 << 20<< 180; | |
|
122 | 122 | } |
|
123 | 123 | |
|
124 | 124 | void tst_QChartView::rubberBand() |
@@ -136,10 +136,10 void tst_QChartView::rubberBand() | |||
|
136 | 136 | QCOMPARE(m_view->rubberBand(), rubberBand); |
|
137 | 137 | |
|
138 | 138 | QLineSeries* line = new QLineSeries(); |
|
139 |
*line << QPointF(0, 0) << QPointF( |
|
|
139 | *line << QPointF(0, 0) << QPointF(200, 200); | |
|
140 | 140 | |
|
141 | 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 | 143 | m_view->show(); |
|
144 | 144 | |
|
145 | 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