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