@@ -1,199 +1,198 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include <limits.h> |
|
21 | #include <limits.h> | |
22 | #include <QVector> |
|
22 | #include <QVector> | |
23 | #include <QDebug> |
|
23 | #include <QDebug> | |
24 | #include "barchartmodel_p.h" |
|
24 | #include "barchartmodel_p.h" | |
25 | #include "qbarset.h" |
|
25 | #include "qbarset.h" | |
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
29 | BarChartModel::BarChartModel(QStringList categories, QObject *parent) : QObject(parent), |
|
29 | BarChartModel::BarChartModel(QStringList categories, QObject *parent) : QObject(parent), | |
30 | m_category(categories) |
|
30 | m_category(categories) | |
31 | { |
|
31 | { | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | QStringList BarChartModel::category() |
|
34 | QStringList BarChartModel::category() | |
35 | { |
|
35 | { | |
36 | return m_category; |
|
36 | return m_category; | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void BarChartModel::appendBarSet(QBarSet *set) |
|
39 | void BarChartModel::appendBarSet(QBarSet *set) | |
40 | { |
|
40 | { | |
41 | m_dataModel.append(set); |
|
41 | m_dataModel.append(set); | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | void BarChartModel::removeBarSet(QBarSet *set) |
|
44 | void BarChartModel::removeBarSet(QBarSet *set) | |
45 | { |
|
45 | { | |
46 | if (m_dataModel.contains(set)) { |
|
46 | if (m_dataModel.contains(set)) { | |
47 | m_dataModel.removeOne(set); |
|
47 | m_dataModel.removeOne(set); | |
48 | } |
|
48 | } | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 | void BarChartModel::insertBarSet(int i, QBarSet *set) |
|
51 | void BarChartModel::insertBarSet(int i, QBarSet *set) | |
52 | { |
|
52 | { | |
53 | m_dataModel.insert(i, set); |
|
53 | m_dataModel.insert(i, set); | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | void BarChartModel::insertCategory(int i, QString category) |
|
56 | void BarChartModel::insertCategory(int i, QString category) | |
57 | { |
|
57 | { | |
58 | m_category.insert(i, category); |
|
58 | m_category.insert(i, category); | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | void BarChartModel::removeCategory(int i) |
|
61 | void BarChartModel::removeCategory(int i) | |
62 | { |
|
62 | { | |
63 | m_category.removeAt(i); |
|
63 | m_category.removeAt(i); | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | QBarSet* BarChartModel::barsetAt(int index) const |
|
66 | QBarSet* BarChartModel::barsetAt(int index) const | |
67 | { |
|
67 | { | |
68 | return m_dataModel.at(index); |
|
68 | return m_dataModel.at(index); | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | QList<QBarSet*> BarChartModel::barSets() const |
|
71 | QList<QBarSet*> BarChartModel::barSets() const | |
72 | { |
|
72 | { | |
73 | return m_dataModel; |
|
73 | return m_dataModel; | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
76 | int BarChartModel::barsetCount() const |
|
76 | int BarChartModel::barsetCount() const | |
77 | { |
|
77 | { | |
78 | return m_dataModel.count(); |
|
78 | return m_dataModel.count(); | |
79 | } |
|
79 | } | |
80 |
|
80 | |||
81 | int BarChartModel::categoryCount() const |
|
81 | int BarChartModel::categoryCount() const | |
82 | { |
|
82 | { | |
83 | return m_category.count(); |
|
83 | return m_category.count(); | |
84 | } |
|
84 | } | |
85 |
|
85 | |||
86 | qreal BarChartModel::min() const |
|
86 | qreal BarChartModel::min() const | |
87 | { |
|
87 | { | |
88 | Q_ASSERT(m_dataModel.count() > 0); |
|
88 | Q_ASSERT(m_dataModel.count() > 0); | |
89 | // TODO: make min and max members and update them when data changes. |
|
89 | // TODO: make min and max members and update them when data changes. | |
90 | // This is slower since they are checked every time, even if data is same since previous call. |
|
90 | // This is slower since they are checked every time, even if data is same since previous call. | |
91 | qreal min = INT_MAX; |
|
91 | qreal min = INT_MAX; | |
92 |
|
92 | |||
93 | for (int i = 0; i < m_dataModel.count(); i++) { |
|
93 | for (int i = 0; i < m_dataModel.count(); i++) { | |
94 | int itemCount = m_dataModel.at(i)->count(); |
|
94 | int itemCount = m_dataModel.at(i)->count(); | |
95 | for (int j = 0; j < itemCount; j++) { |
|
95 | for (int j = 0; j < itemCount; j++) { | |
96 | qreal temp = m_dataModel.at(i)->valueAt(j); |
|
96 | qreal temp = m_dataModel.at(i)->valueAt(j); | |
97 | if (temp < min) |
|
97 | if (temp < min) | |
98 | min = temp; |
|
98 | min = temp; | |
99 | } |
|
99 | } | |
100 | } |
|
100 | } | |
101 | return min; |
|
101 | return min; | |
102 | } |
|
102 | } | |
103 |
|
103 | |||
104 | qreal BarChartModel::max() const |
|
104 | qreal BarChartModel::max() const | |
105 | { |
|
105 | { | |
106 |
|
|
106 | if (m_dataModel.count() == 0) return 0; | |
107 |
|
||||
108 | // TODO: make min and max members and update them when data changes. |
|
107 | // TODO: make min and max members and update them when data changes. | |
109 | // This is slower since they are checked every time, even if data is same since previous call. |
|
108 | // This is slower since they are checked every time, even if data is same since previous call. | |
110 | qreal max = INT_MIN; |
|
109 | qreal max = INT_MIN; | |
111 |
|
110 | |||
112 | for (int i = 0; i < m_dataModel.count(); i++) { |
|
111 | for (int i = 0; i < m_dataModel.count(); i++) { | |
113 | int itemCount = m_dataModel.at(i)->count(); |
|
112 | int itemCount = m_dataModel.at(i)->count(); | |
114 | for (int j = 0; j < itemCount; j++) { |
|
113 | for (int j = 0; j < itemCount; j++) { | |
115 | qreal temp = m_dataModel.at(i)->valueAt(j); |
|
114 | qreal temp = m_dataModel.at(i)->valueAt(j); | |
116 | if (temp > max) |
|
115 | if (temp > max) | |
117 | max = temp; |
|
116 | max = temp; | |
118 | } |
|
117 | } | |
119 | } |
|
118 | } | |
120 |
|
119 | |||
121 | return max; |
|
120 | return max; | |
122 | } |
|
121 | } | |
123 |
|
122 | |||
124 | qreal BarChartModel::valueAt(int set, int category) const |
|
123 | qreal BarChartModel::valueAt(int set, int category) const | |
125 | { |
|
124 | { | |
126 | if ((set < 0) || (set >= m_dataModel.count())) { |
|
125 | if ((set < 0) || (set >= m_dataModel.count())) { | |
127 | // No set, no value. |
|
126 | // No set, no value. | |
128 | return 0; |
|
127 | return 0; | |
129 | } else if ((category < 0) || (category >= m_dataModel.at(set)->count())) { |
|
128 | } else if ((category < 0) || (category >= m_dataModel.at(set)->count())) { | |
130 | // No category, no value. |
|
129 | // No category, no value. | |
131 | return 0; |
|
130 | return 0; | |
132 | } |
|
131 | } | |
133 |
|
132 | |||
134 | return m_dataModel.at(set)->valueAt(category); |
|
133 | return m_dataModel.at(set)->valueAt(category); | |
135 | } |
|
134 | } | |
136 |
|
135 | |||
137 | qreal BarChartModel::percentageAt(int set, int category) const |
|
136 | qreal BarChartModel::percentageAt(int set, int category) const | |
138 | { |
|
137 | { | |
139 | if ((set < 0) || (set >= m_dataModel.count())) { |
|
138 | if ((set < 0) || (set >= m_dataModel.count())) { | |
140 | // No set, no value. |
|
139 | // No set, no value. | |
141 | return 0; |
|
140 | return 0; | |
142 | } else if ((category < 0) || (category >= m_dataModel.at(set)->count())) { |
|
141 | } else if ((category < 0) || (category >= m_dataModel.at(set)->count())) { | |
143 | // No category, no value. |
|
142 | // No category, no value. | |
144 | return 0; |
|
143 | return 0; | |
145 | } |
|
144 | } | |
146 |
|
145 | |||
147 | qreal value = m_dataModel.at(set)->valueAt(category); |
|
146 | qreal value = m_dataModel.at(set)->valueAt(category); | |
148 | qreal total = categorySum(category); |
|
147 | qreal total = categorySum(category); | |
149 | if ( qFuzzyCompare(total, 0) ) |
|
148 | if ( qFuzzyCompare(total, 0) ) | |
150 | return 0; |
|
149 | return 0; | |
151 |
|
150 | |||
152 | return value / total; |
|
151 | return value / total; | |
153 | } |
|
152 | } | |
154 |
|
153 | |||
155 | qreal BarChartModel::categorySum(int category) const |
|
154 | qreal BarChartModel::categorySum(int category) const | |
156 | { |
|
155 | { | |
157 | qreal sum(0); |
|
156 | qreal sum(0); | |
158 | int count = m_dataModel.count(); // Count sets |
|
157 | int count = m_dataModel.count(); // Count sets | |
159 |
|
158 | |||
160 | for (int set = 0; set < count; set++) { |
|
159 | for (int set = 0; set < count; set++) { | |
161 | if (category < m_dataModel.at(set)->count()) |
|
160 | if (category < m_dataModel.at(set)->count()) | |
162 | sum += m_dataModel.at(set)->valueAt(category); |
|
161 | sum += m_dataModel.at(set)->valueAt(category); | |
163 | } |
|
162 | } | |
164 | return sum; |
|
163 | return sum; | |
165 | } |
|
164 | } | |
166 |
|
165 | |||
167 | qreal BarChartModel::absoluteCategorySum(int category) const |
|
166 | qreal BarChartModel::absoluteCategorySum(int category) const | |
168 | { |
|
167 | { | |
169 | qreal sum(0); |
|
168 | qreal sum(0); | |
170 | int count = m_dataModel.count(); // Count sets |
|
169 | int count = m_dataModel.count(); // Count sets | |
171 |
|
170 | |||
172 | for (int set = 0; set < count; set++) { |
|
171 | for (int set = 0; set < count; set++) { | |
173 | if (category < m_dataModel.at(set)->count()) |
|
172 | if (category < m_dataModel.at(set)->count()) | |
174 | sum += qAbs(m_dataModel.at(set)->valueAt(category)); |
|
173 | sum += qAbs(m_dataModel.at(set)->valueAt(category)); | |
175 | } |
|
174 | } | |
176 | return sum; |
|
175 | return sum; | |
177 | } |
|
176 | } | |
178 |
|
177 | |||
179 | qreal BarChartModel::maxCategorySum() const |
|
178 | qreal BarChartModel::maxCategorySum() const | |
180 | { |
|
179 | { | |
181 | qreal max = INT_MIN; |
|
180 | qreal max = INT_MIN; | |
182 | int count = categoryCount(); |
|
181 | int count = categoryCount(); | |
183 |
|
182 | |||
184 | for (int col = 0; col < count; col++) { |
|
183 | for (int col = 0; col < count; col++) { | |
185 | qreal sum = categorySum(col); |
|
184 | qreal sum = categorySum(col); | |
186 | if (sum > max) |
|
185 | if (sum > max) | |
187 | max = sum; |
|
186 | max = sum; | |
188 | } |
|
187 | } | |
189 | return max; |
|
188 | return max; | |
190 | } |
|
189 | } | |
191 |
|
190 | |||
192 | QString BarChartModel::categoryName(int category) |
|
191 | QString BarChartModel::categoryName(int category) | |
193 | { |
|
192 | { | |
194 | return m_category.at(category); |
|
193 | return m_category.at(category); | |
195 | } |
|
194 | } | |
196 |
|
195 | |||
197 | #include "moc_barchartmodel_p.cpp" |
|
196 | #include "moc_barchartmodel_p.cpp" | |
198 |
|
197 | |||
199 | QTCOMMERCIALCHART_END_NAMESPACE |
|
198 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,762 +1,761 | |||||
1 | #include <QtTest/QtTest> |
|
1 | #include <QtTest/QtTest> | |
2 | #include <qchartview.h> |
|
2 | #include <qchartview.h> | |
3 | #include <qlineseries.h> |
|
3 | #include <qlineseries.h> | |
4 | #include <qareaseries.h> |
|
4 | #include <qareaseries.h> | |
5 | #include <qscatterseries.h> |
|
5 | #include <qscatterseries.h> | |
6 | #include <qsplineseries.h> |
|
6 | #include <qsplineseries.h> | |
7 | #include <qpieseries.h> |
|
7 | #include <qpieseries.h> | |
8 | #include <qbarseries.h> |
|
8 | #include <qbarseries.h> | |
9 | #include <qpercentbarseries.h> |
|
9 | #include <qpercentbarseries.h> | |
10 | #include <qstackedbarseries.h> |
|
10 | #include <qstackedbarseries.h> | |
11 |
|
11 | |||
12 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
12 | 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 | Q_DECLARE_METATYPE(QChart::AnimationOption) | |
17 |
|
17 | |||
18 | class tst_QChart : public QObject |
|
18 | class tst_QChart : public QObject | |
19 | { |
|
19 | { | |
20 | Q_OBJECT |
|
20 | Q_OBJECT | |
21 |
|
21 | |||
22 | public slots: |
|
22 | public slots: | |
23 | void initTestCase(); |
|
23 | void initTestCase(); | |
24 | void cleanupTestCase(); |
|
24 | void cleanupTestCase(); | |
25 | void init(); |
|
25 | void init(); | |
26 | void cleanup(); |
|
26 | void cleanup(); | |
27 |
|
27 | |||
28 | private slots: |
|
28 | private slots: | |
29 | void qchart_data(); |
|
29 | void qchart_data(); | |
30 | void qchart(); |
|
30 | void qchart(); | |
31 |
|
31 | |||
32 | void addSeries_data(); |
|
32 | void addSeries_data(); | |
33 | void addSeries(); |
|
33 | void addSeries(); | |
34 | void animationOptions_data(); |
|
34 | void animationOptions_data(); | |
35 | void animationOptions(); |
|
35 | void animationOptions(); | |
36 | void axisX_data(); |
|
36 | void axisX_data(); | |
37 | void axisX(); |
|
37 | void axisX(); | |
38 | void axisY_data(); |
|
38 | void axisY_data(); | |
39 | void axisY(); |
|
39 | void axisY(); | |
40 | void backgroundBrush_data(); |
|
40 | void backgroundBrush_data(); | |
41 | void backgroundBrush(); |
|
41 | void backgroundBrush(); | |
42 | void backgroundPen_data(); |
|
42 | void backgroundPen_data(); | |
43 | void backgroundPen(); |
|
43 | void backgroundPen(); | |
44 | void isBackgroundVisible_data(); |
|
44 | void isBackgroundVisible_data(); | |
45 | void isBackgroundVisible(); |
|
45 | void isBackgroundVisible(); | |
46 | void legend_data(); |
|
46 | void legend_data(); | |
47 | void legend(); |
|
47 | void legend(); | |
48 | void margins_data(); |
|
48 | void margins_data(); | |
49 | void margins(); |
|
49 | void margins(); | |
50 | void removeAllSeries_data(); |
|
50 | void removeAllSeries_data(); | |
51 | void removeAllSeries(); |
|
51 | void removeAllSeries(); | |
52 | void removeSeries_data(); |
|
52 | void removeSeries_data(); | |
53 | void removeSeries(); |
|
53 | void removeSeries(); | |
54 | void scrollDown_data(); |
|
54 | void scrollDown_data(); | |
55 | void scrollDown(); |
|
55 | void scrollDown(); | |
56 | void scrollLeft_data(); |
|
56 | void scrollLeft_data(); | |
57 | void scrollLeft(); |
|
57 | void scrollLeft(); | |
58 | void scrollRight_data(); |
|
58 | void scrollRight_data(); | |
59 | void scrollRight(); |
|
59 | void scrollRight(); | |
60 | void scrollUp_data(); |
|
60 | void scrollUp_data(); | |
61 | void scrollUp(); |
|
61 | void scrollUp(); | |
62 | void setBackgroundBrush_data(); |
|
62 | void setBackgroundBrush_data(); | |
63 | void setBackgroundBrush(); |
|
63 | void setBackgroundBrush(); | |
64 | void setBackgroundPen_data(); |
|
64 | void setBackgroundPen_data(); | |
65 | void setBackgroundPen(); |
|
65 | void setBackgroundPen(); | |
66 | void setBackgroundVisible_data(); |
|
66 | void setBackgroundVisible_data(); | |
67 | void setBackgroundVisible(); |
|
67 | void setBackgroundVisible(); | |
68 | void setTheme_data(); |
|
68 | void setTheme_data(); | |
69 | void setTheme(); |
|
69 | void setTheme(); | |
70 | void setTitle_data(); |
|
70 | void setTitle_data(); | |
71 | void setTitle(); |
|
71 | void setTitle(); | |
72 | void setTitleBrush_data(); |
|
72 | void setTitleBrush_data(); | |
73 | void setTitleBrush(); |
|
73 | void setTitleBrush(); | |
74 | void setTitleFont_data(); |
|
74 | void setTitleFont_data(); | |
75 | void setTitleFont(); |
|
75 | void setTitleFont(); | |
76 | void theme_data(); |
|
76 | void theme_data(); | |
77 | void theme(); |
|
77 | void theme(); | |
78 | void title_data(); |
|
78 | void title_data(); | |
79 | void title(); |
|
79 | void title(); | |
80 | void titleBrush_data(); |
|
80 | void titleBrush_data(); | |
81 | void titleBrush(); |
|
81 | void titleBrush(); | |
82 | void titleFont_data(); |
|
82 | void titleFont_data(); | |
83 | void titleFont(); |
|
83 | void titleFont(); | |
84 | void zoomIn_data(); |
|
84 | void zoomIn_data(); | |
85 | void zoomIn(); |
|
85 | void zoomIn(); | |
86 | void zoomOut_data(); |
|
86 | void zoomOut_data(); | |
87 | void zoomOut(); |
|
87 | void zoomOut(); | |
88 |
|
88 | |||
89 | private: |
|
89 | private: | |
90 | void createTestData(); |
|
90 | void createTestData(); | |
91 |
|
91 | |||
92 | private: |
|
92 | private: | |
93 | QChartView* m_view; |
|
93 | QChartView* m_view; | |
94 | QChart* m_chart; |
|
94 | QChart* m_chart; | |
95 | }; |
|
95 | }; | |
96 |
|
96 | |||
97 | void tst_QChart::initTestCase() |
|
97 | void tst_QChart::initTestCase() | |
98 | { |
|
98 | { | |
99 |
|
99 | |||
100 | } |
|
100 | } | |
101 |
|
101 | |||
102 | void tst_QChart::cleanupTestCase() |
|
102 | void tst_QChart::cleanupTestCase() | |
103 | { |
|
103 | { | |
104 |
|
104 | |||
105 | } |
|
105 | } | |
106 |
|
106 | |||
107 | void tst_QChart::init() |
|
107 | void tst_QChart::init() | |
108 | { |
|
108 | { | |
109 | m_view = new QChartView(new QChart()); |
|
109 | m_view = new QChartView(new QChart()); | |
110 | m_chart = m_view->chart(); |
|
110 | m_chart = m_view->chart(); | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 | void tst_QChart::createTestData() |
|
113 | void tst_QChart::createTestData() | |
114 | { |
|
114 | { | |
115 | QLineSeries* series0 = new QLineSeries(this); |
|
115 | QLineSeries* series0 = new QLineSeries(this); | |
116 | *series0 << QPointF(0, 0) << QPointF(100, 100); |
|
116 | *series0 << QPointF(0, 0) << QPointF(100, 100); | |
117 | m_chart->addSeries(series0); |
|
117 | m_chart->addSeries(series0); | |
118 | m_view->show(); |
|
118 | m_view->show(); | |
119 | QTest::qWaitForWindowShown(m_view); |
|
119 | QTest::qWaitForWindowShown(m_view); | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | void tst_QChart::cleanup() |
|
122 | void tst_QChart::cleanup() | |
123 | { |
|
123 | { | |
124 | delete m_view; |
|
124 | delete m_view; | |
125 | m_view = 0; |
|
125 | m_view = 0; | |
126 | m_chart = 0; |
|
126 | m_chart = 0; | |
127 | } |
|
127 | } | |
128 |
|
128 | |||
129 | void tst_QChart::qchart_data() |
|
129 | void tst_QChart::qchart_data() | |
130 | { |
|
130 | { | |
131 | } |
|
131 | } | |
132 |
|
132 | |||
133 | void tst_QChart::qchart() |
|
133 | void tst_QChart::qchart() | |
134 | { |
|
134 | { | |
135 | QVERIFY(m_chart); |
|
135 | QVERIFY(m_chart); | |
136 | QVERIFY(m_chart->legend()); |
|
136 | QVERIFY(m_chart->legend()); | |
137 | QVERIFY(!m_chart->legend()->isVisible()); |
|
137 | QVERIFY(!m_chart->legend()->isVisible()); | |
138 |
|
138 | |||
139 | QCOMPARE(m_chart->animationOptions(), QChart::NoAnimation); |
|
139 | QCOMPARE(m_chart->animationOptions(), QChart::NoAnimation); | |
140 | QVERIFY(m_chart->axisX()); |
|
140 | QVERIFY(m_chart->axisX()); | |
141 | QVERIFY(m_chart->axisY()); |
|
141 | QVERIFY(m_chart->axisY()); | |
142 | QVERIFY(m_chart->backgroundBrush()!=QBrush()); |
|
142 | QVERIFY(m_chart->backgroundBrush()!=QBrush()); | |
143 | QVERIFY(m_chart->backgroundPen()!=QPen()); |
|
143 | QVERIFY(m_chart->backgroundPen()!=QPen()); | |
144 | QCOMPARE(m_chart->isBackgroundVisible(), true); |
|
144 | QCOMPARE(m_chart->isBackgroundVisible(), true); | |
145 |
|
145 | |||
146 | QVERIFY(m_chart->margins().top()>0); |
|
146 | QVERIFY(m_chart->margins().top()>0); | |
147 | QVERIFY(m_chart->margins().left()>0); |
|
147 | QVERIFY(m_chart->margins().left()>0); | |
148 | QVERIFY(m_chart->margins().right()>0); |
|
148 | QVERIFY(m_chart->margins().right()>0); | |
149 | QVERIFY(m_chart->margins().bottom()>0); |
|
149 | QVERIFY(m_chart->margins().bottom()>0); | |
150 | m_chart->removeAllSeries(); |
|
150 | m_chart->removeAllSeries(); | |
151 | m_chart->scrollDown(); |
|
151 | m_chart->scrollDown(); | |
152 | m_chart->scrollLeft(); |
|
152 | m_chart->scrollLeft(); | |
153 | m_chart->scrollRight(); |
|
153 | m_chart->scrollRight(); | |
154 | m_chart->scrollUp(); |
|
154 | m_chart->scrollUp(); | |
155 | QCOMPARE(m_chart->theme(), QChart::ChartThemeLight); |
|
155 | QCOMPARE(m_chart->theme(), QChart::ChartThemeLight); | |
156 | QCOMPARE(m_chart->title(), QString()); |
|
156 | QCOMPARE(m_chart->title(), QString()); | |
157 | QCOMPARE(m_chart->titleBrush(),QBrush()); |
|
157 | QCOMPARE(m_chart->titleBrush(),QBrush()); | |
158 | QCOMPARE(m_chart->titleFont(),QFont()); |
|
158 | QCOMPARE(m_chart->titleFont(),QFont()); | |
159 | m_chart->zoomIn(); |
|
159 | m_chart->zoomIn(); | |
160 | m_chart->zoomIn(QRectF()); |
|
160 | m_chart->zoomIn(QRectF()); | |
161 | m_chart->zoomOut(); |
|
161 | m_chart->zoomOut(); | |
162 | } |
|
162 | } | |
163 |
|
163 | |||
164 | void tst_QChart::addSeries_data() |
|
164 | void tst_QChart::addSeries_data() | |
165 | { |
|
165 | { | |
166 | QTest::addColumn<QSeries*>("series"); |
|
166 | QTest::addColumn<QSeries*>("series"); | |
167 | QTest::addColumn<QChartAxis*>("axis"); |
|
167 | QTest::addColumn<QChartAxis*>("axis"); | |
168 |
|
168 | |||
169 | QSeries* series0 = new QLineSeries(this); |
|
169 | QSeries* series0 = new QLineSeries(this); | |
170 | QSeries* series1 = new QAreaSeries(static_cast<QLineSeries*>(series0)); |
|
170 | QSeries* series1 = new QAreaSeries(static_cast<QLineSeries*>(series0)); | |
171 | QSeries* series2 = new QScatterSeries(this); |
|
171 | QSeries* series2 = new QScatterSeries(this); | |
172 | QSeries* series3 = new QSplineSeries(this); |
|
172 | QSeries* series3 = new QSplineSeries(this); | |
173 | QSeries* series4 = new QPieSeries(this); |
|
173 | QSeries* series4 = new QPieSeries(this); | |
174 | QSeries* series5 = new QBarSeries(QBarCategories(),this); |
|
174 | QSeries* series5 = new QBarSeries(QBarCategories(),this); | |
175 | QSeries* series6 = new QPercentBarSeries(QBarCategories(),this); |
|
175 | QSeries* series6 = new QPercentBarSeries(QBarCategories(),this); | |
176 | QSeries* series7 = new QStackedBarSeries(QBarCategories(),this); |
|
176 | QSeries* series7 = new QStackedBarSeries(QBarCategories(),this); | |
177 |
|
177 | |||
178 | QChartAxis* axis = new QChartAxis(this); |
|
178 | QChartAxis* axis = new QChartAxis(this); | |
179 |
|
179 | |||
180 | QTest::newRow("default axis: lineSeries") << series0 << (QChartAxis*) 0; |
|
180 | QTest::newRow("default axis: lineSeries") << series0 << (QChartAxis*) 0; | |
181 | QTest::newRow("axis0: lineSeries") << series0 << axis; |
|
181 | QTest::newRow("axis0: lineSeries") << series0 << axis; | |
182 | QTest::newRow("default axis: areaSeries") << series1 << (QChartAxis*) 0; |
|
182 | QTest::newRow("default axis: areaSeries") << series1 << (QChartAxis*) 0; | |
183 | QTest::newRow("axis: areaSeries") << series1 << axis; |
|
183 | QTest::newRow("axis: areaSeries") << series1 << axis; | |
184 | QTest::newRow("default axis: scatterSeries") << series2 << (QChartAxis*) 0; |
|
184 | QTest::newRow("default axis: scatterSeries") << series2 << (QChartAxis*) 0; | |
185 | QTest::newRow("axis1: scatterSeries") << series2 << axis; |
|
185 | QTest::newRow("axis1: scatterSeries") << series2 << axis; | |
186 | QTest::newRow("default axis: splineSeries") << series3 << (QChartAxis*) 0; |
|
186 | QTest::newRow("default axis: splineSeries") << series3 << (QChartAxis*) 0; | |
187 | QTest::newRow("axis: splineSeries") << series3 << axis; |
|
187 | QTest::newRow("axis: splineSeries") << series3 << axis; | |
188 | QTest::newRow("default axis: pieSeries") << series4 << (QChartAxis*) 0; |
|
188 | QTest::newRow("default axis: pieSeries") << series4 << (QChartAxis*) 0; | |
189 | QTest::newRow("axis: pieSeries") << series4 << axis; |
|
189 | QTest::newRow("axis: pieSeries") << series4 << axis; | |
190 | QTest::newRow("default axis: barSeries") << series5 << (QChartAxis*) 0; |
|
190 | QTest::newRow("default axis: barSeries") << series5 << (QChartAxis*) 0; | |
191 | QTest::newRow("axis: barSeries") << series5 << axis; |
|
191 | QTest::newRow("axis: barSeries") << series5 << axis; | |
192 | QTest::newRow("default axis: percentBarSeries") << series6 << (QChartAxis*) 0; |
|
192 | QTest::newRow("default axis: percentBarSeries") << series6 << (QChartAxis*) 0; | |
193 | QTest::newRow("axis: barSeries") << series6 << axis; |
|
193 | QTest::newRow("axis: barSeries") << series6 << axis; | |
194 | QTest::newRow("default axis: stackedBarSeries") << series7 << (QChartAxis*) 0; |
|
194 | QTest::newRow("default axis: stackedBarSeries") << series7 << (QChartAxis*) 0; | |
195 | QTest::newRow("axis: barSeries") << series7 << axis; |
|
195 | QTest::newRow("axis: barSeries") << series7 << axis; | |
196 |
|
196 | |||
197 | } |
|
197 | } | |
198 |
|
198 | |||
199 | void tst_QChart::addSeries() |
|
199 | void tst_QChart::addSeries() | |
200 | { |
|
200 | { | |
201 | QFETCH(QSeries*, series); |
|
201 | QFETCH(QSeries*, series); | |
202 | QFETCH(QChartAxis*, axis); |
|
202 | QFETCH(QChartAxis*, axis); | |
203 | m_view->show(); |
|
203 | m_view->show(); | |
204 | QTest::qWaitForWindowShown(m_view); |
|
204 | QTest::qWaitForWindowShown(m_view); | |
205 | if(!axis) axis = m_chart->axisY(); |
|
205 | if(!axis) axis = m_chart->axisY(); | |
206 |
|
|
206 | m_chart->addSeries(series,axis); | |
207 | QCOMPARE(m_chart->axisY(series),axis); |
|
207 | QCOMPARE(m_chart->axisY(series),axis); | |
208 | } |
|
208 | } | |
209 |
|
209 | |||
210 | void tst_QChart::animationOptions_data() |
|
210 | void tst_QChart::animationOptions_data() | |
211 | { |
|
211 | { | |
212 | QTest::addColumn<QChart::AnimationOption>("animationOptions"); |
|
212 | QTest::addColumn<QChart::AnimationOption>("animationOptions"); | |
213 | QTest::newRow("AllAnimations") << QChart::AllAnimations; |
|
213 | QTest::newRow("AllAnimations") << QChart::AllAnimations; | |
214 | QTest::newRow("NoAnimation") << QChart::NoAnimation; |
|
214 | QTest::newRow("NoAnimation") << QChart::NoAnimation; | |
215 | QTest::newRow("GridAxisAnimations") << QChart::GridAxisAnimations; |
|
215 | QTest::newRow("GridAxisAnimations") << QChart::GridAxisAnimations; | |
216 | QTest::newRow("SeriesAnimations") << QChart::SeriesAnimations; |
|
216 | QTest::newRow("SeriesAnimations") << QChart::SeriesAnimations; | |
217 | } |
|
217 | } | |
218 |
|
218 | |||
219 | void tst_QChart::animationOptions() |
|
219 | void tst_QChart::animationOptions() | |
220 | { |
|
220 | { | |
221 | createTestData(); |
|
221 | createTestData(); | |
222 | QFETCH(QChart::AnimationOption, animationOptions); |
|
222 | QFETCH(QChart::AnimationOption, animationOptions); | |
223 | m_chart->setAnimationOptions(animationOptions); |
|
223 | m_chart->setAnimationOptions(animationOptions); | |
224 | QCOMPARE(m_chart->animationOptions(), animationOptions); |
|
224 | QCOMPARE(m_chart->animationOptions(), animationOptions); | |
225 |
|
||||
226 | } |
|
225 | } | |
227 |
|
226 | |||
228 | void tst_QChart::axisX_data() |
|
227 | void tst_QChart::axisX_data() | |
229 | { |
|
228 | { | |
230 | #if 0 |
|
229 | #if 0 | |
231 | QTest::addColumn<QChartAxis*>("axisX"); |
|
230 | QTest::addColumn<QChartAxis*>("axisX"); | |
232 | QTest::newRow("null") << QChartAxis*(); |
|
231 | QTest::newRow("null") << QChartAxis*(); | |
233 | #endif |
|
232 | #endif | |
234 | } |
|
233 | } | |
235 |
|
234 | |||
236 | // public QChartAxis* axisX() const |
|
235 | // public QChartAxis* axisX() const | |
237 | void tst_QChart::axisX() |
|
236 | void tst_QChart::axisX() | |
238 | { |
|
237 | { | |
239 | #if 0 |
|
238 | #if 0 | |
240 | QFETCH(QChartAxis*, axisX); |
|
239 | QFETCH(QChartAxis*, axisX); | |
241 |
|
240 | |||
242 | SubQChart chart; |
|
241 | SubQChart chart; | |
243 |
|
242 | |||
244 | QCOMPARE(chart.axisX(), axisX); |
|
243 | QCOMPARE(chart.axisX(), axisX); | |
245 | #endif |
|
244 | #endif | |
246 | QSKIP("Test is not implemented.", SkipAll); |
|
245 | QSKIP("Test is not implemented.", SkipAll); | |
247 | } |
|
246 | } | |
248 |
|
247 | |||
249 | void tst_QChart::axisY_data() |
|
248 | void tst_QChart::axisY_data() | |
250 | { |
|
249 | { | |
251 | #if 0 |
|
250 | #if 0 | |
252 | QTest::addColumn<QChartAxis*>("axisY"); |
|
251 | QTest::addColumn<QChartAxis*>("axisY"); | |
253 | QTest::newRow("null") << QChartAxis*(); |
|
252 | QTest::newRow("null") << QChartAxis*(); | |
254 | #endif |
|
253 | #endif | |
255 | } |
|
254 | } | |
256 |
|
255 | |||
257 | // public QChartAxis* axisY() const |
|
256 | // public QChartAxis* axisY() const | |
258 | void tst_QChart::axisY() |
|
257 | void tst_QChart::axisY() | |
259 | { |
|
258 | { | |
260 | #if 0 |
|
259 | #if 0 | |
261 | QFETCH(QChartAxis*, axisY); |
|
260 | QFETCH(QChartAxis*, axisY); | |
262 |
|
261 | |||
263 | SubQChart chart; |
|
262 | SubQChart chart; | |
264 |
|
263 | |||
265 | QCOMPARE(chart.axisY(), axisY); |
|
264 | QCOMPARE(chart.axisY(), axisY); | |
266 | #endif |
|
265 | #endif | |
267 | QSKIP("Test is not implemented.", SkipAll); |
|
266 | QSKIP("Test is not implemented.", SkipAll); | |
268 | } |
|
267 | } | |
269 |
|
268 | |||
270 | Q_DECLARE_METATYPE(QBrush) |
|
269 | Q_DECLARE_METATYPE(QBrush) | |
271 | void tst_QChart::backgroundBrush_data() |
|
270 | void tst_QChart::backgroundBrush_data() | |
272 | { |
|
271 | { | |
273 | #if 0 |
|
272 | #if 0 | |
274 | QTest::addColumn<QBrush>("backgroundBrush"); |
|
273 | QTest::addColumn<QBrush>("backgroundBrush"); | |
275 | QTest::newRow("null") << QBrush(); |
|
274 | QTest::newRow("null") << QBrush(); | |
276 | #endif |
|
275 | #endif | |
277 | } |
|
276 | } | |
278 |
|
277 | |||
279 | // public QBrush backgroundBrush() const |
|
278 | // public QBrush backgroundBrush() const | |
280 | void tst_QChart::backgroundBrush() |
|
279 | void tst_QChart::backgroundBrush() | |
281 | { |
|
280 | { | |
282 | #if 0 |
|
281 | #if 0 | |
283 | QFETCH(QBrush, backgroundBrush); |
|
282 | QFETCH(QBrush, backgroundBrush); | |
284 |
|
283 | |||
285 | SubQChart chart; |
|
284 | SubQChart chart; | |
286 |
|
285 | |||
287 | QCOMPARE(chart.backgroundBrush(), backgroundBrush); |
|
286 | QCOMPARE(chart.backgroundBrush(), backgroundBrush); | |
288 | #endif |
|
287 | #endif | |
289 | QSKIP("Test is not implemented.", SkipAll); |
|
288 | QSKIP("Test is not implemented.", SkipAll); | |
290 | } |
|
289 | } | |
291 |
|
290 | |||
292 | Q_DECLARE_METATYPE(QPen) |
|
291 | Q_DECLARE_METATYPE(QPen) | |
293 | void tst_QChart::backgroundPen_data() |
|
292 | void tst_QChart::backgroundPen_data() | |
294 | { |
|
293 | { | |
295 | #if 0 |
|
294 | #if 0 | |
296 | QTest::addColumn<QPen>("backgroundPen"); |
|
295 | QTest::addColumn<QPen>("backgroundPen"); | |
297 | QTest::newRow("null") << QPen(); |
|
296 | QTest::newRow("null") << QPen(); | |
298 | #endif |
|
297 | #endif | |
299 | } |
|
298 | } | |
300 |
|
299 | |||
301 | // public QPen backgroundPen() const |
|
300 | // public QPen backgroundPen() const | |
302 | void tst_QChart::backgroundPen() |
|
301 | void tst_QChart::backgroundPen() | |
303 | { |
|
302 | { | |
304 | #if 0 |
|
303 | #if 0 | |
305 | QFETCH(QPen, backgroundPen); |
|
304 | QFETCH(QPen, backgroundPen); | |
306 |
|
305 | |||
307 | SubQChart chart; |
|
306 | SubQChart chart; | |
308 |
|
307 | |||
309 | QCOMPARE(chart.backgroundPen(), backgroundPen); |
|
308 | QCOMPARE(chart.backgroundPen(), backgroundPen); | |
310 | #endif |
|
309 | #endif | |
311 | QSKIP("Test is not implemented.", SkipAll); |
|
310 | QSKIP("Test is not implemented.", SkipAll); | |
312 | } |
|
311 | } | |
313 |
|
312 | |||
314 | void tst_QChart::isBackgroundVisible_data() |
|
313 | void tst_QChart::isBackgroundVisible_data() | |
315 | { |
|
314 | { | |
316 | QTest::addColumn<bool>("isBackgroundVisible"); |
|
315 | QTest::addColumn<bool>("isBackgroundVisible"); | |
317 | QTest::newRow("true") << true; |
|
316 | QTest::newRow("true") << true; | |
318 | QTest::newRow("false") << false; |
|
317 | QTest::newRow("false") << false; | |
319 | } |
|
318 | } | |
320 |
|
319 | |||
321 | // public bool isBackgroundVisible() const |
|
320 | // public bool isBackgroundVisible() const | |
322 | void tst_QChart::isBackgroundVisible() |
|
321 | void tst_QChart::isBackgroundVisible() | |
323 | { |
|
322 | { | |
324 | #if 0 |
|
323 | #if 0 | |
325 | QFETCH(bool, isBackgroundVisible); |
|
324 | QFETCH(bool, isBackgroundVisible); | |
326 |
|
325 | |||
327 | SubQChart chart; |
|
326 | SubQChart chart; | |
328 |
|
327 | |||
329 | QCOMPARE(chart.isBackgroundVisible(), isBackgroundVisible); |
|
328 | QCOMPARE(chart.isBackgroundVisible(), isBackgroundVisible); | |
330 | #endif |
|
329 | #endif | |
331 | QSKIP("Test is not implemented.", SkipAll); |
|
330 | QSKIP("Test is not implemented.", SkipAll); | |
332 | } |
|
331 | } | |
333 |
|
332 | |||
334 | Q_DECLARE_METATYPE(QLegend*) |
|
333 | Q_DECLARE_METATYPE(QLegend*) | |
335 | void tst_QChart::legend_data() |
|
334 | void tst_QChart::legend_data() | |
336 | { |
|
335 | { | |
337 | #if 0 |
|
336 | #if 0 | |
338 | QTest::addColumn<QLegend*>("legend"); |
|
337 | QTest::addColumn<QLegend*>("legend"); | |
339 | QTest::newRow("null") << QLegend*(); |
|
338 | QTest::newRow("null") << QLegend*(); | |
340 | #endif |
|
339 | #endif | |
341 | } |
|
340 | } | |
342 |
|
341 | |||
343 | // public QLegend* legend() const |
|
342 | // public QLegend* legend() const | |
344 | void tst_QChart::legend() |
|
343 | void tst_QChart::legend() | |
345 | { |
|
344 | { | |
346 | #if 0 |
|
345 | #if 0 | |
347 | QFETCH(QLegend*, legend); |
|
346 | QFETCH(QLegend*, legend); | |
348 |
|
347 | |||
349 | SubQChart chart; |
|
348 | SubQChart chart; | |
350 |
|
349 | |||
351 | QCOMPARE(chart.legend(), legend); |
|
350 | QCOMPARE(chart.legend(), legend); | |
352 | #endif |
|
351 | #endif | |
353 | QSKIP("Test is not implemented.", SkipAll); |
|
352 | QSKIP("Test is not implemented.", SkipAll); | |
354 | } |
|
353 | } | |
355 |
|
354 | |||
356 | void tst_QChart::margins_data() |
|
355 | void tst_QChart::margins_data() | |
357 | { |
|
356 | { | |
358 | QTest::addColumn<QRectF>("margins"); |
|
357 | QTest::addColumn<QRectF>("margins"); | |
359 | QTest::newRow("null") << QRectF(); |
|
358 | QTest::newRow("null") << QRectF(); | |
360 | } |
|
359 | } | |
361 |
|
360 | |||
362 | // public QRectF margins() const |
|
361 | // public QRectF margins() const | |
363 | void tst_QChart::margins() |
|
362 | void tst_QChart::margins() | |
364 | { |
|
363 | { | |
365 | #if 0 |
|
364 | #if 0 | |
366 | QFETCH(QRectF, margins); |
|
365 | QFETCH(QRectF, margins); | |
367 |
|
366 | |||
368 | SubQChart chart; |
|
367 | SubQChart chart; | |
369 |
|
368 | |||
370 | QCOMPARE(chart.margins(), margins); |
|
369 | QCOMPARE(chart.margins(), margins); | |
371 | #endif |
|
370 | #endif | |
372 | QSKIP("Test is not implemented.", SkipAll); |
|
371 | QSKIP("Test is not implemented.", SkipAll); | |
373 | } |
|
372 | } | |
374 |
|
373 | |||
375 | void tst_QChart::removeAllSeries_data() |
|
374 | void tst_QChart::removeAllSeries_data() | |
376 | { |
|
375 | { | |
377 | QTest::addColumn<int>("foo"); |
|
376 | QTest::addColumn<int>("foo"); | |
378 | QTest::newRow("0") << 0; |
|
377 | QTest::newRow("0") << 0; | |
379 | QTest::newRow("-1") << -1; |
|
378 | QTest::newRow("-1") << -1; | |
380 | } |
|
379 | } | |
381 |
|
380 | |||
382 | // public void removeAllSeries() |
|
381 | // public void removeAllSeries() | |
383 | void tst_QChart::removeAllSeries() |
|
382 | void tst_QChart::removeAllSeries() | |
384 | { |
|
383 | { | |
385 | #if 0 |
|
384 | #if 0 | |
386 | QFETCH(int, foo); |
|
385 | QFETCH(int, foo); | |
387 |
|
386 | |||
388 | SubQChart chart; |
|
387 | SubQChart chart; | |
389 |
|
388 | |||
390 | chart.removeAllSeries(); |
|
389 | chart.removeAllSeries(); | |
391 | #endif |
|
390 | #endif | |
392 | QSKIP("Test is not implemented.", SkipAll); |
|
391 | QSKIP("Test is not implemented.", SkipAll); | |
393 | } |
|
392 | } | |
394 |
|
393 | |||
395 | void tst_QChart::removeSeries_data() |
|
394 | void tst_QChart::removeSeries_data() | |
396 | { |
|
395 | { | |
397 | QTest::addColumn<int>("seriesCount"); |
|
396 | QTest::addColumn<int>("seriesCount"); | |
398 | QTest::newRow("0") << 0; |
|
397 | QTest::newRow("0") << 0; | |
399 | QTest::newRow("-1") << -1; |
|
398 | QTest::newRow("-1") << -1; | |
400 | } |
|
399 | } | |
401 |
|
400 | |||
402 | // public void removeSeries(QSeries* series) |
|
401 | // public void removeSeries(QSeries* series) | |
403 | void tst_QChart::removeSeries() |
|
402 | void tst_QChart::removeSeries() | |
404 | { |
|
403 | { | |
405 | #if 0 |
|
404 | #if 0 | |
406 | QFETCH(int, seriesCount); |
|
405 | QFETCH(int, seriesCount); | |
407 |
|
406 | |||
408 | SubQChart chart; |
|
407 | SubQChart chart; | |
409 |
|
408 | |||
410 | chart.removeSeries(series); |
|
409 | chart.removeSeries(series); | |
411 | #endif |
|
410 | #endif | |
412 | QSKIP("Test is not implemented.", SkipAll); |
|
411 | QSKIP("Test is not implemented.", SkipAll); | |
413 | } |
|
412 | } | |
414 |
|
413 | |||
415 | void tst_QChart::scrollDown_data() |
|
414 | void tst_QChart::scrollDown_data() | |
416 | { |
|
415 | { | |
417 | QTest::addColumn<int>("foo"); |
|
416 | QTest::addColumn<int>("foo"); | |
418 | QTest::newRow("0") << 0; |
|
417 | QTest::newRow("0") << 0; | |
419 | QTest::newRow("-1") << -1; |
|
418 | QTest::newRow("-1") << -1; | |
420 | } |
|
419 | } | |
421 |
|
420 | |||
422 | // public void scrollDown() |
|
421 | // public void scrollDown() | |
423 | void tst_QChart::scrollDown() |
|
422 | void tst_QChart::scrollDown() | |
424 | { |
|
423 | { | |
425 | #if 0 |
|
424 | #if 0 | |
426 | QFETCH(int, foo); |
|
425 | QFETCH(int, foo); | |
427 |
|
426 | |||
428 | SubQChart chart; |
|
427 | SubQChart chart; | |
429 |
|
428 | |||
430 | chart.scrollDown(); |
|
429 | chart.scrollDown(); | |
431 | #endif |
|
430 | #endif | |
432 | QSKIP("Test is not implemented.", SkipAll); |
|
431 | QSKIP("Test is not implemented.", SkipAll); | |
433 | } |
|
432 | } | |
434 |
|
433 | |||
435 | void tst_QChart::scrollLeft_data() |
|
434 | void tst_QChart::scrollLeft_data() | |
436 | { |
|
435 | { | |
437 | QTest::addColumn<int>("foo"); |
|
436 | QTest::addColumn<int>("foo"); | |
438 | QTest::newRow("0") << 0; |
|
437 | QTest::newRow("0") << 0; | |
439 | QTest::newRow("-1") << -1; |
|
438 | QTest::newRow("-1") << -1; | |
440 | } |
|
439 | } | |
441 |
|
440 | |||
442 | // public void scrollLeft() |
|
441 | // public void scrollLeft() | |
443 | void tst_QChart::scrollLeft() |
|
442 | void tst_QChart::scrollLeft() | |
444 | { |
|
443 | { | |
445 | #if 0 |
|
444 | #if 0 | |
446 | QFETCH(int, foo); |
|
445 | QFETCH(int, foo); | |
447 |
|
446 | |||
448 | SubQChart chart; |
|
447 | SubQChart chart; | |
449 |
|
448 | |||
450 | chart.scrollLeft(); |
|
449 | chart.scrollLeft(); | |
451 | #endif |
|
450 | #endif | |
452 | QSKIP("Test is not implemented.", SkipAll); |
|
451 | QSKIP("Test is not implemented.", SkipAll); | |
453 | } |
|
452 | } | |
454 |
|
453 | |||
455 | void tst_QChart::scrollRight_data() |
|
454 | void tst_QChart::scrollRight_data() | |
456 | { |
|
455 | { | |
457 | QTest::addColumn<int>("foo"); |
|
456 | QTest::addColumn<int>("foo"); | |
458 | QTest::newRow("0") << 0; |
|
457 | QTest::newRow("0") << 0; | |
459 | QTest::newRow("-1") << -1; |
|
458 | QTest::newRow("-1") << -1; | |
460 | } |
|
459 | } | |
461 |
|
460 | |||
462 | // public void scrollRight() |
|
461 | // public void scrollRight() | |
463 | void tst_QChart::scrollRight() |
|
462 | void tst_QChart::scrollRight() | |
464 | { |
|
463 | { | |
465 | #if 0 |
|
464 | #if 0 | |
466 | QFETCH(int, foo); |
|
465 | QFETCH(int, foo); | |
467 |
|
466 | |||
468 | SubQChart chart; |
|
467 | SubQChart chart; | |
469 |
|
468 | |||
470 | chart.scrollRight(); |
|
469 | chart.scrollRight(); | |
471 | #endif |
|
470 | #endif | |
472 | QSKIP("Test is not implemented.", SkipAll); |
|
471 | QSKIP("Test is not implemented.", SkipAll); | |
473 | } |
|
472 | } | |
474 |
|
473 | |||
475 | void tst_QChart::scrollUp_data() |
|
474 | void tst_QChart::scrollUp_data() | |
476 | { |
|
475 | { | |
477 | QTest::addColumn<int>("foo"); |
|
476 | QTest::addColumn<int>("foo"); | |
478 | QTest::newRow("0") << 0; |
|
477 | QTest::newRow("0") << 0; | |
479 | QTest::newRow("-1") << -1; |
|
478 | QTest::newRow("-1") << -1; | |
480 | } |
|
479 | } | |
481 |
|
480 | |||
482 | // public void scrollUp() |
|
481 | // public void scrollUp() | |
483 | void tst_QChart::scrollUp() |
|
482 | void tst_QChart::scrollUp() | |
484 | { |
|
483 | { | |
485 | #if 0 |
|
484 | #if 0 | |
486 | QFETCH(int, foo); |
|
485 | QFETCH(int, foo); | |
487 |
|
486 | |||
488 | SubQChart chart; |
|
487 | SubQChart chart; | |
489 |
|
488 | |||
490 | chart.scrollUp(); |
|
489 | chart.scrollUp(); | |
491 | #endif |
|
490 | #endif | |
492 | QSKIP("Test is not implemented.", SkipAll); |
|
491 | QSKIP("Test is not implemented.", SkipAll); | |
493 | } |
|
492 | } | |
494 |
|
493 | |||
495 | void tst_QChart::setBackgroundBrush_data() |
|
494 | void tst_QChart::setBackgroundBrush_data() | |
496 | { |
|
495 | { | |
497 | #if 0 |
|
496 | #if 0 | |
498 | QTest::addColumn<QBrush>("brush"); |
|
497 | QTest::addColumn<QBrush>("brush"); | |
499 | QTest::newRow("null") << QBrush(); |
|
498 | QTest::newRow("null") << QBrush(); | |
500 | #endif |
|
499 | #endif | |
501 | } |
|
500 | } | |
502 |
|
501 | |||
503 | // public void setBackgroundBrush(QBrush const& brush) |
|
502 | // public void setBackgroundBrush(QBrush const& brush) | |
504 | void tst_QChart::setBackgroundBrush() |
|
503 | void tst_QChart::setBackgroundBrush() | |
505 | { |
|
504 | { | |
506 | #if 0 |
|
505 | #if 0 | |
507 | QFETCH(QBrush, brush); |
|
506 | QFETCH(QBrush, brush); | |
508 |
|
507 | |||
509 | SubQChart chart; |
|
508 | SubQChart chart; | |
510 |
|
509 | |||
511 | chart.setBackgroundBrush(brush); |
|
510 | chart.setBackgroundBrush(brush); | |
512 | #endif |
|
511 | #endif | |
513 | QSKIP("Test is not implemented.", SkipAll); |
|
512 | QSKIP("Test is not implemented.", SkipAll); | |
514 | } |
|
513 | } | |
515 |
|
514 | |||
516 | void tst_QChart::setBackgroundPen_data() |
|
515 | void tst_QChart::setBackgroundPen_data() | |
517 | { |
|
516 | { | |
518 | #if 0 |
|
517 | #if 0 | |
519 | QTest::addColumn<QPen>("pen"); |
|
518 | QTest::addColumn<QPen>("pen"); | |
520 | QTest::newRow("null") << QPen(); |
|
519 | QTest::newRow("null") << QPen(); | |
521 | #endif |
|
520 | #endif | |
522 | } |
|
521 | } | |
523 |
|
522 | |||
524 | // public void setBackgroundPen(QPen const& pen) |
|
523 | // public void setBackgroundPen(QPen const& pen) | |
525 | void tst_QChart::setBackgroundPen() |
|
524 | void tst_QChart::setBackgroundPen() | |
526 | { |
|
525 | { | |
527 | #if 0 |
|
526 | #if 0 | |
528 | QFETCH(QPen, pen); |
|
527 | QFETCH(QPen, pen); | |
529 |
|
528 | |||
530 | SubQChart chart; |
|
529 | SubQChart chart; | |
531 |
|
530 | |||
532 | chart.setBackgroundPen(pen); |
|
531 | chart.setBackgroundPen(pen); | |
533 | #endif |
|
532 | #endif | |
534 | QSKIP("Test is not implemented.", SkipAll); |
|
533 | QSKIP("Test is not implemented.", SkipAll); | |
535 | } |
|
534 | } | |
536 |
|
535 | |||
537 | void tst_QChart::setBackgroundVisible_data() |
|
536 | void tst_QChart::setBackgroundVisible_data() | |
538 | { |
|
537 | { | |
539 | QTest::addColumn<bool>("visible"); |
|
538 | QTest::addColumn<bool>("visible"); | |
540 | QTest::newRow("true") << true; |
|
539 | QTest::newRow("true") << true; | |
541 | QTest::newRow("false") << false; |
|
540 | QTest::newRow("false") << false; | |
542 | } |
|
541 | } | |
543 |
|
542 | |||
544 | // public void setBackgroundVisible(bool visible) |
|
543 | // public void setBackgroundVisible(bool visible) | |
545 | void tst_QChart::setBackgroundVisible() |
|
544 | void tst_QChart::setBackgroundVisible() | |
546 | { |
|
545 | { | |
547 | #if 0 |
|
546 | #if 0 | |
548 | QFETCH(bool, visible); |
|
547 | QFETCH(bool, visible); | |
549 |
|
548 | |||
550 | SubQChart chart; |
|
549 | SubQChart chart; | |
551 |
|
550 | |||
552 | chart.setBackgroundVisible(visible); |
|
551 | chart.setBackgroundVisible(visible); | |
553 | #endif |
|
552 | #endif | |
554 | QSKIP("Test is not implemented.", SkipAll); |
|
553 | QSKIP("Test is not implemented.", SkipAll); | |
555 | } |
|
554 | } | |
556 |
|
555 | |||
557 | Q_DECLARE_METATYPE(QChart::ChartTheme) |
|
556 | Q_DECLARE_METATYPE(QChart::ChartTheme) | |
558 | void tst_QChart::setTheme_data() |
|
557 | void tst_QChart::setTheme_data() | |
559 | { |
|
558 | { | |
560 | #if 0 |
|
559 | #if 0 | |
561 | QTest::addColumn<QChart::ChartTheme>("theme"); |
|
560 | QTest::addColumn<QChart::ChartTheme>("theme"); | |
562 | QTest::newRow("null") << QChart::ChartTheme(); |
|
561 | QTest::newRow("null") << QChart::ChartTheme(); | |
563 | #endif |
|
562 | #endif | |
564 | } |
|
563 | } | |
565 |
|
564 | |||
566 | // public void setTheme(QChart::ChartTheme theme) |
|
565 | // public void setTheme(QChart::ChartTheme theme) | |
567 | void tst_QChart::setTheme() |
|
566 | void tst_QChart::setTheme() | |
568 | { |
|
567 | { | |
569 | #if 0 |
|
568 | #if 0 | |
570 | QFETCH(QChart::ChartTheme, theme); |
|
569 | QFETCH(QChart::ChartTheme, theme); | |
571 |
|
570 | |||
572 | SubQChart chart; |
|
571 | SubQChart chart; | |
573 |
|
572 | |||
574 | chart.setTheme(theme); |
|
573 | chart.setTheme(theme); | |
575 | #endif |
|
574 | #endif | |
576 | QSKIP("Test is not implemented.", SkipAll); |
|
575 | QSKIP("Test is not implemented.", SkipAll); | |
577 | } |
|
576 | } | |
578 |
|
577 | |||
579 | void tst_QChart::setTitle_data() |
|
578 | void tst_QChart::setTitle_data() | |
580 | { |
|
579 | { | |
581 | QTest::addColumn<QString>("title"); |
|
580 | QTest::addColumn<QString>("title"); | |
582 | QTest::newRow("null") << QString(); |
|
581 | QTest::newRow("null") << QString(); | |
583 | QTest::newRow("foo") << QString("foo"); |
|
582 | QTest::newRow("foo") << QString("foo"); | |
584 | } |
|
583 | } | |
585 |
|
584 | |||
586 | // public void setTitle(QString const& title) |
|
585 | // public void setTitle(QString const& title) | |
587 | void tst_QChart::setTitle() |
|
586 | void tst_QChart::setTitle() | |
588 | { |
|
587 | { | |
589 | #if 0 |
|
588 | #if 0 | |
590 | QFETCH(QString, title); |
|
589 | QFETCH(QString, title); | |
591 |
|
590 | |||
592 | SubQChart chart; |
|
591 | SubQChart chart; | |
593 |
|
592 | |||
594 | chart.setTitle(title); |
|
593 | chart.setTitle(title); | |
595 | #endif |
|
594 | #endif | |
596 | QSKIP("Test is not implemented.", SkipAll); |
|
595 | QSKIP("Test is not implemented.", SkipAll); | |
597 | } |
|
596 | } | |
598 |
|
597 | |||
599 | void tst_QChart::setTitleBrush_data() |
|
598 | void tst_QChart::setTitleBrush_data() | |
600 | { |
|
599 | { | |
601 | #if 0 |
|
600 | #if 0 | |
602 | QTest::addColumn<QBrush>("brush"); |
|
601 | QTest::addColumn<QBrush>("brush"); | |
603 | QTest::newRow("null") << QBrush(); |
|
602 | QTest::newRow("null") << QBrush(); | |
604 | #endif |
|
603 | #endif | |
605 | } |
|
604 | } | |
606 |
|
605 | |||
607 | // public void setTitleBrush(QBrush const& brush) |
|
606 | // public void setTitleBrush(QBrush const& brush) | |
608 | void tst_QChart::setTitleBrush() |
|
607 | void tst_QChart::setTitleBrush() | |
609 | { |
|
608 | { | |
610 | #if 0 |
|
609 | #if 0 | |
611 | QFETCH(QBrush, brush); |
|
610 | QFETCH(QBrush, brush); | |
612 |
|
611 | |||
613 | SubQChart chart; |
|
612 | SubQChart chart; | |
614 |
|
613 | |||
615 | chart.setTitleBrush(brush); |
|
614 | chart.setTitleBrush(brush); | |
616 | #endif |
|
615 | #endif | |
617 | QSKIP("Test is not implemented.", SkipAll); |
|
616 | QSKIP("Test is not implemented.", SkipAll); | |
618 | } |
|
617 | } | |
619 |
|
618 | |||
620 | void tst_QChart::setTitleFont_data() |
|
619 | void tst_QChart::setTitleFont_data() | |
621 | { |
|
620 | { | |
622 | QTest::addColumn<QFont>("font"); |
|
621 | QTest::addColumn<QFont>("font"); | |
623 | QTest::newRow("null") << QFont(); |
|
622 | QTest::newRow("null") << QFont(); | |
624 | } |
|
623 | } | |
625 |
|
624 | |||
626 | // public void setTitleFont(QFont const& font) |
|
625 | // public void setTitleFont(QFont const& font) | |
627 | void tst_QChart::setTitleFont() |
|
626 | void tst_QChart::setTitleFont() | |
628 | { |
|
627 | { | |
629 | #if 0 |
|
628 | #if 0 | |
630 | QFETCH(QFont, font); |
|
629 | QFETCH(QFont, font); | |
631 |
|
630 | |||
632 | SubQChart chart; |
|
631 | SubQChart chart; | |
633 |
|
632 | |||
634 | chart.setTitleFont(font); |
|
633 | chart.setTitleFont(font); | |
635 | #endif |
|
634 | #endif | |
636 | QSKIP("Test is not implemented.", SkipAll); |
|
635 | QSKIP("Test is not implemented.", SkipAll); | |
637 | } |
|
636 | } | |
638 |
|
637 | |||
639 | void tst_QChart::theme_data() |
|
638 | void tst_QChart::theme_data() | |
640 | { |
|
639 | { | |
641 | #if 0 |
|
640 | #if 0 | |
642 | QTest::addColumn<QChart::ChartTheme>("theme"); |
|
641 | QTest::addColumn<QChart::ChartTheme>("theme"); | |
643 | QTest::newRow("null") << QChart::ChartTheme(); |
|
642 | QTest::newRow("null") << QChart::ChartTheme(); | |
644 | #endif |
|
643 | #endif | |
645 | } |
|
644 | } | |
646 |
|
645 | |||
647 | // public QChart::ChartTheme theme() const |
|
646 | // public QChart::ChartTheme theme() const | |
648 | void tst_QChart::theme() |
|
647 | void tst_QChart::theme() | |
649 | { |
|
648 | { | |
650 | #if 0 |
|
649 | #if 0 | |
651 | QFETCH(QChart::ChartTheme, theme); |
|
650 | QFETCH(QChart::ChartTheme, theme); | |
652 |
|
651 | |||
653 | SubQChart chart; |
|
652 | SubQChart chart; | |
654 |
|
653 | |||
655 | QCOMPARE(chart.theme(), theme); |
|
654 | QCOMPARE(chart.theme(), theme); | |
656 | #endif |
|
655 | #endif | |
657 | QSKIP("Test is not implemented.", SkipAll); |
|
656 | QSKIP("Test is not implemented.", SkipAll); | |
658 | } |
|
657 | } | |
659 |
|
658 | |||
660 | void tst_QChart::title_data() |
|
659 | void tst_QChart::title_data() | |
661 | { |
|
660 | { | |
662 | QTest::addColumn<QString>("title"); |
|
661 | QTest::addColumn<QString>("title"); | |
663 | QTest::newRow("null") << QString(); |
|
662 | QTest::newRow("null") << QString(); | |
664 | QTest::newRow("foo") << QString("foo"); |
|
663 | QTest::newRow("foo") << QString("foo"); | |
665 | } |
|
664 | } | |
666 |
|
665 | |||
667 | // public QString title() const |
|
666 | // public QString title() const | |
668 | void tst_QChart::title() |
|
667 | void tst_QChart::title() | |
669 | { |
|
668 | { | |
670 | #if 0 |
|
669 | #if 0 | |
671 | QFETCH(QString, title); |
|
670 | QFETCH(QString, title); | |
672 |
|
671 | |||
673 | SubQChart chart; |
|
672 | SubQChart chart; | |
674 |
|
673 | |||
675 | QCOMPARE(chart.title(), title); |
|
674 | QCOMPARE(chart.title(), title); | |
676 | #endif |
|
675 | #endif | |
677 | QSKIP("Test is not implemented.", SkipAll); |
|
676 | QSKIP("Test is not implemented.", SkipAll); | |
678 | } |
|
677 | } | |
679 |
|
678 | |||
680 | void tst_QChart::titleBrush_data() |
|
679 | void tst_QChart::titleBrush_data() | |
681 | { |
|
680 | { | |
682 | #if 0 |
|
681 | #if 0 | |
683 | QTest::addColumn<QBrush>("titleBrush"); |
|
682 | QTest::addColumn<QBrush>("titleBrush"); | |
684 | QTest::newRow("null") << QBrush(); |
|
683 | QTest::newRow("null") << QBrush(); | |
685 | #endif |
|
684 | #endif | |
686 | } |
|
685 | } | |
687 |
|
686 | |||
688 | // public QBrush titleBrush() const |
|
687 | // public QBrush titleBrush() const | |
689 | void tst_QChart::titleBrush() |
|
688 | void tst_QChart::titleBrush() | |
690 | { |
|
689 | { | |
691 | #if 0 |
|
690 | #if 0 | |
692 | QFETCH(QBrush, titleBrush); |
|
691 | QFETCH(QBrush, titleBrush); | |
693 |
|
692 | |||
694 | SubQChart chart; |
|
693 | SubQChart chart; | |
695 |
|
694 | |||
696 | QCOMPARE(chart.titleBrush(), titleBrush); |
|
695 | QCOMPARE(chart.titleBrush(), titleBrush); | |
697 | #endif |
|
696 | #endif | |
698 | QSKIP("Test is not implemented.", SkipAll); |
|
697 | QSKIP("Test is not implemented.", SkipAll); | |
699 | } |
|
698 | } | |
700 |
|
699 | |||
701 | void tst_QChart::titleFont_data() |
|
700 | void tst_QChart::titleFont_data() | |
702 | { |
|
701 | { | |
703 | QTest::addColumn<QFont>("titleFont"); |
|
702 | QTest::addColumn<QFont>("titleFont"); | |
704 | QTest::newRow("null") << QFont(); |
|
703 | QTest::newRow("null") << QFont(); | |
705 | } |
|
704 | } | |
706 |
|
705 | |||
707 | // public QFont titleFont() const |
|
706 | // public QFont titleFont() const | |
708 | void tst_QChart::titleFont() |
|
707 | void tst_QChart::titleFont() | |
709 | { |
|
708 | { | |
710 | #if 0 |
|
709 | #if 0 | |
711 | QFETCH(QFont, titleFont); |
|
710 | QFETCH(QFont, titleFont); | |
712 |
|
711 | |||
713 | SubQChart chart; |
|
712 | SubQChart chart; | |
714 |
|
713 | |||
715 | QCOMPARE(chart.titleFont(), titleFont); |
|
714 | QCOMPARE(chart.titleFont(), titleFont); | |
716 | #endif |
|
715 | #endif | |
717 | QSKIP("Test is not implemented.", SkipAll); |
|
716 | QSKIP("Test is not implemented.", SkipAll); | |
718 | } |
|
717 | } | |
719 |
|
718 | |||
720 | void tst_QChart::zoomIn_data() |
|
719 | void tst_QChart::zoomIn_data() | |
721 | { |
|
720 | { | |
722 | QTest::addColumn<int>("foo"); |
|
721 | QTest::addColumn<int>("foo"); | |
723 | QTest::newRow("0") << 0; |
|
722 | QTest::newRow("0") << 0; | |
724 | QTest::newRow("-1") << -1; |
|
723 | QTest::newRow("-1") << -1; | |
725 | } |
|
724 | } | |
726 |
|
725 | |||
727 | // public void zoomIn() |
|
726 | // public void zoomIn() | |
728 | void tst_QChart::zoomIn() |
|
727 | void tst_QChart::zoomIn() | |
729 | { |
|
728 | { | |
730 | #if 0 |
|
729 | #if 0 | |
731 | QFETCH(int, foo); |
|
730 | QFETCH(int, foo); | |
732 |
|
731 | |||
733 | SubQChart chart; |
|
732 | SubQChart chart; | |
734 |
|
733 | |||
735 | chart.zoomIn(); |
|
734 | chart.zoomIn(); | |
736 | #endif |
|
735 | #endif | |
737 | QSKIP("Test is not implemented.", SkipAll); |
|
736 | QSKIP("Test is not implemented.", SkipAll); | |
738 | } |
|
737 | } | |
739 |
|
738 | |||
740 | void tst_QChart::zoomOut_data() |
|
739 | void tst_QChart::zoomOut_data() | |
741 | { |
|
740 | { | |
742 | QTest::addColumn<int>("foo"); |
|
741 | QTest::addColumn<int>("foo"); | |
743 | QTest::newRow("0") << 0; |
|
742 | QTest::newRow("0") << 0; | |
744 | QTest::newRow("-1") << -1; |
|
743 | QTest::newRow("-1") << -1; | |
745 | } |
|
744 | } | |
746 |
|
745 | |||
747 | // public void zoomOut() |
|
746 | // public void zoomOut() | |
748 | void tst_QChart::zoomOut() |
|
747 | void tst_QChart::zoomOut() | |
749 | { |
|
748 | { | |
750 | #if 0 |
|
749 | #if 0 | |
751 | QFETCH(int, foo); |
|
750 | QFETCH(int, foo); | |
752 |
|
751 | |||
753 | SubQChart chart; |
|
752 | SubQChart chart; | |
754 |
|
753 | |||
755 | chart.zoomOut(); |
|
754 | chart.zoomOut(); | |
756 | #endif |
|
755 | #endif | |
757 | QSKIP("Test is not implemented.", SkipAll); |
|
756 | QSKIP("Test is not implemented.", SkipAll); | |
758 | } |
|
757 | } | |
759 |
|
758 | |||
760 | QTEST_MAIN(tst_QChart) |
|
759 | QTEST_MAIN(tst_QChart) | |
761 | #include "tst_qchart.moc" |
|
760 | #include "tst_qchart.moc" | |
762 |
|
761 |
General Comments 0
You need to be logged in to leave comments.
Login now