@@ -1,452 +1,461 | |||||
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 "qxyseries.h" |
|
21 | #include "qxyseries.h" | |
22 | #include "qxyseries_p.h" |
|
22 | #include "qxyseries_p.h" | |
23 | #include "domain_p.h" |
|
23 | #include "domain_p.h" | |
24 | #include "legendmarker_p.h" |
|
24 | #include "legendmarker_p.h" | |
25 | #include <QAbstractItemModel> |
|
25 | #include <QAbstractItemModel> | |
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
29 | /*! |
|
29 | /*! | |
30 | \class QXYSeries |
|
30 | \class QXYSeries | |
31 | \brief The QXYSeries class is a base class for line, spline and scatter series. |
|
31 | \brief The QXYSeries class is a base class for line, spline and scatter series. | |
32 | */ |
|
32 | */ | |
33 |
|
33 | |||
34 | /*! |
|
34 | /*! | |
35 | \fn QPen QXYSeries::pen() const |
|
35 | \fn QPen QXYSeries::pen() const | |
36 | \brief Returns pen used to draw points for series. |
|
36 | \brief Returns pen used to draw points for series. | |
37 | \sa setPen() |
|
37 | \sa setPen() | |
38 | */ |
|
38 | */ | |
39 |
|
39 | |||
40 | /*! |
|
40 | /*! | |
41 | \fn QBrush QXYSeries::brush() const |
|
41 | \fn QBrush QXYSeries::brush() const | |
42 | \brief Returns brush used to draw points for series. |
|
42 | \brief Returns brush used to draw points for series. | |
43 | \sa setBrush() |
|
43 | \sa setBrush() | |
44 | */ |
|
44 | */ | |
45 |
|
45 | |||
46 | /*! |
|
46 | /*! | |
47 | \fn void QXYSeries::clicked(const QPointF& point) |
|
47 | \fn void QXYSeries::clicked(const QPointF& point) | |
48 | \brief Signal is emitted when user clicks the \a point on chart. |
|
48 | \brief Signal is emitted when user clicks the \a point on chart. | |
49 | */ |
|
49 | */ | |
50 |
|
50 | |||
51 |
|
51 | |||
52 | /*! |
|
52 | /*! | |
53 | \fn void QXYSeriesPrivate::pointReplaced(int index) |
|
53 | \fn void QXYSeriesPrivate::pointReplaced(int index) | |
54 | \brief \internal \a index |
|
54 | \brief \internal \a index | |
55 | */ |
|
55 | */ | |
56 |
|
56 | |||
57 | /*! |
|
57 | /*! | |
58 | \fn void QXYSeriesPrivate::pointAdded(int index) |
|
58 | \fn void QXYSeriesPrivate::pointAdded(int index) | |
59 | \brief \internal \a index |
|
59 | \brief \internal \a index | |
60 | */ |
|
60 | */ | |
61 |
|
61 | |||
62 | /*! |
|
62 | /*! | |
63 | \fn void QXYSeriesPrivate::pointRemoved(int index) |
|
63 | \fn void QXYSeriesPrivate::pointRemoved(int index) | |
64 | \brief \internal \a index |
|
64 | \brief \internal \a index | |
65 | */ |
|
65 | */ | |
66 |
|
66 | |||
67 | /*! |
|
67 | /*! | |
68 | \fn void QXYSeriesPrivate::updated() |
|
68 | \fn void QXYSeriesPrivate::updated() | |
69 | \brief \internal |
|
69 | \brief \internal | |
70 | */ |
|
70 | */ | |
71 |
|
71 | |||
72 | /*! |
|
72 | /*! | |
73 | \internal |
|
73 | \internal | |
74 |
|
74 | |||
75 | Constructs empty series object which is a child of \a parent. |
|
75 | Constructs empty series object which is a child of \a parent. | |
76 | When series object is added to QChartView or QChart instance ownerships is transferred. |
|
76 | When series object is added to QChartView or QChart instance ownerships is transferred. | |
77 | */ |
|
77 | */ | |
78 | QXYSeries::QXYSeries(QXYSeriesPrivate &d,QObject *parent) : QAbstractSeries(d, parent) |
|
78 | QXYSeries::QXYSeries(QXYSeriesPrivate &d,QObject *parent) : QAbstractSeries(d, parent) | |
79 | { |
|
79 | { | |
80 |
|
80 | |||
81 | } |
|
81 | } | |
82 | /*! |
|
82 | /*! | |
83 | Destroys the object. Series added to QChartView or QChart instances are owned by those, |
|
83 | Destroys the object. Series added to QChartView or QChart instances are owned by those, | |
84 | and are deleted when mentioned object are destroyed. |
|
84 | and are deleted when mentioned object are destroyed. | |
85 | */ |
|
85 | */ | |
86 | QXYSeries::~QXYSeries() |
|
86 | QXYSeries::~QXYSeries() | |
87 | { |
|
87 | { | |
88 | } |
|
88 | } | |
89 |
|
89 | |||
90 | /*! |
|
90 | /*! | |
91 | Adds data point \a x \a y to the series. Points are connected with lines on the chart. |
|
91 | Adds data point \a x \a y to the series. Points are connected with lines on the chart. | |
92 | */ |
|
92 | */ | |
93 | void QXYSeries::append(qreal x,qreal y) |
|
93 | void QXYSeries::append(qreal x,qreal y) | |
94 | { |
|
94 | { | |
95 | append(QPointF(x,y)); |
|
95 | append(QPointF(x,y)); | |
96 | } |
|
96 | } | |
97 |
|
97 | |||
98 | /*! |
|
98 | /*! | |
99 | This is an overloaded function. |
|
99 | This is an overloaded function. | |
100 | Adds data \a point to the series. Points are connected with lines on the chart. |
|
100 | Adds data \a point to the series. Points are connected with lines on the chart. | |
101 | */ |
|
101 | */ | |
102 | void QXYSeries::append(const QPointF &point) |
|
102 | void QXYSeries::append(const QPointF &point) | |
103 | { |
|
103 | { | |
104 | Q_D(QXYSeries); |
|
104 | Q_D(QXYSeries); | |
105 | d->m_points<<point; |
|
105 | d->m_points<<point; | |
106 | emit d->pointAdded(d->m_points.count()-1); |
|
106 | emit d->pointAdded(d->m_points.count()-1); | |
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | /*! |
|
109 | /*! | |
110 | This is an overloaded function. |
|
110 | This is an overloaded function. | |
111 | Adds list of data \a points to the series. Points are connected with lines on the chart. |
|
111 | Adds list of data \a points to the series. Points are connected with lines on the chart. | |
112 | */ |
|
112 | */ | |
113 | void QXYSeries::append(const QList<QPointF> &points) |
|
113 | void QXYSeries::append(const QList<QPointF> &points) | |
114 | { |
|
114 | { | |
115 | foreach(const QPointF& point , points) { |
|
115 | foreach(const QPointF& point , points) { | |
116 | append(point); |
|
116 | append(point); | |
117 | } |
|
117 | } | |
118 | } |
|
118 | } | |
119 |
|
119 | |||
120 |
|
120 | |||
121 | void QXYSeries::replace(qreal oldX,qreal oldY,qreal newX,qreal newY) |
|
121 | void QXYSeries::replace(qreal oldX,qreal oldY,qreal newX,qreal newY) | |
122 | { |
|
122 | { | |
123 | replace(QPointF(oldX,oldY),QPointF(newX,newY)); |
|
123 | replace(QPointF(oldX,oldY),QPointF(newX,newY)); | |
124 | } |
|
124 | } | |
125 |
|
125 | |||
126 | void QXYSeries::replace(const QPointF &oldPoint,const QPointF &newPoint) |
|
126 | void QXYSeries::replace(const QPointF &oldPoint,const QPointF &newPoint) | |
127 | { |
|
127 | { | |
128 | Q_D(QXYSeries); |
|
128 | Q_D(QXYSeries); | |
129 | int index = d->m_points.indexOf(oldPoint); |
|
129 | int index = d->m_points.indexOf(oldPoint); | |
130 | if(index==-1) return; |
|
130 | if(index==-1) return; | |
131 | d->m_points[index] = newPoint; |
|
131 | d->m_points[index] = newPoint; | |
132 | emit d->pointReplaced(index); |
|
132 | emit d->pointReplaced(index); | |
133 | } |
|
133 | } | |
134 |
|
134 | |||
135 | /*! |
|
135 | /*! | |
136 | Removes current \a x and \a y value. |
|
136 | Removes current \a x and \a y value. | |
137 | */ |
|
137 | */ | |
138 | void QXYSeries::remove(qreal x,qreal y) |
|
138 | void QXYSeries::remove(qreal x,qreal y) | |
139 | { |
|
139 | { | |
140 | remove(QPointF(x,y)); |
|
140 | remove(QPointF(x,y)); | |
141 | } |
|
141 | } | |
142 |
|
142 | |||
143 | /*! |
|
143 | /*! | |
144 | Removes current \a point x value. Note \a point y value is ignored. |
|
144 | Removes current \a point x value. Note \a point y value is ignored. | |
145 | */ |
|
145 | */ | |
146 | void QXYSeries::remove(const QPointF &point) |
|
146 | void QXYSeries::remove(const QPointF &point) | |
147 | { |
|
147 | { | |
148 | Q_D(QXYSeries); |
|
148 | Q_D(QXYSeries); | |
149 | int index = d->m_points.indexOf(point); |
|
149 | int index = d->m_points.indexOf(point); | |
150 | if(index==-1) return; |
|
150 | if(index==-1) return; | |
151 | d->m_points.remove(index); |
|
151 | d->m_points.remove(index); | |
152 | emit d->pointRemoved(index); |
|
152 | emit d->pointRemoved(index); | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 | /*! |
|
155 | /*! | |
156 | Removes all data points from the series. |
|
156 | Removes all data points from the series. | |
157 | */ |
|
157 | */ | |
158 | void QXYSeries::removeAll() |
|
158 | void QXYSeries::removeAll() | |
159 | { |
|
159 | { | |
160 | Q_D(QXYSeries); |
|
160 | Q_D(QXYSeries); | |
161 | foreach(const QPointF& point, d->m_points) { |
|
161 | foreach(const QPointF& point, d->m_points) { | |
162 | remove(point); |
|
162 | remove(point); | |
163 | } |
|
163 | } | |
164 | } |
|
164 | } | |
165 |
|
165 | |||
166 | /*! |
|
166 | /*! | |
167 | \internal \a pos |
|
167 | \internal \a pos | |
168 | */ |
|
168 | */ | |
169 | QList<QPointF> QXYSeries::points() const |
|
169 | QList<QPointF> QXYSeries::points() const | |
170 | { |
|
170 | { | |
171 | // Q_ASSERT(false); |
|
171 | // Q_ASSERT(false); | |
172 | Q_D(const QXYSeries); |
|
172 | Q_D(const QXYSeries); | |
173 | if (d->m_model) { |
|
173 | if (d->m_model) { | |
174 | QList<QPointF> result; |
|
174 | QList<QPointF> result; | |
175 | if (d->m_mapOrientation == Qt::Vertical){ |
|
175 | if (d->m_mapOrientation == Qt::Vertical){ | |
176 | // consecutive data is read from model's column |
|
176 | // consecutive data is read from model's column | |
177 |
|
177 | |||
178 | for(int i = d->m_mapFirst; i< d->m_mapFirst + count(); ++i) { |
|
178 | for(int i = d->m_mapFirst; i< d->m_mapFirst + count(); ++i) { | |
179 | qreal x = d->m_model->data(d->m_model->index(i, d->m_mapX), Qt::DisplayRole).toReal(); |
|
179 | qreal x = d->m_model->data(d->m_model->index(i, d->m_mapX), Qt::DisplayRole).toReal(); | |
180 | qreal y = d->m_model->data(d->m_model->index(i, d->m_mapY), Qt::DisplayRole).toReal(); |
|
180 | qreal y = d->m_model->data(d->m_model->index(i, d->m_mapY), Qt::DisplayRole).toReal(); | |
181 | result << QPointF(x,y); |
|
181 | result << QPointF(x,y); | |
182 | } |
|
182 | } | |
183 | return result; |
|
183 | return result; | |
184 | } |
|
184 | } | |
185 | else{ |
|
185 | else{ | |
186 | // consecutive data is read from model's row |
|
186 | // consecutive data is read from model's row | |
187 | for(int i = d->m_mapFirst; i< d->m_mapFirst + count(); ++i) { |
|
187 | for(int i = d->m_mapFirst; i< d->m_mapFirst + count(); ++i) { | |
188 | qreal x = d->m_model->data(d->m_model->index(d->m_mapX, i), Qt::DisplayRole).toReal(); |
|
188 | qreal x = d->m_model->data(d->m_model->index(d->m_mapX, i), Qt::DisplayRole).toReal(); | |
189 | qreal y = d->m_model->data(d->m_model->index(d->m_mapY, i), Qt::DisplayRole).toReal(); |
|
189 | qreal y = d->m_model->data(d->m_model->index(d->m_mapY, i), Qt::DisplayRole).toReal(); | |
190 | result << QPointF(x,y); |
|
190 | result << QPointF(x,y); | |
191 | } |
|
191 | } | |
192 | return result; |
|
192 | return result; | |
193 | } |
|
193 | } | |
194 | } else { |
|
194 | } else { | |
195 | // model is not specified, return the data from series' internal data store |
|
195 | // model is not specified, return the data from series' internal data store | |
196 | return d->m_points.toList(); |
|
196 | return d->m_points.toList(); | |
197 | } |
|
197 | } | |
198 | } |
|
198 | } | |
199 |
|
199 | |||
200 | /*! |
|
200 | /*! | |
201 | Returns number of data points within series. |
|
201 | Returns number of data points within series. | |
202 | */ |
|
202 | */ | |
203 | int QXYSeries::count() const |
|
203 | int QXYSeries::count() const | |
204 | { |
|
204 | { | |
205 | Q_D(const QXYSeries); |
|
205 | Q_D(const QXYSeries); | |
206 |
|
206 | |||
207 | if (d->m_model) { |
|
207 | if (d->m_model) { | |
208 | if (d->m_mapOrientation == Qt::Vertical) { |
|
208 | if (d->m_mapOrientation == Qt::Vertical) { | |
209 | // data is in a column. Return the number of mapped items if the model's column have enough items |
|
209 | // data is in a column. Return the number of mapped items if the model's column have enough items | |
210 | // or the number of items that can be mapped |
|
210 | // or the number of items that can be mapped | |
211 | if (d->m_mapCount != -1) |
|
211 | if (d->m_mapCount != -1) | |
212 | return qMin(d->m_mapCount, qMax(d->m_model->rowCount() - d->m_mapFirst, 0)); |
|
212 | return qMin(d->m_mapCount, qMax(d->m_model->rowCount() - d->m_mapFirst, 0)); | |
213 | else |
|
213 | else | |
214 | return qMax(d->m_model->rowCount() - d->m_mapFirst, 0); |
|
214 | return qMax(d->m_model->rowCount() - d->m_mapFirst, 0); | |
215 | } else { |
|
215 | } else { | |
216 | // data is in a row. Return the number of mapped items if the model's row have enough items |
|
216 | // data is in a row. Return the number of mapped items if the model's row have enough items | |
217 | // or the number of items that can be mapped |
|
217 | // or the number of items that can be mapped | |
218 | if (d->m_mapCount != -1) |
|
218 | if (d->m_mapCount != -1) | |
219 | return qMin(d->m_mapCount, qMax(d->m_model->columnCount() - d->m_mapFirst, 0)); |
|
219 | return qMin(d->m_mapCount, qMax(d->m_model->columnCount() - d->m_mapFirst, 0)); | |
220 | else |
|
220 | else | |
221 | return qMax(d->m_model->columnCount() - d->m_mapFirst, 0); |
|
221 | return qMax(d->m_model->columnCount() - d->m_mapFirst, 0); | |
222 | } |
|
222 | } | |
223 | } |
|
223 | } | |
224 |
|
224 | |||
225 | // model is not specified, return the number of points in the series internal data store |
|
225 | // model is not specified, return the number of points in the series internal data store | |
226 | return d->m_points.count(); |
|
226 | return d->m_points.count(); | |
227 | } |
|
227 | } | |
228 |
|
228 | |||
229 |
|
229 | |||
230 | /*! |
|
230 | /*! | |
231 | Sets \a pen used for drawing points on the chart. If the pen is not defined, the |
|
231 | Sets \a pen used for drawing points on the chart. If the pen is not defined, the | |
232 | pen from chart theme is used. |
|
232 | pen from chart theme is used. | |
233 | \sa QChart::setTheme() |
|
233 | \sa QChart::setTheme() | |
234 | */ |
|
234 | */ | |
235 | void QXYSeries::setPen(const QPen &pen) |
|
235 | void QXYSeries::setPen(const QPen &pen) | |
236 | { |
|
236 | { | |
237 | Q_D(QXYSeries); |
|
237 | Q_D(QXYSeries); | |
238 | if (d->m_pen!=pen) { |
|
238 | if (d->m_pen!=pen) { | |
239 | d->m_pen = pen; |
|
239 | d->m_pen = pen; | |
240 | emit d->updated(); |
|
240 | emit d->updated(); | |
241 | } |
|
241 | } | |
242 | } |
|
242 | } | |
243 |
|
243 | |||
244 | QPen QXYSeries::pen() const |
|
244 | QPen QXYSeries::pen() const | |
245 | { |
|
245 | { | |
246 | Q_D(const QXYSeries); |
|
246 | Q_D(const QXYSeries); | |
247 | return d->m_pen; |
|
247 | return d->m_pen; | |
248 | } |
|
248 | } | |
249 |
|
249 | |||
250 | /*! |
|
250 | /*! | |
251 | Sets \a brush used for drawing points on the chart. If the brush is not defined, brush |
|
251 | Sets \a brush used for drawing points on the chart. If the brush is not defined, brush | |
252 | from chart theme setting is used. |
|
252 | from chart theme setting is used. | |
253 | \sa QChart::setTheme() |
|
253 | \sa QChart::setTheme() | |
254 | */ |
|
254 | */ | |
255 | void QXYSeries::setBrush(const QBrush &brush) |
|
255 | void QXYSeries::setBrush(const QBrush &brush) | |
256 | { |
|
256 | { | |
257 | Q_D(QXYSeries); |
|
257 | Q_D(QXYSeries); | |
258 | if (d->m_brush!=brush) { |
|
258 | if (d->m_brush!=brush) { | |
259 | d->m_brush = brush; |
|
259 | d->m_brush = brush; | |
260 | emit d->updated(); |
|
260 | emit d->updated(); | |
261 | } |
|
261 | } | |
262 | } |
|
262 | } | |
263 |
|
263 | |||
264 | QBrush QXYSeries::brush() const |
|
264 | QBrush QXYSeries::brush() const | |
265 | { |
|
265 | { | |
266 | Q_D(const QXYSeries); |
|
266 | Q_D(const QXYSeries); | |
267 | return d->m_brush; |
|
267 | return d->m_brush; | |
268 | } |
|
268 | } | |
269 |
|
269 | |||
270 |
|
270 | |||
271 | /*! |
|
271 | /*! | |
272 | Sets if data points are \a visible and should be drawn on line. |
|
272 | Sets if data points are \a visible and should be drawn on line. | |
273 | */ |
|
273 | */ | |
274 | void QXYSeries::setPointsVisible(bool visible) |
|
274 | void QXYSeries::setPointsVisible(bool visible) | |
275 | { |
|
275 | { | |
276 | Q_D(QXYSeries); |
|
276 | Q_D(QXYSeries); | |
277 | if (d->m_pointsVisible != visible){ |
|
277 | if (d->m_pointsVisible != visible){ | |
278 | d->m_pointsVisible = visible; |
|
278 | d->m_pointsVisible = visible; | |
279 | emit d->updated(); |
|
279 | emit d->updated(); | |
280 | } |
|
280 | } | |
281 | } |
|
281 | } | |
282 |
|
282 | |||
283 | /*! |
|
283 | /*! | |
284 | Returns true if drawing the data points of the series is enabled. |
|
284 | Returns true if drawing the data points of the series is enabled. | |
285 | */ |
|
285 | */ | |
286 | bool QXYSeries::pointsVisible() const |
|
286 | bool QXYSeries::pointsVisible() const | |
287 | { |
|
287 | { | |
288 | Q_D(const QXYSeries); |
|
288 | Q_D(const QXYSeries); | |
289 | return d->m_pointsVisible; |
|
289 | return d->m_pointsVisible; | |
290 | } |
|
290 | } | |
291 |
|
291 | |||
292 |
|
292 | |||
293 | /*! |
|
293 | /*! | |
294 | Stream operator for adding a data \a point to the series. |
|
294 | Stream operator for adding a data \a point to the series. | |
295 | \sa append() |
|
295 | \sa append() | |
296 | */ |
|
296 | */ | |
297 | QXYSeries& QXYSeries::operator<< (const QPointF &point) |
|
297 | QXYSeries& QXYSeries::operator<< (const QPointF &point) | |
298 | { |
|
298 | { | |
299 | append(point); |
|
299 | append(point); | |
300 | return *this; |
|
300 | return *this; | |
301 | } |
|
301 | } | |
302 |
|
302 | |||
303 |
|
303 | |||
304 | /*! |
|
304 | /*! | |
305 | Stream operator for adding a list of \a points to the series. |
|
305 | Stream operator for adding a list of \a points to the series. | |
306 | \sa append() |
|
306 | \sa append() | |
307 | */ |
|
307 | */ | |
308 |
|
308 | |||
309 | QXYSeries& QXYSeries::operator<< (const QList<QPointF>& points) |
|
309 | QXYSeries& QXYSeries::operator<< (const QList<QPointF>& points) | |
310 | { |
|
310 | { | |
311 | append(points); |
|
311 | append(points); | |
312 | return *this; |
|
312 | return *this; | |
313 | } |
|
313 | } | |
314 |
|
314 | |||
315 | /*! |
|
315 | /*! | |
316 | \fn bool QXYSeries::setModel(QAbstractItemModel *model) |
|
316 | \fn bool QXYSeries::setModel(QAbstractItemModel *model) | |
317 | Sets the \a model to be used as a data source |
|
317 | Sets the \a model to be used as a data source | |
318 | \sa setModelMapping() |
|
318 | \sa setModelMapping() | |
319 | */ |
|
319 | */ | |
320 | bool QXYSeries::setModel(QAbstractItemModel *model) |
|
320 | bool QXYSeries::setModel(QAbstractItemModel *model) | |
321 | { |
|
321 | { | |
322 | Q_D(QXYSeries); |
|
322 | Q_D(QXYSeries); | |
323 | // disconnect signals from old model |
|
323 | // disconnect signals from old model | |
324 | if (d->m_model) { |
|
324 | if (d->m_model) { | |
325 | QObject::disconnect(d->m_model, 0, this, 0); |
|
325 | QObject::disconnect(d->m_model, 0, this, 0); | |
326 | d->m_mapX = -1; |
|
326 | d->m_mapX = -1; | |
327 | d->m_mapY = -1; |
|
327 | d->m_mapY = -1; | |
328 | d->m_mapOrientation = Qt::Vertical; |
|
328 | d->m_mapOrientation = Qt::Vertical; | |
329 | } |
|
329 | } | |
330 |
|
330 | |||
331 | // set new model |
|
331 | // set new model | |
332 | if (model) { |
|
332 | if (model) { | |
333 | d->m_model = model; |
|
333 | d->m_model = model; | |
334 | return true; |
|
334 | return true; | |
335 | } else { |
|
335 | } else { | |
336 | d->m_model = 0; |
|
336 | d->m_model = 0; | |
337 | return false; |
|
337 | return false; | |
338 | } |
|
338 | } | |
339 | } |
|
339 | } | |
340 |
|
340 | |||
341 | /*! |
|
341 | /*! | |
342 | Sets the \a modelX to be used as a data source for x coordinate and \a modelY to be used |
|
342 | Sets the \a modelX to be used as a data source for x coordinate and \a modelY to be used | |
343 | as a data source for y coordinate. The \a orientation parameter specifies whether the data |
|
343 | as a data source for y coordinate. The \a orientation parameter specifies whether the data | |
344 | is in columns or in rows. |
|
344 | is in columns or in rows. | |
345 | \sa setModel() |
|
345 | \sa setModel() | |
346 | */ |
|
346 | */ | |
347 | void QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation) |
|
347 | void QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation) | |
348 | { |
|
348 | { | |
349 | Q_D(QXYSeries); |
|
349 | Q_D(QXYSeries); | |
350 | if (d->m_model == 0) |
|
350 | if (d->m_model == 0) | |
351 | return; |
|
351 | return; | |
352 | d->m_mapX = modelX; |
|
352 | d->m_mapX = modelX; | |
353 | d->m_mapY = modelY; |
|
353 | d->m_mapY = modelY; | |
354 | d->m_mapOrientation = orientation; |
|
354 | d->m_mapOrientation = orientation; | |
355 |
|
355 | |||
356 | // connect the signals from the model |
|
356 | // connect the signals from the model | |
357 | connect(d->m_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex))); |
|
357 | connect(d->m_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex))); | |
358 | if (d->m_mapOrientation == Qt::Vertical) { |
|
358 | if (d->m_mapOrientation == Qt::Vertical) { | |
359 | connect(d->m_model,SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelDataAdded(QModelIndex,int,int))); |
|
359 | connect(d->m_model,SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelDataAdded(QModelIndex,int,int))); | |
360 | connect(d->m_model,SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelDataRemoved(QModelIndex,int,int))); |
|
360 | connect(d->m_model,SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelDataRemoved(QModelIndex,int,int))); | |
361 | } else { |
|
361 | } else { | |
362 | connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelDataAdded(QModelIndex,int,int))); |
|
362 | connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelDataAdded(QModelIndex,int,int))); | |
363 | connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelDataRemoved(QModelIndex,int,int))); |
|
363 | connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelDataRemoved(QModelIndex,int,int))); | |
364 | } |
|
364 | } | |
365 | } |
|
365 | } | |
366 |
|
366 | |||
367 | void QXYSeries::setModelMappingRange(int first, int count) |
|
367 | void QXYSeries::setModelMappingRange(int first, int count) | |
368 | { |
|
368 | { | |
369 | Q_D(QXYSeries); |
|
369 | Q_D(QXYSeries); | |
370 | d->m_mapFirst = first; |
|
370 | d->m_mapFirst = first; | |
371 | d->m_mapCount = count; |
|
371 | d->m_mapCount = count; | |
372 | } |
|
372 | } | |
373 |
|
373 | |||
374 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
374 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
375 |
|
375 | |||
376 |
|
376 | |||
377 | QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q) : QAbstractSeriesPrivate(q), |
|
377 | QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q) : QAbstractSeriesPrivate(q), | |
378 | m_mapX(-1), |
|
378 | m_mapX(-1), | |
379 | m_mapY(-1), |
|
379 | m_mapY(-1), | |
380 | m_pointsVisible(false) |
|
380 | m_pointsVisible(false) | |
381 | { |
|
381 | { | |
382 | } |
|
382 | } | |
383 |
|
383 | |||
384 | void QXYSeriesPrivate::scaleDomain(Domain& domain) |
|
384 | void QXYSeriesPrivate::scaleDomain(Domain& domain) | |
385 | { |
|
385 | { | |
386 | qreal minX(domain.minX()); |
|
386 | qreal minX(domain.minX()); | |
387 | qreal minY(domain.minY()); |
|
387 | qreal minY(domain.minY()); | |
388 | qreal maxX(domain.maxX()); |
|
388 | qreal maxX(domain.maxX()); | |
389 | qreal maxY(domain.maxY()); |
|
389 | qreal maxY(domain.maxY()); | |
390 | int tickXCount(domain.tickXCount()); |
|
390 | int tickXCount(domain.tickXCount()); | |
391 | int tickYCount(domain.tickYCount()); |
|
391 | int tickYCount(domain.tickYCount()); | |
392 |
|
392 | |||
393 | Q_Q(QXYSeries); |
|
393 | Q_Q(QXYSeries); | |
394 |
|
394 | |||
395 | const QList<QPointF>& points = q->points(); |
|
395 | const QList<QPointF>& points = q->points(); | |
|
396 | ||||
|
397 | if(points.isEmpty()){ | |||
|
398 | minX=0.0; | |||
|
399 | minY=0.0; | |||
|
400 | maxX=1.0; | |||
|
401 | maxY=1.0; | |||
|
402 | } | |||
|
403 | ||||
|
404 | ||||
396 | for (int i = 0; i < points.count(); i++) |
|
405 | for (int i = 0; i < points.count(); i++) | |
397 | { |
|
406 | { | |
398 | qreal x = points[i].x(); |
|
407 | qreal x = points[i].x(); | |
399 | qreal y = points[i].y(); |
|
408 | qreal y = points[i].y(); | |
400 | minX = qMin(minX, x); |
|
409 | minX = qMin(minX, x); | |
401 | minY = qMin(minY, y); |
|
410 | minY = qMin(minY, y); | |
402 | maxX = qMax(maxX, x); |
|
411 | maxX = qMax(maxX, x); | |
403 | maxY = qMax(maxY, y); |
|
412 | maxY = qMax(maxY, y); | |
404 | } |
|
413 | } | |
405 |
|
414 | |||
406 | domain.setRangeX(minX,maxX,tickXCount); |
|
415 | domain.setRangeX(minX,maxX,tickXCount); | |
407 | domain.setRangeY(minY,maxY,tickYCount); |
|
416 | domain.setRangeY(minY,maxY,tickYCount); | |
408 | } |
|
417 | } | |
409 |
|
418 | |||
410 | QList<LegendMarker*> QXYSeriesPrivate::createLegendMarker(QLegend* legend) |
|
419 | QList<LegendMarker*> QXYSeriesPrivate::createLegendMarker(QLegend* legend) | |
411 | { |
|
420 | { | |
412 | Q_Q(QXYSeries); |
|
421 | Q_Q(QXYSeries); | |
413 | QList<LegendMarker*> list; |
|
422 | QList<LegendMarker*> list; | |
414 | return list << new XYLegendMarker(q,legend); |
|
423 | return list << new XYLegendMarker(q,legend); | |
415 | } |
|
424 | } | |
416 |
|
425 | |||
417 | void QXYSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) |
|
426 | void QXYSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) | |
418 | { |
|
427 | { | |
419 | for (int row = topLeft.row(); row <= bottomRight.row(); row++) { |
|
428 | for (int row = topLeft.row(); row <= bottomRight.row(); row++) { | |
420 | for (int column = topLeft.column(); column <= bottomRight.column(); column++) { |
|
429 | for (int column = topLeft.column(); column <= bottomRight.column(); column++) { | |
421 | if (m_mapOrientation == Qt::Vertical) { |
|
430 | if (m_mapOrientation == Qt::Vertical) { | |
422 | if ((column == m_mapX || column == m_mapY) // modified item is in a mapped column |
|
431 | if ((column == m_mapX || column == m_mapY) // modified item is in a mapped column | |
423 | && row >= m_mapFirst // modfied item in not before first item |
|
432 | && row >= m_mapFirst // modfied item in not before first item | |
424 | && (m_mapCount == -1 || row < m_mapFirst + m_mapCount)) // map is not limited or item lays before the end of map |
|
433 | && (m_mapCount == -1 || row < m_mapFirst + m_mapCount)) // map is not limited or item lays before the end of map | |
425 | emit pointReplaced(row - m_mapFirst); |
|
434 | emit pointReplaced(row - m_mapFirst); | |
426 | } else { |
|
435 | } else { | |
427 | if ((row == m_mapX || row == m_mapY) // modified item is in a mapped row |
|
436 | if ((row == m_mapX || row == m_mapY) // modified item is in a mapped row | |
428 | && column >= m_mapFirst // modfied item in not before first item |
|
437 | && column >= m_mapFirst // modfied item in not before first item | |
429 | && (m_mapCount == -1 || column < m_mapFirst + m_mapCount)) // map is not limited or item lays before the end of map |
|
438 | && (m_mapCount == -1 || column < m_mapFirst + m_mapCount)) // map is not limited or item lays before the end of map | |
430 | emit pointReplaced(column - m_mapFirst); |
|
439 | emit pointReplaced(column - m_mapFirst); | |
431 | } |
|
440 | } | |
432 | } |
|
441 | } | |
433 | } |
|
442 | } | |
434 | } |
|
443 | } | |
435 |
|
444 | |||
436 |
|
445 | |||
437 | void QXYSeriesPrivate::modelDataAdded(QModelIndex parent, int start, int end) |
|
446 | void QXYSeriesPrivate::modelDataAdded(QModelIndex parent, int start, int end) | |
438 | { |
|
447 | { | |
439 | Q_UNUSED(parent); |
|
448 | Q_UNUSED(parent); | |
440 | emit pointsAdded(start, end); |
|
449 | emit pointsAdded(start, end); | |
441 | } |
|
450 | } | |
442 |
|
451 | |||
443 | void QXYSeriesPrivate::modelDataRemoved(QModelIndex parent, int start, int end) |
|
452 | void QXYSeriesPrivate::modelDataRemoved(QModelIndex parent, int start, int end) | |
444 | { |
|
453 | { | |
445 | Q_UNUSED(parent); |
|
454 | Q_UNUSED(parent); | |
446 | emit pointsRemoved(start, end); |
|
455 | emit pointsRemoved(start, end); | |
447 | } |
|
456 | } | |
448 |
|
457 | |||
449 | #include "moc_qxyseries.cpp" |
|
458 | #include "moc_qxyseries.cpp" | |
450 | #include "moc_qxyseries_p.cpp" |
|
459 | #include "moc_qxyseries_p.cpp" | |
451 |
|
460 | |||
452 | QTCOMMERCIALCHART_END_NAMESPACE |
|
461 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,658 +1,457 | |||||
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 <QtTest/QtTest> |
|
21 | #include <QtTest/QtTest> | |
22 | #include <qlineseries.h> |
|
22 | #include <qlineseries.h> | |
23 | #include <qchartview.h> |
|
23 | #include <qchartview.h> | |
24 |
|
24 | |||
25 | Q_DECLARE_METATYPE(QList<QPointF>) |
|
25 | Q_DECLARE_METATYPE(QList<QPointF>) | |
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
27 | QTCOMMERCIALCHART_USE_NAMESPACE | |
28 |
|
28 | |||
29 | class tst_QLineSeries : public QObject |
|
29 | class tst_QLineSeries : public QObject | |
30 | { |
|
30 | { | |
31 | Q_OBJECT |
|
31 | Q_OBJECT | |
32 |
|
32 | |||
33 | public slots: |
|
33 | public slots: | |
34 | void initTestCase(); |
|
34 | void initTestCase(); | |
35 | void cleanupTestCase(); |
|
35 | void cleanupTestCase(); | |
36 | void init(); |
|
36 | void init(); | |
37 | void cleanup(); |
|
37 | void cleanup(); | |
38 |
|
38 | |||
39 | private slots: |
|
39 | private slots: | |
40 | void qlineseries_data(); |
|
40 | void qlineseries_data(); | |
41 | void qlineseries(); |
|
41 | void qlineseries(); | |
42 |
|
42 | void append_raw_data(); | ||
43 |
void append_ |
|
43 | void append_raw(); | |
44 | void append(); |
|
44 | void append_chart_data(); | |
45 |
void |
|
45 | void append_chart(); | |
46 | void brush(); |
|
46 | void append_chart_animation_data(); | |
47 |
void |
|
47 | void append_chart_animation(); | |
48 |
void c |
|
48 | void chart_append_data(); | |
49 | void data_data(); |
|
49 | void chart_append(); | |
50 | void data(); |
|
50 | void count_raw_data(); | |
|
51 | void count_raw(); | |||
51 | void oper_data(); |
|
52 | void oper_data(); | |
52 | void oper(); |
|
53 | void oper(); | |
53 | void pen_data(); |
|
54 | void pen_data(); | |
54 | void pen(); |
|
55 | void pen(); | |
55 | void pointsVisible_data(); |
|
56 | void pointsVisible_raw_data(); | |
56 | void pointsVisible(); |
|
57 | void pointsVisible_raw(); | |
57 | void remove_data(); |
|
58 | void remove_raw_data(); | |
58 | void remove(); |
|
59 | void remove_raw(); | |
|
60 | void remove_chart_data(); | |||
|
61 | void remove_chart(); | |||
|
62 | void remove_chart_animation_data(); | |||
|
63 | void remove_chart_animation(); | |||
59 | void removeAll_data(); |
|
64 | void removeAll_data(); | |
60 | void removeAll(); |
|
65 | void removeAll(); | |
61 | void replace_data(); |
|
66 | void replace_data(); | |
62 | void replace(); |
|
67 | void replace(); | |
63 | void setBrush_data(); |
|
|||
64 | void setBrush(); |
|
|||
65 | void setModel_data(); |
|
68 | void setModel_data(); | |
66 | void setModel(); |
|
69 | void setModel(); | |
67 | void setModelMapping_data(); |
|
70 | void setModelMapping_data(); | |
68 | void setModelMapping(); |
|
71 | void setModelMapping(); | |
69 | void setPen_data(); |
|
72 | private: | |
70 |
void |
|
73 | void append_data(); | |
71 |
void |
|
74 | void count_data(); | |
72 |
void |
|
75 | void pointsVisible_data(); | |
73 | void x_data(); |
|
|||
74 | void x(); |
|
|||
75 | void y_data(); |
|
|||
76 | void y(); |
|
|||
77 | void clicked_data(); |
|
|||
78 | void clicked(); |
|
|||
79 | void selected_data(); |
|
|||
80 | void selected(); |
|
|||
81 |
|
76 | |||
82 | private: |
|
77 | private: | |
83 | QChartView* m_view; |
|
78 | QChartView* m_view; | |
84 | QChart* m_chart; |
|
79 | QChart* m_chart; | |
|
80 | QLineSeries* m_series; | |||
85 | }; |
|
81 | }; | |
86 |
|
82 | |||
87 | void tst_QLineSeries::initTestCase() |
|
83 | void tst_QLineSeries::initTestCase() | |
88 | { |
|
84 | { | |
89 | m_view = new QChartView(new QChart()); |
|
|||
90 | m_chart = m_view->chart(); |
|
|||
91 | } |
|
85 | } | |
92 |
|
86 | |||
93 | void tst_QLineSeries::cleanupTestCase() |
|
87 | void tst_QLineSeries::cleanupTestCase() | |
94 | { |
|
88 | { | |
95 | } |
|
89 | } | |
96 |
|
90 | |||
97 | void tst_QLineSeries::init() |
|
91 | void tst_QLineSeries::init() | |
98 | { |
|
92 | { | |
|
93 | m_view = new QChartView(new QChart()); | |||
|
94 | m_chart = m_view->chart(); | |||
|
95 | m_series = new QLineSeries(); | |||
99 | } |
|
96 | } | |
100 |
|
97 | |||
101 | void tst_QLineSeries::cleanup() |
|
98 | void tst_QLineSeries::cleanup() | |
102 | { |
|
99 | { | |
|
100 | delete m_series; | |||
103 | delete m_view; |
|
101 | delete m_view; | |
104 | m_view = 0; |
|
102 | m_view = 0; | |
105 | m_chart = 0; |
|
103 | m_chart = 0; | |
|
104 | m_series = 0; | |||
106 | } |
|
105 | } | |
107 |
|
106 | |||
108 | void tst_QLineSeries::qlineseries_data() |
|
107 | void tst_QLineSeries::qlineseries_data() | |
109 | { |
|
108 | { | |
|
109 | ||||
110 | } |
|
110 | } | |
111 |
|
111 | |||
112 | void tst_QLineSeries::qlineseries() |
|
112 | void tst_QLineSeries::qlineseries() | |
113 | { |
|
113 | { | |
114 | QLineSeries series; |
|
114 | QLineSeries series; | |
115 |
|
115 | |||
116 | QCOMPARE(series.count(),0); |
|
116 | QCOMPARE(series.count(),0); | |
117 | QCOMPARE(series.brush(), QBrush()); |
|
117 | QCOMPARE(series.brush(), QBrush()); | |
118 | QCOMPARE(series.points(), QList<QPointF>()); |
|
118 | QCOMPARE(series.points(), QList<QPointF>()); | |
119 | QCOMPARE(series.pen(), QPen()); |
|
119 | QCOMPARE(series.pen(), QPen()); | |
120 | QCOMPARE(series.pointsVisible(), false); |
|
120 | QCOMPARE(series.pointsVisible(), false); | |
121 |
|
121 | |||
122 | series.append(QList<QPointF>()); |
|
122 | series.append(QList<QPointF>()); | |
123 | series.append(0.0,0.0); |
|
123 | series.append(0.0,0.0); | |
124 | series.append(QPointF()); |
|
124 | series.append(QPointF()); | |
125 |
|
125 | |||
126 | series.remove(0.0,0.0); |
|
126 | series.remove(0.0,0.0); | |
127 | series.remove(QPointF()); |
|
127 | series.remove(QPointF()); | |
128 | series.removeAll(); |
|
128 | series.removeAll(); | |
129 |
|
129 | |||
130 | series.replace(QPointF(),QPointF()); |
|
130 | series.replace(QPointF(),QPointF()); | |
131 | series.replace(0,0,0,0); |
|
131 | series.replace(0,0,0,0); | |
132 | series.setBrush(QBrush()); |
|
132 | series.setBrush(QBrush()); | |
133 |
|
133 | |||
134 | QCOMPARE(series.setModel((QAbstractItemModel*)0), false); |
|
134 | QCOMPARE(series.setModel((QAbstractItemModel*)0), false); | |
135 |
|
135 | |||
136 | series.setModelMapping(-1, -1, Qt::Orientation(0)); |
|
136 | series.setModelMapping(-1, -1, Qt::Orientation(0)); | |
137 |
|
137 | |||
138 | series.setPen(QPen()); |
|
138 | series.setPen(QPen()); | |
139 | series.setPointsVisible(false); |
|
139 | series.setPointsVisible(false); | |
|
140 | ||||
|
141 | m_chart->addSeries(&series); | |||
|
142 | m_view->show(); | |||
|
143 | QTest::qWaitForWindowShown(m_view); | |||
140 | } |
|
144 | } | |
141 |
|
145 | |||
142 | void tst_QLineSeries::append_data() |
|
146 | void tst_QLineSeries::append_data() | |
143 | { |
|
147 | { | |
144 | #if 0 |
|
148 | QTest::addColumn< QList<QPointF> >("points"); | |
145 | QTest::addColumn<QList<QPointF>>("points"); |
|
149 | QTest::newRow("0,0 1,1 2,2 3,3") << (QList<QPointF>() << QPointF(0,0) << QPointF(1,1) << QPointF(2,2) << QPointF(3,3)); | |
146 | QTest::newRow("null") << QList<QPointF>(); |
|
150 | QTest::newRow("0,0 -1,-1 -2,-2 -3,-3") << (QList<QPointF>() << QPointF(0,0) << QPointF(-1,-1) << QPointF(-2,-2) << QPointF(-3,-3)); | |
147 | #endif |
|
|||
148 | } |
|
151 | } | |
149 |
|
152 | |||
150 | // public void append(QList<QPointF> const points) |
|
|||
151 | void tst_QLineSeries::append() |
|
|||
152 | { |
|
|||
153 | #if 0 |
|
|||
154 | QFETCH(QList<QPointF>, points); |
|
|||
155 |
|
||||
156 | SubQXYSeries series; |
|
|||
157 |
|
||||
158 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
|||
159 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
160 |
|
153 | |||
161 | series.append(points); |
|
154 | void tst_QLineSeries::append_raw_data() | |
|
155 | { | |||
|
156 | append_data(); | |||
|
157 | } | |||
162 |
|
158 | |||
|
159 | void tst_QLineSeries::append_raw() | |||
|
160 | { | |||
|
161 | QFETCH(QList<QPointF>, points); | |||
|
162 | QSignalSpy spy0(m_series, SIGNAL(clicked(QPointF const&))); | |||
|
163 | QTest::qWait(200); | |||
|
164 | m_series->append(points); | |||
|
165 | QTest::qWait(200); | |||
163 | QCOMPARE(spy0.count(), 0); |
|
166 | QCOMPARE(spy0.count(), 0); | |
164 |
QCOMPARE( |
|
167 | QCOMPARE(m_series->points(), points); | |
165 | #endif |
|
|||
166 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
167 | } |
|
168 | } | |
168 |
|
169 | |||
169 | Q_DECLARE_METATYPE(QBrush) |
|
170 | void tst_QLineSeries::chart_append_data() | |
170 | void tst_QLineSeries::brush_data() |
|
|||
171 | { |
|
171 | { | |
172 | #if 0 |
|
172 | append_data(); | |
173 | QTest::addColumn<QBrush>("brush"); |
|
|||
174 | QTest::newRow("null") << QBrush(); |
|
|||
175 | #endif |
|
|||
176 | } |
|
173 | } | |
177 |
|
174 | |||
178 | // public QBrush brush() const |
|
175 | void tst_QLineSeries::chart_append() | |
179 | void tst_QLineSeries::brush() |
|
|||
180 | { |
|
176 | { | |
181 | #if 0 |
|
177 | append_raw(); | |
182 | QFETCH(QBrush, brush); |
|
178 | m_chart->addSeries(m_series); | |
|
179 | m_view->show(); | |||
|
180 | QTest::qWaitForWindowShown(m_view); | |||
|
181 | } | |||
183 |
|
182 | |||
184 | SubQXYSeries series; |
|
183 | void tst_QLineSeries::append_chart_data() | |
|
184 | { | |||
|
185 | append_data(); | |||
|
186 | } | |||
185 |
|
187 | |||
186 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
188 | void tst_QLineSeries::append_chart() | |
187 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
189 | { | |
|
190 | m_view->show(); | |||
|
191 | m_chart->addSeries(m_series); | |||
|
192 | append_raw(); | |||
|
193 | QTest::qWaitForWindowShown(m_view); | |||
|
194 | } | |||
188 |
|
195 | |||
189 | QCOMPARE(series.brush(), brush); |
|
196 | void tst_QLineSeries::append_chart_animation_data() | |
|
197 | { | |||
|
198 | append_data(); | |||
|
199 | } | |||
190 |
|
200 | |||
191 | QCOMPARE(spy0.count(), 0); |
|
201 | void tst_QLineSeries::append_chart_animation() | |
192 | QCOMPARE(spy1.count(), 0); |
|
202 | { | |
193 | #endif |
|
203 | m_chart->setAnimationOptions(QChart::AllAnimations); | |
194 | QSKIP("Test is not implemented.", SkipAll); |
|
204 | append_chart(); | |
195 | } |
|
205 | } | |
196 |
|
206 | |||
197 | void tst_QLineSeries::count_data() |
|
207 | void tst_QLineSeries::count_data() | |
198 | { |
|
208 | { | |
199 | QTest::addColumn<int>("count"); |
|
209 | QTest::addColumn<int>("count"); | |
200 | QTest::newRow("0") << 0; |
|
210 | QTest::newRow("0") << 0; | |
201 |
QTest::newRow(" |
|
211 | QTest::newRow("5") << 5; | |
202 | } |
|
212 | QTest::newRow("10") << 5; | |
203 |
|
||||
204 | // public int count() const |
|
|||
205 | void tst_QLineSeries::count() |
|
|||
206 | { |
|
|||
207 | #if 0 |
|
|||
208 | QFETCH(int, count); |
|
|||
209 |
|
||||
210 | SubQXYSeries series; |
|
|||
211 |
|
||||
212 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
|||
213 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
214 |
|
||||
215 | QCOMPARE(series.count(), count); |
|
|||
216 |
|
||||
217 | QCOMPARE(spy0.count(), 0); |
|
|||
218 | QCOMPARE(spy1.count(), 0); |
|
|||
219 | #endif |
|
|||
220 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
221 | } |
|
213 | } | |
222 |
|
214 | |||
223 |
void tst_QLineSeries:: |
|
215 | void tst_QLineSeries::count_raw_data() | |
224 | { |
|
216 | { | |
225 | #if 0 |
|
217 | count_data(); | |
226 | QTest::addColumn<QList<QPointF>>("data"); |
|
|||
227 | QTest::newRow("null") << QList<QPointF>(); |
|
|||
228 | #endif |
|
|||
229 | } |
|
218 | } | |
230 |
|
219 | |||
231 | // public QList<QPointF> data() |
|
220 | void tst_QLineSeries::count_raw() | |
232 | void tst_QLineSeries::data() |
|
|||
233 | { |
|
221 | { | |
234 | #if 0 |
|
222 | QFETCH(int, count); | |
235 | QFETCH(QList<QPointF>, data); |
|
|||
236 |
|
||||
237 | SubQXYSeries series; |
|
|||
238 |
|
223 | |||
239 |
QSignalSpy spy0( |
|
224 | QSignalSpy spy0(m_series, SIGNAL(clicked(QPointF const&))); | |
240 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
241 |
|
225 | |||
242 | QCOMPARE(series.data(), data); |
|
226 | for(int i=0 ; i< count; ++i) | |
|
227 | m_series->append(i,i); | |||
243 |
|
228 | |||
244 | QCOMPARE(spy0.count(), 0); |
|
229 | QCOMPARE(spy0.count(), 0); | |
245 |
QCOMPARE( |
|
230 | QCOMPARE(m_series->count(), count); | |
246 | #endif |
|
|||
247 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
248 | } |
|
231 | } | |
249 |
|
232 | |||
250 | void tst_QLineSeries::oper_data() |
|
233 | void tst_QLineSeries::oper_data() | |
251 | { |
|
234 | { | |
252 | #if 0 |
|
235 | append_data(); | |
253 | QTest::addColumn<QList<QPointF>>("points"); |
|
|||
254 | QTest::addColumn<QXYSeries&>("operator<<"); |
|
|||
255 | QTest::newRow("null") << QList<QPointF>() << QXYSeries&(); |
|
|||
256 | #endif |
|
|||
257 | } |
|
236 | } | |
258 |
|
237 | |||
259 | // public QXYSeries& operator<<(QList<QPointF> const points) |
|
|||
260 | void tst_QLineSeries::oper() |
|
238 | void tst_QLineSeries::oper() | |
261 | { |
|
239 | { | |
262 | #if 0 |
|
|||
263 | QFETCH(QList<QPointF>, points); |
|
240 | QFETCH(QList<QPointF>, points); | |
264 | QFETCH(QXYSeries&, operator<<); |
|
241 | QLineSeries series; | |
265 |
|
||||
266 | SubQXYSeries series; |
|
|||
267 |
|
242 | |||
268 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
243 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); | |
269 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
270 |
|
244 | |||
271 | QCOMPARE(series.operator<<(points), operator<<); |
|
245 | foreach(const QPointF& point,points) | |
|
246 | { | |||
|
247 | series<<point; | |||
|
248 | } | |||
272 |
|
249 | |||
|
250 | QCOMPARE(series.points(), points); | |||
273 | QCOMPARE(spy0.count(), 0); |
|
251 | QCOMPARE(spy0.count(), 0); | |
274 | QCOMPARE(spy1.count(), 0); |
|
|||
275 | #endif |
|
|||
276 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
277 | } |
|
252 | } | |
278 |
|
253 | |||
279 | Q_DECLARE_METATYPE(QPen) |
|
254 | ||
280 | void tst_QLineSeries::pen_data() |
|
255 | void tst_QLineSeries::pen_data() | |
281 | { |
|
256 | { | |
282 | #if 0 |
|
|||
283 | QTest::addColumn<QPen>("pen"); |
|
257 | QTest::addColumn<QPen>("pen"); | |
284 | QTest::newRow("null") << QPen(); |
|
258 | QTest::newRow("null") << QPen(); | |
285 | #endif |
|
259 | QTest::newRow("blue") << QPen(Qt::blue); | |
|
260 | QTest::newRow("black") << QPen(Qt::black); | |||
|
261 | QTest::newRow("red") << QPen(Qt::red); | |||
286 | } |
|
262 | } | |
287 |
|
263 | |||
288 | // public QPen pen() const |
|
|||
289 | void tst_QLineSeries::pen() |
|
264 | void tst_QLineSeries::pen() | |
290 | { |
|
265 | { | |
291 | #if 0 |
|
|||
292 | QFETCH(QPen, pen); |
|
266 | QFETCH(QPen, pen); | |
293 |
|
267 | QLineSeries series; | ||
294 | SubQXYSeries series; |
|
|||
295 |
|
268 | |||
296 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
269 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); | |
297 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
270 | series.setPen(pen); | |
298 |
|
271 | |||
|
272 | QCOMPARE(spy0.count(), 0); | |||
299 | QCOMPARE(series.pen(), pen); |
|
273 | QCOMPARE(series.pen(), pen); | |
300 |
|
274 | |||
301 | QCOMPARE(spy0.count(), 0); |
|
275 | m_chart->addSeries(&series); | |
302 | QCOMPARE(spy1.count(), 0); |
|
276 | ||
303 | #endif |
|
277 | if(pen!=QPen()) QCOMPARE(series.pen(), pen); | |
304 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
305 | } |
|
278 | } | |
306 |
|
279 | |||
307 | void tst_QLineSeries::pointsVisible_data() |
|
280 | void tst_QLineSeries::pointsVisible_data() | |
308 | { |
|
281 | { | |
309 | QTest::addColumn<bool>("pointsVisible"); |
|
282 | QTest::addColumn<bool>("pointsVisible"); | |
310 | QTest::newRow("true") << true; |
|
283 | QTest::newRow("true") << true; | |
311 | QTest::newRow("false") << false; |
|
284 | QTest::newRow("false") << false; | |
312 | } |
|
285 | } | |
313 |
|
286 | |||
314 | // public bool pointsVisible() const |
|
287 | void tst_QLineSeries::pointsVisible_raw_data() | |
315 | void tst_QLineSeries::pointsVisible() |
|
288 | { | |
|
289 | pointsVisible_data(); | |||
|
290 | } | |||
|
291 | ||||
|
292 | void tst_QLineSeries::pointsVisible_raw() | |||
316 | { |
|
293 | { | |
317 | #if 0 |
|
|||
318 | QFETCH(bool, pointsVisible); |
|
294 | QFETCH(bool, pointsVisible); | |
|
295 | QSignalSpy spy0(m_series, SIGNAL(clicked(QPointF const&))); | |||
|
296 | m_series->setPointsVisible(pointsVisible); | |||
|
297 | QCOMPARE(spy0.count(), 0); | |||
|
298 | QCOMPARE(m_series->pointsVisible(), pointsVisible); | |||
|
299 | } | |||
319 |
|
300 | |||
320 | SubQXYSeries series; |
|
301 | void tst_QLineSeries::remove_raw_data() | |
|
302 | { | |||
|
303 | append_data(); | |||
|
304 | } | |||
321 |
|
305 | |||
322 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
306 | void tst_QLineSeries::remove_raw() | |
323 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
307 | { | |
|
308 | QFETCH(QList<QPointF>, points); | |||
|
309 | QSignalSpy spy0(m_series, SIGNAL(clicked(QPointF const&))); | |||
|
310 | m_series->append(points); | |||
|
311 | QTest::qWait(200); | |||
|
312 | QCOMPARE(spy0.count(), 0); | |||
|
313 | QCOMPARE(m_series->points(), points); | |||
324 |
|
314 | |||
325 | QCOMPARE(series.pointsVisible(), pointsVisible); |
|
315 | foreach(const QPointF& point,points) | |
|
316 | { | |||
|
317 | m_series->remove(point); | |||
|
318 | QTest::qWait(200); | |||
|
319 | } | |||
326 |
|
320 | |||
327 | QCOMPARE(spy0.count(), 0); |
|
321 | QCOMPARE(spy0.count(), 0); | |
328 |
QCOMPARE( |
|
322 | QCOMPARE(m_series->points().count(), 0); | |
329 | #endif |
|
|||
330 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
331 | } |
|
323 | } | |
332 |
|
324 | |||
333 | void tst_QLineSeries::remove_data() |
|
325 | void tst_QLineSeries::remove_chart_data() | |
334 | { |
|
326 | { | |
335 | QTest::addColumn<qreal>("x"); |
|
327 | append_data(); | |
336 | QTest::addColumn<qreal>("y"); |
|
|||
337 | QTest::newRow("null") << 0.0 << 0.0; |
|
|||
338 | } |
|
328 | } | |
339 |
|
329 | |||
340 | // public void remove(qreal x, qreal y) |
|
330 | void tst_QLineSeries::remove_chart() | |
341 | void tst_QLineSeries::remove() |
|
|||
342 | { |
|
331 | { | |
343 | #if 0 |
|
332 | m_view->show(); | |
344 | QFETCH(qreal, x); |
|
333 | m_chart->addSeries(m_series); | |
345 | QFETCH(qreal, y); |
|
334 | remove_raw(); | |
346 |
|
335 | QTest::qWaitForWindowShown(m_view); | ||
347 | SubQXYSeries series; |
|
336 | } | |
348 |
|
||||
349 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
|||
350 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
351 |
|
337 | |||
352 | series.remove(x, y); |
|
338 | void tst_QLineSeries::remove_chart_animation_data() | |
|
339 | { | |||
|
340 | append_data(); | |||
|
341 | } | |||
353 |
|
342 | |||
354 | QCOMPARE(spy0.count(), 0); |
|
343 | void tst_QLineSeries::remove_chart_animation() | |
355 | QCOMPARE(spy1.count(), 0); |
|
344 | { | |
356 | #endif |
|
345 | m_chart->setAnimationOptions(QChart::AllAnimations); | |
357 | QSKIP("Test is not implemented.", SkipAll); |
|
346 | remove_chart(); | |
358 | } |
|
347 | } | |
359 |
|
348 | |||
|
349 | ||||
360 | void tst_QLineSeries::removeAll_data() |
|
350 | void tst_QLineSeries::removeAll_data() | |
361 | { |
|
351 | { | |
362 | QTest::addColumn<int>("foo"); |
|
352 | append_data(); | |
363 | QTest::newRow("0") << 0; |
|
|||
364 | QTest::newRow("-1") << -1; |
|
|||
365 | } |
|
353 | } | |
366 |
|
354 | |||
367 | // public void removeAll() |
|
|||
368 | void tst_QLineSeries::removeAll() |
|
355 | void tst_QLineSeries::removeAll() | |
369 | { |
|
356 | { | |
370 | #if 0 |
|
357 | #if 0 | |
371 | QFETCH(int, foo); |
|
358 | QFETCH(int, foo); | |
372 |
|
359 | |||
373 | SubQXYSeries series; |
|
360 | SubQXYSeries series; | |
374 |
|
361 | |||
375 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
362 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); | |
376 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
363 | QSignalSpy spy1(&series, SIGNAL(selected())); | |
377 |
|
364 | |||
378 | series.removeAll(); |
|
365 | series.removeAll(); | |
379 |
|
366 | |||
380 | QCOMPARE(spy0.count(), 0); |
|
367 | QCOMPARE(spy0.count(), 0); | |
381 | QCOMPARE(spy1.count(), 0); |
|
368 | QCOMPARE(spy1.count(), 0); | |
382 | #endif |
|
369 | #endif | |
383 | QSKIP("Test is not implemented.", SkipAll); |
|
370 | QSKIP("Test is not implemented.", SkipAll); | |
384 | } |
|
371 | } | |
385 |
|
372 | |||
386 | void tst_QLineSeries::replace_data() |
|
373 | void tst_QLineSeries::replace_data() | |
387 | { |
|
374 | { | |
388 | QTest::addColumn<QPointF>("point"); |
|
375 | QTest::addColumn<QPointF>("point"); | |
389 | QTest::newRow("null") << QPointF(); |
|
376 | QTest::newRow("null") << QPointF(); | |
390 | } |
|
377 | } | |
391 |
|
378 | |||
392 | // public void replace(QPointF const& point) |
|
|||
393 | void tst_QLineSeries::replace() |
|
379 | void tst_QLineSeries::replace() | |
394 | { |
|
380 | { | |
395 | #if 0 |
|
381 | #if 0 | |
396 | QFETCH(QPointF, point); |
|
382 | QFETCH(QPointF, point); | |
397 |
|
383 | |||
398 | SubQXYSeries series; |
|
384 | SubQXYSeries series; | |
399 |
|
385 | |||
400 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
386 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); | |
401 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
387 | QSignalSpy spy1(&series, SIGNAL(selected())); | |
402 |
|
388 | |||
403 | series.replace(point); |
|
389 | series.replace(point); | |
404 |
|
390 | |||
405 | QCOMPARE(spy0.count(), 0); |
|
391 | QCOMPARE(spy0.count(), 0); | |
406 | QCOMPARE(spy1.count(), 0); |
|
392 | QCOMPARE(spy1.count(), 0); | |
407 | #endif |
|
393 | #endif | |
408 | QSKIP("Test is not implemented.", SkipAll); |
|
394 | QSKIP("Test is not implemented.", SkipAll); | |
409 | } |
|
395 | } | |
410 |
|
396 | |||
411 | void tst_QLineSeries::setBrush_data() |
|
|||
412 | { |
|
|||
413 | #if 0 |
|
|||
414 | QTest::addColumn<QBrush>("brush"); |
|
|||
415 | QTest::newRow("null") << QBrush(); |
|
|||
416 | #endif |
|
|||
417 | } |
|
|||
418 |
|
||||
419 | // public void setBrush(QBrush const& brush) |
|
|||
420 | void tst_QLineSeries::setBrush() |
|
|||
421 | { |
|
|||
422 | #if 0 |
|
|||
423 | QFETCH(QBrush, brush); |
|
|||
424 |
|
||||
425 | SubQXYSeries series; |
|
|||
426 |
|
||||
427 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
|||
428 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
429 |
|
||||
430 | series.setBrush(brush); |
|
|||
431 |
|
||||
432 | QCOMPARE(spy0.count(), 0); |
|
|||
433 | QCOMPARE(spy1.count(), 0); |
|
|||
434 | #endif |
|
|||
435 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
436 | } |
|
|||
437 |
|
||||
438 | void tst_QLineSeries::setModel_data() |
|
397 | void tst_QLineSeries::setModel_data() | |
439 | { |
|
398 | { | |
440 | QTest::addColumn<int>("modelCount"); |
|
399 | QTest::addColumn<int>("modelCount"); | |
441 | QTest::addColumn<bool>("setModel"); |
|
400 | QTest::addColumn<bool>("setModel"); | |
442 | QTest::newRow("null") << 0 << false; |
|
401 | QTest::newRow("null") << 0 << false; | |
443 | } |
|
402 | } | |
444 |
|
403 | |||
445 | // public bool setModel(QAbstractItemModel* model) |
|
|||
446 | void tst_QLineSeries::setModel() |
|
404 | void tst_QLineSeries::setModel() | |
447 | { |
|
405 | { | |
448 | #if 0 |
|
406 | #if 0 | |
449 | QFETCH(int, modelCount); |
|
407 | QFETCH(int, modelCount); | |
450 | QFETCH(bool, setModel); |
|
408 | QFETCH(bool, setModel); | |
451 |
|
409 | |||
452 | SubQXYSeries series; |
|
410 | SubQXYSeries series; | |
453 |
|
411 | |||
454 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
412 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); | |
455 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
413 | QSignalSpy spy1(&series, SIGNAL(selected())); | |
456 |
|
414 | |||
457 | QCOMPARE(series.setModel(model), setModel); |
|
415 | QCOMPARE(series.setModel(model), setModel); | |
458 |
|
416 | |||
459 | QCOMPARE(spy0.count(), 0); |
|
417 | QCOMPARE(spy0.count(), 0); | |
460 | QCOMPARE(spy1.count(), 0); |
|
418 | QCOMPARE(spy1.count(), 0); | |
461 | #endif |
|
419 | #endif | |
462 | QSKIP("Test is not implemented.", SkipAll); |
|
420 | QSKIP("Test is not implemented.", SkipAll); | |
463 | } |
|
421 | } | |
464 |
|
422 | |||
465 | Q_DECLARE_METATYPE(Qt::Orientation) |
|
423 | Q_DECLARE_METATYPE(Qt::Orientation) | |
466 | void tst_QLineSeries::setModelMapping_data() |
|
424 | void tst_QLineSeries::setModelMapping_data() | |
467 | { |
|
425 | { | |
468 | #if 0 |
|
426 | #if 0 | |
469 | QTest::addColumn<int>("modelX"); |
|
427 | QTest::addColumn<int>("modelX"); | |
470 | QTest::addColumn<int>("modelY"); |
|
428 | QTest::addColumn<int>("modelY"); | |
471 | QTest::addColumn<Qt::Orientation>("orientation"); |
|
429 | QTest::addColumn<Qt::Orientation>("orientation"); | |
472 | QTest::newRow("null") << 0 << 0 << Qt::Orientation(); |
|
430 | QTest::newRow("null") << 0 << 0 << Qt::Orientation(); | |
473 | #endif |
|
431 | #endif | |
474 | } |
|
432 | } | |
475 |
|
433 | |||
476 | // public void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical) |
|
|||
477 | void tst_QLineSeries::setModelMapping() |
|
434 | void tst_QLineSeries::setModelMapping() | |
478 | { |
|
435 | { | |
479 | #if 0 |
|
436 | #if 0 | |
480 | QFETCH(int, modelX); |
|
437 | QFETCH(int, modelX); | |
481 | QFETCH(int, modelY); |
|
438 | QFETCH(int, modelY); | |
482 | QFETCH(Qt::Orientation, orientation); |
|
439 | QFETCH(Qt::Orientation, orientation); | |
483 |
|
440 | |||
484 | SubQXYSeries series; |
|
441 | SubQXYSeries series; | |
485 |
|
442 | |||
486 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
443 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); | |
487 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
444 | QSignalSpy spy1(&series, SIGNAL(selected())); | |
488 |
|
445 | |||
489 | series.setModelMapping(modelX, modelY, orientation); |
|
446 | series.setModelMapping(modelX, modelY, orientation); | |
490 |
|
447 | |||
491 | QCOMPARE(spy0.count(), 0); |
|
448 | QCOMPARE(spy0.count(), 0); | |
492 | QCOMPARE(spy1.count(), 0); |
|
449 | QCOMPARE(spy1.count(), 0); | |
493 | #endif |
|
450 | #endif | |
494 | QSKIP("Test is not implemented.", SkipAll); |
|
451 | QSKIP("Test is not implemented.", SkipAll); | |
495 | } |
|
452 | } | |
496 |
|
453 | |||
497 | void tst_QLineSeries::setPen_data() |
|
|||
498 | { |
|
|||
499 | #if 0 |
|
|||
500 | QTest::addColumn<QPen>("pen"); |
|
|||
501 | QTest::newRow("null") << QPen(); |
|
|||
502 | #endif |
|
|||
503 | } |
|
|||
504 |
|
||||
505 | // public void setPen(QPen const& pen) |
|
|||
506 | void tst_QLineSeries::setPen() |
|
|||
507 | { |
|
|||
508 | #if 0 |
|
|||
509 | QFETCH(QPen, pen); |
|
|||
510 |
|
||||
511 | SubQXYSeries series; |
|
|||
512 |
|
||||
513 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
|||
514 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
515 |
|
||||
516 | series.setPen(pen); |
|
|||
517 |
|
||||
518 | QCOMPARE(spy0.count(), 0); |
|
|||
519 | QCOMPARE(spy1.count(), 0); |
|
|||
520 | #endif |
|
|||
521 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
522 | } |
|
|||
523 |
|
||||
524 | void tst_QLineSeries::setPointsVisible_data() |
|
|||
525 | { |
|
|||
526 | QTest::addColumn<bool>("visible"); |
|
|||
527 | QTest::newRow("true") << true; |
|
|||
528 | QTest::newRow("false") << false; |
|
|||
529 | } |
|
|||
530 |
|
||||
531 | // public void setPointsVisible(bool visible = true) |
|
|||
532 | void tst_QLineSeries::setPointsVisible() |
|
|||
533 | { |
|
|||
534 | #if 0 |
|
|||
535 | QFETCH(bool, visible); |
|
|||
536 |
|
||||
537 | SubQXYSeries series; |
|
|||
538 |
|
||||
539 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
|||
540 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
541 |
|
||||
542 | series.setPointsVisible(visible); |
|
|||
543 |
|
||||
544 | QCOMPARE(spy0.count(), 0); |
|
|||
545 | QCOMPARE(spy1.count(), 0); |
|
|||
546 | #endif |
|
|||
547 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
548 | } |
|
|||
549 |
|
||||
550 | void tst_QLineSeries::x_data() |
|
|||
551 | { |
|
|||
552 | QTest::addColumn<int>("pos"); |
|
|||
553 | QTest::addColumn<qreal>("x"); |
|
|||
554 | QTest::newRow("null") << 0 << 0.0; |
|
|||
555 | } |
|
|||
556 |
|
||||
557 | // public qreal x(int pos) const |
|
|||
558 | void tst_QLineSeries::x() |
|
|||
559 | { |
|
|||
560 | #if 0 |
|
|||
561 | QFETCH(int, pos); |
|
|||
562 | QFETCH(qreal, x); |
|
|||
563 |
|
||||
564 | SubQXYSeries series; |
|
|||
565 |
|
||||
566 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
|||
567 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
568 |
|
||||
569 | QCOMPARE(series.x(pos), x); |
|
|||
570 |
|
||||
571 | QCOMPARE(spy0.count(), 0); |
|
|||
572 | QCOMPARE(spy1.count(), 0); |
|
|||
573 | #endif |
|
|||
574 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
575 | } |
|
|||
576 |
|
||||
577 | void tst_QLineSeries::y_data() |
|
|||
578 | { |
|
|||
579 | QTest::addColumn<int>("pos"); |
|
|||
580 | QTest::addColumn<qreal>("y"); |
|
|||
581 | QTest::newRow("null") << 0 << 0.0; |
|
|||
582 | } |
|
|||
583 |
|
||||
584 | // public qreal y(int pos) const |
|
|||
585 | void tst_QLineSeries::y() |
|
|||
586 | { |
|
|||
587 | #if 0 |
|
|||
588 | QFETCH(int, pos); |
|
|||
589 | QFETCH(qreal, y); |
|
|||
590 |
|
||||
591 | SubQXYSeries series; |
|
|||
592 |
|
||||
593 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
|||
594 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
595 |
|
||||
596 | QCOMPARE(series.y(pos), y); |
|
|||
597 |
|
||||
598 | QCOMPARE(spy0.count(), 0); |
|
|||
599 | QCOMPARE(spy1.count(), 0); |
|
|||
600 | #endif |
|
|||
601 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
602 | } |
|
|||
603 |
|
||||
604 | void tst_QLineSeries::clicked_data() |
|
|||
605 | { |
|
|||
606 | QTest::addColumn<QPointF>("point"); |
|
|||
607 | QTest::newRow("null") << QPointF(); |
|
|||
608 | } |
|
|||
609 |
|
||||
610 | // protected void clicked(QPointF const& point) |
|
|||
611 | void tst_QLineSeries::clicked() |
|
|||
612 | { |
|
|||
613 | #if 0 |
|
|||
614 | QFETCH(QPointF, point); |
|
|||
615 |
|
||||
616 | SubQXYSeries series; |
|
|||
617 |
|
||||
618 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
|||
619 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
620 |
|
||||
621 | series.call_clicked(point); |
|
|||
622 |
|
||||
623 | QCOMPARE(spy0.count(), 0); |
|
|||
624 | QCOMPARE(spy1.count(), 0); |
|
|||
625 | #endif |
|
|||
626 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
627 | } |
|
|||
628 |
|
||||
629 | void tst_QLineSeries::selected_data() |
|
|||
630 | { |
|
|||
631 | QTest::addColumn<int>("foo"); |
|
|||
632 | QTest::newRow("0") << 0; |
|
|||
633 | QTest::newRow("-1") << -1; |
|
|||
634 | } |
|
|||
635 |
|
||||
636 | // protected void selected() |
|
|||
637 | void tst_QLineSeries::selected() |
|
|||
638 | { |
|
|||
639 | #if 0 |
|
|||
640 | QFETCH(int, foo); |
|
|||
641 |
|
||||
642 | SubQXYSeries series; |
|
|||
643 |
|
||||
644 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
|||
645 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
646 |
|
||||
647 | series.call_selected(); |
|
|||
648 |
|
||||
649 | QCOMPARE(spy0.count(), 0); |
|
|||
650 | QCOMPARE(spy1.count(), 0); |
|
|||
651 | #endif |
|
|||
652 | QSKIP("Test is not implemented.", SkipAll); |
|
|||
653 | } |
|
|||
654 |
|
||||
655 | QTEST_MAIN(tst_QLineSeries) |
|
454 | QTEST_MAIN(tst_QLineSeries) | |
656 |
|
455 | |||
657 | #include "tst_qlineseries.moc" |
|
456 | #include "tst_qlineseries.moc" | |
658 |
|
457 |
General Comments 0
You need to be logged in to leave comments.
Login now