| 1 | /**************************************************************************** | 
| 2 | ** | 
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | 
| 4 | ** Contact: https://www.qt.io/licensing/ | 
| 5 | ** | 
| 6 | ** This file is part of the Qt Charts module of the Qt Toolkit. | 
| 7 | ** | 
| 8 | ** $QT_BEGIN_LICENSE:GPL$ | 
| 9 | ** Commercial License Usage | 
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | 
| 11 | ** accordance with the commercial license agreement provided with the | 
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | 
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | 
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | 
| 16 | ** | 
| 17 | ** GNU General Public License Usage | 
| 18 | ** Alternatively, this file may be used under the terms of the GNU | 
| 19 | ** General Public License version 3 or (at your option) any later version | 
| 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by | 
| 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 | 
| 22 | ** included in the packaging of this file. Please review the following | 
| 23 | ** information to ensure the GNU General Public License requirements will | 
| 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. | 
| 25 | ** | 
| 26 | ** $QT_END_LICENSE$ | 
| 27 | ** | 
| 28 | ****************************************************************************/ | 
| 29 |  | 
| 30 | #include <QtTest/QtTest> | 
| 31 | #include <QtCharts/QChartView> | 
| 32 | #include <QtCharts/QLineSeries> | 
| 33 | #include <QtCharts/QAreaSeries> | 
| 34 | #include <QtCharts/QScatterSeries> | 
| 35 | #include <QtCharts/QSplineSeries> | 
| 36 | #include <QtCharts/QPieSeries> | 
| 37 | #include <QtCharts/QAbstractBarSeries> | 
| 38 | #include <QtCharts/QBarSeries> | 
| 39 | #include <QtCharts/QPercentBarSeries> | 
| 40 | #include <QtCharts/QStackedBarSeries> | 
| 41 | #include <QtCharts/QValueAxis> | 
| 42 | #include <QtCharts/QBarCategoryAxis> | 
| 43 | #include <QtCharts/QDateTimeAxis> | 
| 44 | #include "tst_definitions.h" | 
| 45 |  | 
| 46 | QT_CHARTS_USE_NAMESPACE | 
| 47 |  | 
| 48 | Q_DECLARE_METATYPE(QAbstractAxis *) | 
| 49 | Q_DECLARE_METATYPE(QValueAxis *) | 
| 50 | Q_DECLARE_METATYPE(QBarCategoryAxis *) | 
| 51 | Q_DECLARE_METATYPE(QAbstractSeries *) | 
| 52 | Q_DECLARE_METATYPE(QChart::AnimationOption) | 
| 53 | Q_DECLARE_METATYPE(QBrush) | 
| 54 | Q_DECLARE_METATYPE(QPen) | 
| 55 | Q_DECLARE_METATYPE(QChart::ChartTheme) | 
| 56 |  | 
| 57 | class tst_QChart : public QObject | 
| 58 | { | 
| 59 |     Q_OBJECT | 
| 60 |  | 
| 61 | public slots: | 
| 62 |     void initTestCase(); | 
| 63 |     void cleanupTestCase(); | 
| 64 |     void init(); | 
| 65 |     void cleanup(); | 
| 66 |  | 
| 67 | private slots: | 
| 68 |     void qchart_data(); | 
| 69 |     void qchart(); | 
| 70 |     void addSeries_data(); | 
| 71 |     void addSeries(); | 
| 72 |     void animationOptions_data(); | 
| 73 |     void animationOptions(); | 
| 74 |     void animationDuration(); | 
| 75 |     void animationCurve_data(); | 
| 76 |     void animationCurve(); | 
| 77 |     void axisX_data(); | 
| 78 |     void axisX(); | 
| 79 |     void axisY_data(); | 
| 80 |     void axisY(); | 
| 81 |     void backgroundBrush_data(); | 
| 82 |     void backgroundBrush(); | 
| 83 |     void backgroundPen_data(); | 
| 84 |     void backgroundPen(); | 
| 85 |     void isBackgroundVisible_data(); | 
| 86 |     void isBackgroundVisible(); | 
| 87 |     void plotAreaBackgroundBrush_data(); | 
| 88 |     void plotAreaBackgroundBrush(); | 
| 89 |     void plotAreaBackgroundPen_data(); | 
| 90 |     void plotAreaBackgroundPen(); | 
| 91 |     void isPlotAreaBackgroundVisible_data(); | 
| 92 |     void isPlotAreaBackgroundVisible(); | 
| 93 |     void legend_data(); | 
| 94 |     void legend(); | 
| 95 |     void plotArea_data(); | 
| 96 |     void plotArea(); | 
| 97 |     void removeAllSeries_data(); | 
| 98 |     void removeAllSeries(); | 
| 99 |     void removeSeries_data(); | 
| 100 |     void removeSeries(); | 
| 101 |     void scroll_right_data(); | 
| 102 |     void scroll_right(); | 
| 103 |     void scroll_left_data(); | 
| 104 |     void scroll_left(); | 
| 105 |     void scroll_up_data(); | 
| 106 |     void scroll_up(); | 
| 107 |     void scroll_down_data(); | 
| 108 |     void scroll_down(); | 
| 109 |     void theme_data(); | 
| 110 |     void theme(); | 
| 111 |     void title_data(); | 
| 112 |     void title(); | 
| 113 |     void titleBrush_data(); | 
| 114 |     void titleBrush(); | 
| 115 |     void titleFont_data(); | 
| 116 |     void titleFont(); | 
| 117 |     void zoomIn_data(); | 
| 118 |     void zoomIn(); | 
| 119 |     void zoomOut_data(); | 
| 120 |     void zoomOut(); | 
| 121 |     void zoomReset(); | 
| 122 |     void createDefaultAxesForLineSeries_data(); | 
| 123 |     void createDefaultAxesForLineSeries(); | 
| 124 |     void axisPolarOrientation(); | 
| 125 |     void backgroundRoundness(); | 
| 126 |     void zoomInAndOut_data(); | 
| 127 |     void zoomInAndOut(); | 
| 128 |     void fixedPlotArea(); | 
| 129 | private: | 
| 130 |     void createTestData(); | 
| 131 |  | 
| 132 | private: | 
| 133 |     QChartView* m_view; | 
| 134 |     QChart* m_chart; | 
| 135 | }; | 
| 136 |  | 
| 137 | void tst_QChart::initTestCase() | 
| 138 | { | 
| 139 |  | 
| 140 | } | 
| 141 |  | 
| 142 | void tst_QChart::cleanupTestCase() | 
| 143 | { | 
| 144 |     QTest::qWait(ms: 1); // Allow final deleteLaters to run | 
| 145 | } | 
| 146 |  | 
| 147 | void tst_QChart::init() | 
| 148 | { | 
| 149 |     m_view = new QChartView(newQChartOrQPolarChart()); | 
| 150 |     m_view->resize(w: 200, h: 200); | 
| 151 |     m_chart = m_view->chart(); | 
| 152 | } | 
| 153 |  | 
| 154 | void tst_QChart::cleanup() | 
| 155 | { | 
| 156 |     delete m_view; | 
| 157 |     m_view = 0; | 
| 158 |     m_chart = 0; | 
| 159 | } | 
| 160 |  | 
| 161 |  | 
| 162 | void tst_QChart::createTestData() | 
| 163 | { | 
| 164 |      QLineSeries* series0 = new QLineSeries(this); | 
| 165 |      *series0 << QPointF(0, 0) << QPointF(100, 100); | 
| 166 |      m_chart->addSeries(series: series0); | 
| 167 |      m_view->show(); | 
| 168 |      QVERIFY(QTest::qWaitForWindowExposed(m_view)); | 
| 169 | } | 
| 170 |  | 
| 171 | void tst_QChart::qchart_data() | 
| 172 | { | 
| 173 | } | 
| 174 |  | 
| 175 | void tst_QChart::qchart() | 
| 176 | { | 
| 177 |     QVERIFY(m_chart); | 
| 178 |     QVERIFY(m_chart->legend()); | 
| 179 |     QVERIFY(m_chart->legend()->isVisible()); | 
| 180 |  | 
| 181 |     QCOMPARE(m_chart->animationOptions(), QChart::NoAnimation); | 
| 182 |     QCOMPARE(m_chart->animationDuration(), 1000); | 
| 183 |     QCOMPARE(m_chart->animationEasingCurve(), QEasingCurve(QEasingCurve::OutQuart)); | 
| 184 |     QVERIFY(m_chart->axes(Qt::Horizontal).isEmpty()); | 
| 185 |     QVERIFY(m_chart->axes(Qt::Vertical).isEmpty()); | 
| 186 |     QVERIFY(m_chart->backgroundBrush()!=QBrush()); | 
| 187 |     QVERIFY(m_chart->backgroundPen()!=QPen()); | 
| 188 |     QCOMPARE(m_chart->isBackgroundVisible(), true); | 
| 189 |     QVERIFY(m_chart->plotArea().top()==0); | 
| 190 |     QVERIFY(m_chart->plotArea().left()==0); | 
| 191 |     QVERIFY(m_chart->plotArea().right()==0); | 
| 192 |     QVERIFY(m_chart->plotArea().bottom()==0); | 
| 193 |     QCOMPARE(m_chart->theme(), QChart::ChartThemeLight); | 
| 194 |     QCOMPARE(m_chart->title(), QString()); | 
| 195 |  | 
| 196 |     //QCOMPARE(m_chart->titleBrush(),QBrush()); | 
| 197 |     //QCOMPARE(m_chart->titleFont(),QFont()); | 
| 198 |  | 
| 199 |     m_chart->removeAllSeries(); | 
| 200 |     m_chart->scroll(dx: 0,dy: 0); | 
| 201 |  | 
| 202 |     m_chart->zoomIn(); | 
| 203 |     m_chart->zoomIn(rect: QRectF()); | 
| 204 |     m_chart->zoomOut(); | 
| 205 |  | 
| 206 |     m_view->show(); | 
| 207 |  | 
| 208 |     QVERIFY(m_chart->plotArea().top()>0); | 
| 209 |     QVERIFY(m_chart->plotArea().left()>0); | 
| 210 |     QVERIFY(m_chart->plotArea().right()>0); | 
| 211 |     QVERIFY(m_chart->plotArea().bottom()>0); | 
| 212 | } | 
| 213 |  | 
| 214 | void tst_QChart::addSeries_data() | 
| 215 | { | 
| 216 |     QTest::addColumn<QAbstractSeries *>(name: "series" ); | 
| 217 |  | 
| 218 |     QAbstractSeries* line = new QLineSeries(this); | 
| 219 |     QAbstractSeries* area = new QAreaSeries(new QLineSeries(this)); | 
| 220 |     QAbstractSeries* scatter = new QScatterSeries(this); | 
| 221 |     QAbstractSeries* spline = new QSplineSeries(this); | 
| 222 |  | 
| 223 |     QTest::newRow(dataTag: "lineSeries" ) << line; | 
| 224 |     QTest::newRow(dataTag: "areaSeries" ) << area; | 
| 225 |     QTest::newRow(dataTag: "scatterSeries" ) << scatter; | 
| 226 |     QTest::newRow(dataTag: "splineSeries" ) << spline; | 
| 227 |  | 
| 228 |     if (!isPolarTest()) { | 
| 229 |         QAbstractSeries* pie = new QPieSeries(this); | 
| 230 |         QAbstractSeries* bar = new QBarSeries(this); | 
| 231 |         QAbstractSeries* percent = new QPercentBarSeries(this); | 
| 232 |         QAbstractSeries* stacked = new QStackedBarSeries(this); | 
| 233 |         QTest::newRow(dataTag: "pieSeries" ) << pie; | 
| 234 |         QTest::newRow(dataTag: "barSeries" ) << bar; | 
| 235 |         QTest::newRow(dataTag: "percentBarSeries" ) << percent; | 
| 236 |         QTest::newRow(dataTag: "stackedBarSeries" ) << stacked; | 
| 237 |     } | 
| 238 | } | 
| 239 |  | 
| 240 | void tst_QChart::addSeries() | 
| 241 | { | 
| 242 |     QFETCH(QAbstractSeries *, series); | 
| 243 |     m_view->show(); | 
| 244 |     QVERIFY(QTest::qWaitForWindowExposed(m_view)); | 
| 245 |     QVERIFY(!series->chart()); | 
| 246 |     QCOMPARE(m_chart->series().count(), 0); | 
| 247 |     m_chart->addSeries(series); | 
| 248 |     QCOMPARE(m_chart->series().count(), 1); | 
| 249 |     QCOMPARE(m_chart->series().first(), series); | 
| 250 |     QVERIFY(series->chart() == m_chart); | 
| 251 |     m_chart->createDefaultAxes(); | 
| 252 |     if(series->type()!=QAbstractSeries::SeriesTypePie){ | 
| 253 |         QVERIFY(!m_chart->axes(Qt::Vertical, series).isEmpty()); | 
| 254 |         QVERIFY(!m_chart->axes(Qt::Horizontal, series).isEmpty()); | 
| 255 |     }else{ | 
| 256 |         QVERIFY(m_chart->axes(Qt::Vertical, series).isEmpty()); | 
| 257 |         QVERIFY(m_chart->axes(Qt::Horizontal, series).isEmpty()); | 
| 258 |     } | 
| 259 |     m_chart->removeSeries(series); | 
| 260 |     QVERIFY(!series->chart()); | 
| 261 |     QCOMPARE(m_chart->series().count(), 0); | 
| 262 |     delete series; | 
| 263 | } | 
| 264 |  | 
| 265 | void tst_QChart::animationOptions_data() | 
| 266 | { | 
| 267 |     QTest::addColumn<QChart::AnimationOption>(name: "animationOptions" ); | 
| 268 |     QTest::newRow(dataTag: "AllAnimations" ) << QChart::AllAnimations; | 
| 269 |     QTest::newRow(dataTag: "NoAnimation" ) << QChart::NoAnimation; | 
| 270 |     QTest::newRow(dataTag: "GridAxisAnimations" ) << QChart::GridAxisAnimations; | 
| 271 |     QTest::newRow(dataTag: "SeriesAnimations" ) << QChart::SeriesAnimations; | 
| 272 | } | 
| 273 |  | 
| 274 | void tst_QChart::animationOptions() | 
| 275 | { | 
| 276 |     createTestData(); | 
| 277 |     QFETCH(QChart::AnimationOption, animationOptions); | 
| 278 |     m_chart->setAnimationOptions(animationOptions); | 
| 279 |     QCOMPARE(m_chart->animationOptions(), animationOptions); | 
| 280 | } | 
| 281 |  | 
| 282 | void tst_QChart::animationDuration() | 
| 283 | { | 
| 284 |     createTestData(); | 
| 285 |     m_chart->setAnimationDuration(2000); | 
| 286 |     QVERIFY(m_chart->animationDuration() == 2000); | 
| 287 | } | 
| 288 |  | 
| 289 | void tst_QChart::animationCurve_data() | 
| 290 | { | 
| 291 |     QTest::addColumn<QEasingCurve>(name: "animationCurve" ); | 
| 292 |     QTest::newRow(dataTag: "Linear" ) << QEasingCurve(QEasingCurve::Linear); | 
| 293 |     QTest::newRow(dataTag: "InCubic" ) << QEasingCurve(QEasingCurve::InCubic); | 
| 294 |     QTest::newRow(dataTag: "OutSine" ) << QEasingCurve(QEasingCurve::OutSine); | 
| 295 |     QTest::newRow(dataTag: "OutInBack" ) << QEasingCurve(QEasingCurve::OutInBack); | 
| 296 | } | 
| 297 |  | 
| 298 | void tst_QChart::animationCurve() | 
| 299 | { | 
| 300 |     createTestData(); | 
| 301 |     QFETCH(QEasingCurve, animationCurve); | 
| 302 |     m_chart->setAnimationEasingCurve(animationCurve); | 
| 303 |     QCOMPARE(m_chart->animationEasingCurve(), animationCurve); | 
| 304 | } | 
| 305 |  | 
| 306 | void tst_QChart::axisX_data() | 
| 307 | { | 
| 308 |  | 
| 309 |     QTest::addColumn<QAbstractAxis*>(name: "axis" ); | 
| 310 |     QTest::addColumn<QAbstractSeries *>(name: "series" ); | 
| 311 |  | 
| 312 |     QTest::newRow(dataTag: "categories,lineSeries" ) <<  (QAbstractAxis*) new QBarCategoryAxis() << (QAbstractSeries*) new QLineSeries(this); | 
| 313 |     QTest::newRow(dataTag: "categories,areaSeries" ) <<  (QAbstractAxis*) new QBarCategoryAxis() << (QAbstractSeries*) new QAreaSeries(new QLineSeries(this)); | 
| 314 |     QTest::newRow(dataTag: "categories,scatterSeries" ) <<  (QAbstractAxis*) new QBarCategoryAxis() << (QAbstractSeries*) new QScatterSeries(this); | 
| 315 |     QTest::newRow(dataTag: "categories,splineSeries" ) <<  (QAbstractAxis*) new QBarCategoryAxis() << (QAbstractSeries*) new QSplineSeries(this); | 
| 316 |     if (!isPolarTest()) { | 
| 317 |         QTest::newRow(dataTag: "categories,pieSeries" ) <<  (QAbstractAxis*) new QBarCategoryAxis() << (QAbstractSeries*) new QPieSeries(this); | 
| 318 |         QTest::newRow(dataTag: "categories,barSeries" ) <<  (QAbstractAxis*) new QBarCategoryAxis() << (QAbstractSeries*) new QBarSeries(this); | 
| 319 |         QTest::newRow(dataTag: "categories,percentBarSeries" ) <<  (QAbstractAxis*) new QBarCategoryAxis() << (QAbstractSeries*) new QPercentBarSeries(this); | 
| 320 |         QTest::newRow(dataTag: "categories,stackedBarSeries" ) <<  (QAbstractAxis*) new QBarCategoryAxis() << (QAbstractSeries*) new QStackedBarSeries(this); | 
| 321 |     } | 
| 322 |  | 
| 323 |     QTest::newRow(dataTag: "value,lineSeries" ) << (QAbstractAxis*) new QValueAxis() << (QAbstractSeries*) new QLineSeries(this); | 
| 324 |     QTest::newRow(dataTag: "value,areaSeries" ) << (QAbstractAxis*) new QValueAxis() << (QAbstractSeries*) new QAreaSeries(new QLineSeries(this)); | 
| 325 |     QTest::newRow(dataTag: "value,scatterSeries" ) << (QAbstractAxis*) new QValueAxis() << (QAbstractSeries*) new QScatterSeries(this); | 
| 326 |     QTest::newRow(dataTag: "value,splineSeries" ) << (QAbstractAxis*) new QValueAxis() <<  (QAbstractSeries*) new QSplineSeries(this); | 
| 327 |     if (!isPolarTest()) { | 
| 328 |         QTest::newRow(dataTag: "value,pieSeries" ) << (QAbstractAxis*) new QValueAxis() << (QAbstractSeries*) new QPieSeries(this); | 
| 329 |         QTest::newRow(dataTag: "value,barSeries" ) << (QAbstractAxis*) new QValueAxis() <<   (QAbstractSeries*) new QBarSeries(this); | 
| 330 |         QTest::newRow(dataTag: "value,percentBarSeries" ) << (QAbstractAxis*) new QValueAxis() << (QAbstractSeries*) new QPercentBarSeries(this); | 
| 331 |         QTest::newRow(dataTag: "value,stackedBarSeries" ) << (QAbstractAxis*) new QValueAxis() << (QAbstractSeries*) new QStackedBarSeries(this); | 
| 332 |     } | 
| 333 | } | 
| 334 |  | 
| 335 | void tst_QChart::axisX() | 
| 336 | { | 
| 337 |     QFETCH(QAbstractAxis*, axis); | 
| 338 |     QFETCH(QAbstractSeries*, series); | 
| 339 |     QVERIFY(m_chart->axes(Qt::Horizontal).isEmpty()); | 
| 340 |     m_view->show(); | 
| 341 |     QVERIFY(QTest::qWaitForWindowExposed(m_view)); | 
| 342 |     m_chart->addSeries(series); | 
| 343 |     m_chart->addAxis(axis, alignment: Qt::AlignBottom); | 
| 344 |     series->attachAxis(axis); | 
| 345 |     QCOMPARE(m_chart->axes(Qt::Horizontal, series).value(0), axis); | 
| 346 | } | 
| 347 |  | 
| 348 | void tst_QChart::axisY_data() | 
| 349 | { | 
| 350 |     axisX_data(); | 
| 351 | } | 
| 352 |  | 
| 353 |  | 
| 354 | void tst_QChart::axisY() | 
| 355 | { | 
| 356 |     QFETCH(QAbstractAxis*, axis); | 
| 357 |     QFETCH(QAbstractSeries*, series); | 
| 358 |     QVERIFY(m_chart->axes(Qt::Vertical).isEmpty()); | 
| 359 |     m_view->show(); | 
| 360 |     QVERIFY(QTest::qWaitForWindowExposed(m_view)); | 
| 361 |     m_chart->addSeries(series); | 
| 362 |     m_chart->addAxis(axis, alignment: Qt::AlignLeft); | 
| 363 |     series->attachAxis(axis); | 
| 364 |     QCOMPARE(m_chart->axes(Qt::Vertical, series).value(0), axis); | 
| 365 | } | 
| 366 |  | 
| 367 | void tst_QChart::backgroundBrush_data() | 
| 368 | { | 
| 369 |     QTest::addColumn<QBrush>(name: "backgroundBrush" ); | 
| 370 |     QTest::newRow(dataTag: "null" ) << QBrush(); | 
| 371 |     QTest::newRow(dataTag: "blue" ) << QBrush(Qt::blue); | 
| 372 |     QTest::newRow(dataTag: "white" ) << QBrush(Qt::white); | 
| 373 |     QTest::newRow(dataTag: "black" ) << QBrush(Qt::black); | 
| 374 | } | 
| 375 |  | 
| 376 | void tst_QChart::backgroundBrush() | 
| 377 | { | 
| 378 |     QFETCH(QBrush, backgroundBrush); | 
| 379 |     m_chart->setBackgroundBrush(backgroundBrush); | 
| 380 |     QCOMPARE(m_chart->backgroundBrush(), backgroundBrush); | 
| 381 | } | 
| 382 |  | 
| 383 | void tst_QChart::backgroundPen_data() | 
| 384 | { | 
| 385 |     QTest::addColumn<QPen>(name: "backgroundPen" ); | 
| 386 |     QTest::newRow(dataTag: "null" ) << QPen(); | 
| 387 |     QTest::newRow(dataTag: "blue" ) << QPen(Qt::blue); | 
| 388 |     QTest::newRow(dataTag: "white" ) << QPen(Qt::white); | 
| 389 |     QTest::newRow(dataTag: "black" ) << QPen(Qt::black); | 
| 390 | } | 
| 391 |  | 
| 392 |  | 
| 393 | void tst_QChart::backgroundPen() | 
| 394 | { | 
| 395 |     QFETCH(QPen, backgroundPen); | 
| 396 |     m_chart->setBackgroundPen(backgroundPen); | 
| 397 |     QCOMPARE(m_chart->backgroundPen(), backgroundPen); | 
| 398 | } | 
| 399 |  | 
| 400 | void tst_QChart::isBackgroundVisible_data() | 
| 401 | { | 
| 402 |     QTest::addColumn<bool>(name: "isBackgroundVisible" ); | 
| 403 |     QTest::newRow(dataTag: "true" ) << true; | 
| 404 |     QTest::newRow(dataTag: "false" ) << false; | 
| 405 | } | 
| 406 |  | 
| 407 | void tst_QChart::isBackgroundVisible() | 
| 408 | { | 
| 409 |     QFETCH(bool, isBackgroundVisible); | 
| 410 |     m_chart->setBackgroundVisible(isBackgroundVisible); | 
| 411 |     QCOMPARE(m_chart->isBackgroundVisible(), isBackgroundVisible); | 
| 412 | } | 
| 413 |  | 
| 414 | void tst_QChart::plotAreaBackgroundBrush_data() | 
| 415 | { | 
| 416 |     QTest::addColumn<QBrush>(name: "plotAreaBackgroundBrush" ); | 
| 417 |     QTest::newRow(dataTag: "null" ) << QBrush(); | 
| 418 |     QTest::newRow(dataTag: "blue" ) << QBrush(Qt::blue); | 
| 419 |     QTest::newRow(dataTag: "white" ) << QBrush(Qt::white); | 
| 420 |     QTest::newRow(dataTag: "black" ) << QBrush(Qt::black); | 
| 421 | } | 
| 422 |  | 
| 423 | void tst_QChart::plotAreaBackgroundBrush() | 
| 424 | { | 
| 425 |     QFETCH(QBrush, plotAreaBackgroundBrush); | 
| 426 |     m_chart->setPlotAreaBackgroundBrush(plotAreaBackgroundBrush); | 
| 427 |     QCOMPARE(m_chart->plotAreaBackgroundBrush(), plotAreaBackgroundBrush); | 
| 428 | } | 
| 429 |  | 
| 430 | void tst_QChart::plotAreaBackgroundPen_data() | 
| 431 | { | 
| 432 |     QTest::addColumn<QPen>(name: "plotAreaBackgroundPen" ); | 
| 433 |     QTest::newRow(dataTag: "null" ) << QPen(); | 
| 434 |     QTest::newRow(dataTag: "blue" ) << QPen(Qt::blue); | 
| 435 |     QTest::newRow(dataTag: "white" ) << QPen(Qt::white); | 
| 436 |     QTest::newRow(dataTag: "black" ) << QPen(Qt::black); | 
| 437 | } | 
| 438 |  | 
| 439 |  | 
| 440 | void tst_QChart::plotAreaBackgroundPen() | 
| 441 | { | 
| 442 |     QFETCH(QPen, plotAreaBackgroundPen); | 
| 443 |     m_chart->setPlotAreaBackgroundPen(plotAreaBackgroundPen); | 
| 444 |     QCOMPARE(m_chart->plotAreaBackgroundPen(), plotAreaBackgroundPen); | 
| 445 | } | 
| 446 |  | 
| 447 | void tst_QChart::isPlotAreaBackgroundVisible_data() | 
| 448 | { | 
| 449 |     QTest::addColumn<bool>(name: "isPlotAreaBackgroundVisible" ); | 
| 450 |     QTest::newRow(dataTag: "true" ) << true; | 
| 451 |     QTest::newRow(dataTag: "false" ) << false; | 
| 452 | } | 
| 453 |  | 
| 454 | void tst_QChart::isPlotAreaBackgroundVisible() | 
| 455 | { | 
| 456 |     QFETCH(bool, isPlotAreaBackgroundVisible); | 
| 457 |     m_chart->setPlotAreaBackgroundVisible(isPlotAreaBackgroundVisible); | 
| 458 |     QCOMPARE(m_chart->isPlotAreaBackgroundVisible(), isPlotAreaBackgroundVisible); | 
| 459 | } | 
| 460 | void tst_QChart::legend_data() | 
| 461 | { | 
| 462 |  | 
| 463 | } | 
| 464 |  | 
| 465 | void tst_QChart::legend() | 
| 466 | { | 
| 467 |     QLegend *legend = m_chart->legend(); | 
| 468 |     QVERIFY(legend); | 
| 469 |     QVERIFY(!m_chart->legend()->reverseMarkers()); | 
| 470 |  | 
| 471 |     // Colors related signals | 
| 472 |     QSignalSpy colorSpy(legend, SIGNAL(colorChanged(QColor))); | 
| 473 |     QSignalSpy borderColorSpy(legend, SIGNAL(borderColorChanged(QColor))); | 
| 474 |     QSignalSpy labelColorSpy(legend, SIGNAL(labelColorChanged(QColor))); | 
| 475 |  | 
| 476 |     // colorChanged | 
| 477 |     legend->setColor(QColor("aliceblue" )); | 
| 478 |     QCOMPARE(colorSpy.count(), 1); | 
| 479 |     QBrush b = legend->brush(); | 
| 480 |     b.setColor(QColor("aqua" )); | 
| 481 |     legend->setBrush(b); | 
| 482 |     QCOMPARE(colorSpy.count(), 2); | 
| 483 |  | 
| 484 |     // borderColorChanged | 
| 485 |     legend->setBorderColor(QColor("aliceblue" )); | 
| 486 |     QCOMPARE(borderColorSpy.count(), 1); | 
| 487 |     QPen p = legend->pen(); | 
| 488 |     p.setColor(QColor("aqua" )); | 
| 489 |     legend->setPen(p); | 
| 490 |     QCOMPARE(borderColorSpy.count(), 2); | 
| 491 |  | 
| 492 |     // labelColorChanged | 
| 493 |     legend->setLabelColor(QColor("lightsalmon" )); | 
| 494 |     QCOMPARE(labelColorSpy.count(), 1); | 
| 495 |     b = legend->labelBrush(); | 
| 496 |     b.setColor(QColor("lightseagreen" )); | 
| 497 |     legend->setLabelBrush(b); | 
| 498 |     QCOMPARE(labelColorSpy.count(), 2); | 
| 499 |  | 
| 500 |     // fontChanged | 
| 501 |     QSignalSpy fontSpy(legend, SIGNAL(fontChanged(QFont))); | 
| 502 |     QFont f = legend->font(); | 
| 503 |     f.setBold(!f.bold()); | 
| 504 |     legend->setFont(f); | 
| 505 |     QCOMPARE(fontSpy.count(), 1); | 
| 506 |  | 
| 507 |     // reverseMarkersChanged | 
| 508 |     QSignalSpy (legend, SIGNAL(reverseMarkersChanged(bool))); | 
| 509 |     QCOMPARE(reverseMarkersSpy.count(), 0); | 
| 510 |     legend->setReverseMarkers(); | 
| 511 |     QCOMPARE(reverseMarkersSpy.count(), 1); | 
| 512 |     QVERIFY(legend->reverseMarkers()); | 
| 513 | } | 
| 514 |  | 
| 515 | void tst_QChart::plotArea_data() | 
| 516 | { | 
| 517 |  | 
| 518 | } | 
| 519 |  | 
| 520 | void tst_QChart::plotArea() | 
| 521 | { | 
| 522 |     createTestData(); | 
| 523 |     QRectF rect = m_chart->geometry(); | 
| 524 |     QVERIFY(m_chart->plotArea().isValid()); | 
| 525 |     QVERIFY(m_chart->plotArea().height() < rect.height()); | 
| 526 |     QVERIFY(m_chart->plotArea().width() < rect.width()); | 
| 527 | } | 
| 528 |  | 
| 529 | void tst_QChart::removeAllSeries_data() | 
| 530 | { | 
| 531 |  | 
| 532 | } | 
| 533 |  | 
| 534 | void tst_QChart::removeAllSeries() | 
| 535 | { | 
| 536 |     QLineSeries* series0 = new QLineSeries(this); | 
| 537 |     QLineSeries* series1 = new QLineSeries(this); | 
| 538 |     QLineSeries* series2 = new QLineSeries(this); | 
| 539 |     QSignalSpy deleteSpy1(series0, SIGNAL(destroyed())); | 
| 540 |     QSignalSpy deleteSpy2(series1, SIGNAL(destroyed())); | 
| 541 |     QSignalSpy deleteSpy3(series2, SIGNAL(destroyed())); | 
| 542 |  | 
| 543 |     m_chart->addSeries(series: series0); | 
| 544 |     m_chart->addSeries(series: series1); | 
| 545 |     m_chart->addSeries(series: series2); | 
| 546 |     m_view->show(); | 
| 547 |     QVERIFY(QTest::qWaitForWindowExposed(m_view)); | 
| 548 |     m_chart->createDefaultAxes(); | 
| 549 |     QCOMPARE(m_chart->axes().count(), 2); | 
| 550 |     QVERIFY(!m_chart->axes(Qt::Vertical, series0).isEmpty()); | 
| 551 |     QVERIFY(!m_chart->axes(Qt::Vertical, series1).isEmpty()); | 
| 552 |     QVERIFY(!m_chart->axes(Qt::Vertical, series2).isEmpty()); | 
| 553 |  | 
| 554 |     m_chart->removeAllSeries(); | 
| 555 |     QCOMPARE(m_chart->axes().count(), 2); | 
| 556 |     QVERIFY(!m_chart->axes(Qt::Horizontal).isEmpty()); | 
| 557 |     QVERIFY(!m_chart->axes(Qt::Vertical).isEmpty()); | 
| 558 |     QCOMPARE(deleteSpy1.count(), 1); | 
| 559 |     QCOMPARE(deleteSpy2.count(), 1); | 
| 560 |     QCOMPARE(deleteSpy3.count(), 1); | 
| 561 | } | 
| 562 |  | 
| 563 | void tst_QChart::removeSeries_data() | 
| 564 | { | 
| 565 |     axisX_data(); | 
| 566 | } | 
| 567 |  | 
| 568 | void tst_QChart::removeSeries() | 
| 569 | { | 
| 570 |     QFETCH(QAbstractAxis *, axis); | 
| 571 |     QFETCH(QAbstractSeries *, series); | 
| 572 |     QSignalSpy deleteSpy(series, SIGNAL(destroyed())); | 
| 573 |     m_view->show(); | 
| 574 |     QVERIFY(QTest::qWaitForWindowExposed(m_view)); | 
| 575 |     if (!axis) | 
| 576 |         axis = m_chart->axes(orientation: Qt::Vertical).value(i: 0); | 
| 577 |     QVERIFY(axis); | 
| 578 |     m_chart->addSeries(series); | 
| 579 |     m_chart->addAxis(axis, alignment: Qt::AlignLeft); | 
| 580 |     series->attachAxis(axis); | 
| 581 |     QCOMPARE(m_chart->axes(Qt::Vertical, series).value(0), axis); | 
| 582 |     m_chart->removeSeries(series); | 
| 583 |     QCOMPARE(m_chart->axes().count(), 1); | 
| 584 |     QVERIFY(!m_chart->axes(Qt::Vertical).isEmpty()); | 
| 585 |     QVERIFY(m_chart->axes(Qt::Vertical, series).isEmpty()); | 
| 586 |     QCOMPARE(deleteSpy.count(), 0); | 
| 587 |     delete series; | 
| 588 | } | 
| 589 |  | 
| 590 | void tst_QChart::scroll_right_data() | 
| 591 | { | 
| 592 |      QTest::addColumn<QAbstractSeries *>(name: "series" ); | 
| 593 |  | 
| 594 |      QLineSeries* series0 = new QLineSeries(this); | 
| 595 |      *series0 << QPointF(0, 0) << QPointF(100, 100); | 
| 596 |  | 
| 597 |      QTest::newRow(dataTag: "lineSeries" ) << (QAbstractSeries*) series0; | 
| 598 |  | 
| 599 |  | 
| 600 | } | 
| 601 |  | 
| 602 | void tst_QChart::scroll_right() | 
| 603 | { | 
| 604 |     QFETCH(QAbstractSeries *, series); | 
| 605 |     m_chart->addSeries(series); | 
| 606 |     m_chart->createDefaultAxes(); | 
| 607 |     m_view->show(); | 
| 608 |     QVERIFY(QTest::qWaitForWindowExposed(m_view)); | 
| 609 |     QAbstractAxis *axis = m_chart->axes(orientation: Qt::Horizontal).value(i: 0); | 
| 610 |     QVERIFY(axis); | 
| 611 |  | 
| 612 |     switch(axis->type()) | 
| 613 |     { | 
| 614 |         case QAbstractAxis::AxisTypeValue:{ | 
| 615 |             QValueAxis* vaxis = qobject_cast<QValueAxis*>(object: axis); | 
| 616 |             QVERIFY(vaxis!=0); | 
| 617 |             qreal min = vaxis->min(); | 
| 618 |             qreal max = vaxis->max(); | 
| 619 |             QVERIFY(max>min); | 
| 620 |             m_chart->scroll(dx: 50, dy: 0); | 
| 621 |             QVERIFY(min<vaxis->min()); | 
| 622 |             QVERIFY(max<vaxis->max()); | 
| 623 |             break; | 
| 624 |         } | 
| 625 |         case QAbstractAxis::AxisTypeBarCategory:{ | 
| 626 |             QBarCategoryAxis* caxis = qobject_cast<QBarCategoryAxis*>(object: axis); | 
| 627 |             QVERIFY(caxis!=0); | 
| 628 |             qreal min = caxis->min().toDouble(); | 
| 629 |             qreal max = caxis->max().toDouble(); | 
| 630 |             m_chart->scroll(dx: 50, dy: 0); | 
| 631 |             QVERIFY(min<caxis->min().toDouble()); | 
| 632 |             QVERIFY(max<caxis->max().toDouble()); | 
| 633 |             break; | 
| 634 |         } | 
| 635 |         default: | 
| 636 |             qFatal(msg: "Unsupported type" ); | 
| 637 |             break; | 
| 638 |     } | 
| 639 | } | 
| 640 |  | 
| 641 | void tst_QChart::scroll_left_data() | 
| 642 | { | 
| 643 |     scroll_right_data(); | 
| 644 | } | 
| 645 |  | 
| 646 | void tst_QChart::scroll_left() | 
| 647 | { | 
| 648 |      QFETCH(QAbstractSeries *, series); | 
| 649 |      m_chart->addSeries(series); | 
| 650 |      m_chart->createDefaultAxes(); | 
| 651 |      m_view->show(); | 
| 652 |      QVERIFY(QTest::qWaitForWindowExposed(m_view)); | 
| 653 |      QAbstractAxis *axis = m_chart->axes(orientation: Qt::Horizontal).value(i: 0); | 
| 654 |      QVERIFY(axis); | 
| 655 |  | 
| 656 |      switch(axis->type()) | 
| 657 |         { | 
| 658 |             case QAbstractAxis::AxisTypeValue:{ | 
| 659 |                 QValueAxis* vaxis = qobject_cast<QValueAxis*>(object: axis); | 
| 660 |                 QVERIFY(vaxis!=0); | 
| 661 |                 qreal min = vaxis->min(); | 
| 662 |                 qreal max = vaxis->max(); | 
| 663 |                 m_chart->scroll(dx: -50, dy: 0); | 
| 664 |                 QVERIFY(min>vaxis->min()); | 
| 665 |                 QVERIFY(max>vaxis->max()); | 
| 666 |                 break; | 
| 667 |             } | 
| 668 |             case QAbstractAxis::AxisTypeBarCategory:{ | 
| 669 |                 QBarCategoryAxis* caxis = qobject_cast<QBarCategoryAxis*>(object: axis); | 
| 670 |                 QVERIFY(caxis!=0); | 
| 671 |                 qreal min = caxis->min().toDouble(); | 
| 672 |                 qreal max = caxis->max().toDouble(); | 
| 673 |                 m_chart->scroll(dx: -50, dy: 0); | 
| 674 |                 QVERIFY(min>caxis->min().toDouble()); | 
| 675 |                 QVERIFY(max>caxis->max().toDouble()); | 
| 676 |                 break; | 
| 677 |             } | 
| 678 |             default: | 
| 679 |                 qFatal(msg: "Unsupported type" ); | 
| 680 |                 break; | 
| 681 |         } | 
| 682 | } | 
| 683 |  | 
| 684 | void tst_QChart::scroll_up_data() | 
| 685 | { | 
| 686 |     scroll_right_data(); | 
| 687 | } | 
| 688 |  | 
| 689 | void tst_QChart::scroll_up() | 
| 690 | { | 
| 691 |     QFETCH(QAbstractSeries *, series); | 
| 692 |     m_chart->addSeries(series); | 
| 693 |     m_chart->createDefaultAxes(); | 
| 694 |     m_view->show(); | 
| 695 |     QVERIFY(QTest::qWaitForWindowExposed(m_view)); | 
| 696 |     QAbstractAxis *axis = m_chart->axes(orientation: Qt::Vertical).value(i: 0); | 
| 697 |     QVERIFY(axis); | 
| 698 |  | 
| 699 |     switch(axis->type()) | 
| 700 |     { | 
| 701 |         case QAbstractAxis::AxisTypeValue:{ | 
| 702 |             QValueAxis* vaxis = qobject_cast<QValueAxis*>(object: axis); | 
| 703 |             QVERIFY(vaxis!=0); | 
| 704 |             qreal min = vaxis->min(); | 
| 705 |             qreal max = vaxis->max(); | 
| 706 |             m_chart->scroll(dx: 0, dy: 50); | 
| 707 |             QVERIFY(min<vaxis->min()); | 
| 708 |             QVERIFY(max<vaxis->max()); | 
| 709 |             break; | 
| 710 |         } | 
| 711 |         case QAbstractAxis::AxisTypeBarCategory:{ | 
| 712 |             QBarCategoryAxis* caxis = qobject_cast<QBarCategoryAxis*>(object: axis); | 
| 713 |             QVERIFY(caxis!=0); | 
| 714 |             qreal min = caxis->min().toDouble(); | 
| 715 |             qreal max = caxis->max().toDouble(); | 
| 716 |             m_chart->scroll(dx: 0, dy: 50); | 
| 717 |             QVERIFY(min<caxis->min().toDouble()); | 
| 718 |             QVERIFY(max<caxis->max().toDouble()); | 
| 719 |             break; | 
| 720 |         } | 
| 721 |         default: | 
| 722 |             qFatal(msg: "Unsupported type" ); | 
| 723 |             break; | 
| 724 |     } | 
| 725 | } | 
| 726 |  | 
| 727 | void tst_QChart::scroll_down_data() | 
| 728 | { | 
| 729 |     scroll_right_data(); | 
| 730 | } | 
| 731 |  | 
| 732 | void tst_QChart::scroll_down() | 
| 733 | { | 
| 734 |      QFETCH(QAbstractSeries *, series); | 
| 735 |      m_chart->addSeries(series); | 
| 736 |      m_chart->createDefaultAxes(); | 
| 737 |      m_view->show(); | 
| 738 |      QVERIFY(QTest::qWaitForWindowExposed(m_view)); | 
| 739 |      QAbstractAxis *axis = m_chart->axes(orientation: Qt::Vertical).value(i: 0); | 
| 740 |      QVERIFY(axis); | 
| 741 |  | 
| 742 |      switch(axis->type()) | 
| 743 |         { | 
| 744 |             case QAbstractAxis::AxisTypeValue:{ | 
| 745 |                 QValueAxis* vaxis = qobject_cast<QValueAxis*>(object: axis); | 
| 746 |                 QVERIFY(vaxis!=0); | 
| 747 |                 qreal min = vaxis->min(); | 
| 748 |                 qreal max = vaxis->max(); | 
| 749 |                 m_chart->scroll(dx: 0, dy: -50); | 
| 750 |                 QVERIFY(min>vaxis->min()); | 
| 751 |                 QVERIFY(max>vaxis->max()); | 
| 752 |                 break; | 
| 753 |             } | 
| 754 |             case QAbstractAxis::AxisTypeBarCategory:{ | 
| 755 |                 QBarCategoryAxis* caxis = qobject_cast<QBarCategoryAxis*>(object: axis); | 
| 756 |                 QVERIFY(caxis!=0); | 
| 757 |                 qreal min = caxis->min().toDouble(); | 
| 758 |                 qreal max = caxis->max().toDouble(); | 
| 759 |                 m_chart->scroll(dx: 0, dy: -50); | 
| 760 |                 QVERIFY(min>caxis->min().toDouble()); | 
| 761 |                 QVERIFY(max>caxis->max().toDouble()); | 
| 762 |                 break; | 
| 763 |             } | 
| 764 |             default: | 
| 765 |                 qFatal(msg: "Unsupported type" ); | 
| 766 |                 break; | 
| 767 |         } | 
| 768 | } | 
| 769 |  | 
| 770 | void tst_QChart::theme_data() | 
| 771 | { | 
| 772 |     QTest::addColumn<QChart::ChartTheme>(name: "theme" ); | 
| 773 |     QTest::newRow(dataTag: "ChartThemeBlueCerulean" ) << QChart::ChartThemeBlueCerulean; | 
| 774 |     QTest::newRow(dataTag: "ChartThemeBlueIcy" ) << QChart::ChartThemeBlueIcy; | 
| 775 |     QTest::newRow(dataTag: "ChartThemeBlueNcs" ) << QChart::ChartThemeBlueNcs; | 
| 776 |     QTest::newRow(dataTag: "ChartThemeBrownSand" ) << QChart::ChartThemeBrownSand; | 
| 777 |     QTest::newRow(dataTag: "ChartThemeDark" ) << QChart::ChartThemeDark; | 
| 778 |     QTest::newRow(dataTag: "hartThemeHighContrast" ) << QChart::ChartThemeHighContrast; | 
| 779 |     QTest::newRow(dataTag: "ChartThemeLight" ) << QChart::ChartThemeLight; | 
| 780 |     QTest::newRow(dataTag: "ChartThemeQt" ) << QChart::ChartThemeQt; | 
| 781 | } | 
| 782 |  | 
| 783 | void tst_QChart::theme() | 
| 784 | { | 
| 785 |     QFETCH(QChart::ChartTheme, theme); | 
| 786 |     createTestData(); | 
| 787 |     m_chart->setTheme(theme); | 
| 788 |     QVERIFY(m_chart->theme()==theme); | 
| 789 | } | 
| 790 |  | 
| 791 | void tst_QChart::title_data() | 
| 792 | { | 
| 793 |     QTest::addColumn<QString>(name: "title" ); | 
| 794 |     QTest::newRow(dataTag: "null" ) << QString(); | 
| 795 |     QTest::newRow(dataTag: "foo" ) << QString("foo" ); | 
| 796 | } | 
| 797 |  | 
| 798 | void tst_QChart::title() | 
| 799 | { | 
| 800 |     QFETCH(QString, title); | 
| 801 |     m_chart->setTitle(title); | 
| 802 |     QCOMPARE(m_chart->title(), title); | 
| 803 | } | 
| 804 |  | 
| 805 | void tst_QChart::titleBrush_data() | 
| 806 | { | 
| 807 |     QTest::addColumn<QBrush>(name: "titleBrush" ); | 
| 808 |     QTest::newRow(dataTag: "null" ) << QBrush(); | 
| 809 |     QTest::newRow(dataTag: "blue" ) << QBrush(Qt::blue); | 
| 810 |     QTest::newRow(dataTag: "white" ) << QBrush(Qt::white); | 
| 811 |     QTest::newRow(dataTag: "black" ) << QBrush(Qt::black); | 
| 812 | } | 
| 813 |  | 
| 814 | void tst_QChart::titleBrush() | 
| 815 | { | 
| 816 |     QFETCH(QBrush, titleBrush); | 
| 817 |     m_chart->setTitleBrush(titleBrush); | 
| 818 |     QCOMPARE(m_chart->titleBrush().color(), titleBrush.color()); | 
| 819 | } | 
| 820 |  | 
| 821 | void tst_QChart::titleFont_data() | 
| 822 | { | 
| 823 |     QTest::addColumn<QFont>(name: "titleFont" ); | 
| 824 |     QTest::newRow(dataTag: "null" ) << QFont(); | 
| 825 |     QTest::newRow(dataTag: "courier" ) << QFont("Courier" , 8, QFont::Bold, true); | 
| 826 | } | 
| 827 |  | 
| 828 | void tst_QChart::titleFont() | 
| 829 | { | 
| 830 |     QFETCH(QFont, titleFont); | 
| 831 |     m_chart->setTitleFont(titleFont); | 
| 832 |     QCOMPARE(m_chart->titleFont(), titleFont); | 
| 833 | } | 
| 834 |  | 
| 835 | void tst_QChart::zoomIn_data() | 
| 836 | { | 
| 837 |     QTest::addColumn<QRectF>(name: "rect" ); | 
| 838 |     QTest::newRow(dataTag: "null" ) << QRectF(); | 
| 839 |     QTest::newRow(dataTag: "100x100" ) << QRectF(10,10,100,100); | 
| 840 |     QTest::newRow(dataTag: "200x200" ) << QRectF(10,10,200,200); | 
| 841 | } | 
| 842 |  | 
| 843 |  | 
| 844 | void tst_QChart::zoomIn() | 
| 845 | { | 
| 846 |  | 
| 847 |     QFETCH(QRectF, rect); | 
| 848 |     createTestData(); | 
| 849 |     m_chart->createDefaultAxes(); | 
| 850 |     QRectF marigns = m_chart->plotArea(); | 
| 851 |     rect.adjust(xp1: marigns.left(),yp1: marigns.top(),xp2: -marigns.right(),yp2: -marigns.bottom()); | 
| 852 |     auto axisX = qobject_cast<QValueAxis *>(object: m_chart->axes(orientation: Qt::Horizontal).value(i: 0)); | 
| 853 |     QVERIFY(axisX); | 
| 854 |     auto axisY = qobject_cast<QValueAxis *>(object: m_chart->axes(orientation: Qt::Vertical).value(i: 0)); | 
| 855 |     QVERIFY(axisY); | 
| 856 |     qreal minX = axisX->min(); | 
| 857 |     qreal minY = axisY->min(); | 
| 858 |     qreal maxX = axisX->max(); | 
| 859 |     qreal maxY = axisY->max(); | 
| 860 |     m_chart->zoomIn(rect); | 
| 861 |     if(rect.isValid()){ | 
| 862 |         QVERIFY(minX<axisX->min()); | 
| 863 |         QVERIFY(maxX>axisX->max()); | 
| 864 |         QVERIFY(minY<axisY->min()); | 
| 865 |         QVERIFY(maxY>axisY->max()); | 
| 866 |     } | 
| 867 |  | 
| 868 | } | 
| 869 |  | 
| 870 | void tst_QChart::zoomOut_data() | 
| 871 | { | 
| 872 |  | 
| 873 | } | 
| 874 |  | 
| 875 | void tst_QChart::zoomOut() | 
| 876 | { | 
| 877 |     createTestData(); | 
| 878 |     m_chart->createDefaultAxes(); | 
| 879 |  | 
| 880 |     auto axisX = qobject_cast<QValueAxis *>(object: m_chart->axes(orientation: Qt::Horizontal).value(i: 0)); | 
| 881 |     QVERIFY(axisX); | 
| 882 |     auto axisY = qobject_cast<QValueAxis *>(object: m_chart->axes(orientation: Qt::Vertical).value(i: 0)); | 
| 883 |     QVERIFY(axisY); | 
| 884 |  | 
| 885 |     qreal minX = axisX->min(); | 
| 886 |     qreal minY = axisY->min(); | 
| 887 |     qreal maxX = axisX->max(); | 
| 888 |     qreal maxY = axisY->max(); | 
| 889 |  | 
| 890 |     m_chart->zoomIn(); | 
| 891 |  | 
| 892 |     QVERIFY(minX < axisX->min()); | 
| 893 |     QVERIFY(maxX > axisX->max()); | 
| 894 |     QVERIFY(minY < axisY->min()); | 
| 895 |     QVERIFY(maxY > axisY->max()); | 
| 896 |  | 
| 897 |     m_chart->zoomOut(); | 
| 898 |  | 
| 899 |     // min x may be a zero value | 
| 900 |     if (qFuzzyIsNull(d: minX)) | 
| 901 |         QVERIFY(qFuzzyIsNull(axisX->min())); | 
| 902 |     else | 
| 903 |         QCOMPARE(minX, axisX->min()); | 
| 904 |  | 
| 905 |     // min y may be a zero value | 
| 906 |     if (qFuzzyIsNull(d: minY)) | 
| 907 |         QVERIFY(qFuzzyIsNull(axisY->min())); | 
| 908 |     else | 
| 909 |         QCOMPARE(minY, axisY->min()); | 
| 910 |  | 
| 911 |     QCOMPARE(maxX, axisX->max()); | 
| 912 |     QCOMPARE(maxY, axisY->max()); | 
| 913 |  | 
| 914 | } | 
| 915 |  | 
| 916 | void tst_QChart::zoomReset() | 
| 917 | { | 
| 918 |     createTestData(); | 
| 919 |     m_chart->createDefaultAxes(); | 
| 920 |     auto axisX = qobject_cast<QValueAxis *>(object: m_chart->axes(orientation: Qt::Horizontal).value(i: 0)); | 
| 921 |     QVERIFY(axisX); | 
| 922 |     auto axisY = qobject_cast<QValueAxis *>(object: m_chart->axes(orientation: Qt::Vertical).value(i: 0)); | 
| 923 |     QVERIFY(axisY); | 
| 924 |  | 
| 925 |     qreal minX = axisX->min(); | 
| 926 |     qreal minY = axisY->min(); | 
| 927 |     qreal maxX = axisX->max(); | 
| 928 |     qreal maxY = axisY->max(); | 
| 929 |  | 
| 930 |     QVERIFY(!m_chart->isZoomed()); | 
| 931 |  | 
| 932 |     m_chart->zoomIn(); | 
| 933 |  | 
| 934 |     QVERIFY(m_chart->isZoomed()); | 
| 935 |     QVERIFY(minX < axisX->min()); | 
| 936 |     QVERIFY(maxX > axisX->max()); | 
| 937 |     QVERIFY(minY < axisY->min()); | 
| 938 |     QVERIFY(maxY > axisY->max()); | 
| 939 |  | 
| 940 |     m_chart->zoomReset(); | 
| 941 |  | 
| 942 |     // Reset after zoomIn should restore originals | 
| 943 |     QVERIFY(!m_chart->isZoomed()); | 
| 944 |     QVERIFY(minX == axisX->min()); | 
| 945 |     QVERIFY(maxX == axisX->max()); | 
| 946 |     QVERIFY(minY == axisY->min()); | 
| 947 |     QVERIFY(maxY == axisY->max()); | 
| 948 |  | 
| 949 |     m_chart->zoomOut(); | 
| 950 |  | 
| 951 |     QVERIFY(m_chart->isZoomed()); | 
| 952 |     QVERIFY(minX > axisX->min()); | 
| 953 |     QVERIFY(maxX < axisX->max()); | 
| 954 |     QVERIFY(minY > axisY->min()); | 
| 955 |     QVERIFY(maxY < axisY->max()); | 
| 956 |  | 
| 957 |     m_chart->zoomReset(); | 
| 958 |  | 
| 959 |     // Reset after zoomOut should restore originals | 
| 960 |     QVERIFY(!m_chart->isZoomed()); | 
| 961 |     QVERIFY(minX == axisX->min()); | 
| 962 |     QVERIFY(maxX == axisX->max()); | 
| 963 |     QVERIFY(minY == axisY->min()); | 
| 964 |     QVERIFY(maxY == axisY->max()); | 
| 965 |  | 
| 966 |     axisX->setRange(min: 234, max: 345); | 
| 967 |     axisY->setRange(min: 345, max: 456); | 
| 968 |  | 
| 969 |     minX = axisX->min(); | 
| 970 |     minY = axisY->min(); | 
| 971 |     maxX = axisX->max(); | 
| 972 |     maxY = axisY->max(); | 
| 973 |  | 
| 974 |     QVERIFY(!m_chart->isZoomed()); | 
| 975 |  | 
| 976 |     m_chart->zoomReset(); | 
| 977 |  | 
| 978 |     // Reset without zoom should not change anything | 
| 979 |     QVERIFY(!m_chart->isZoomed()); | 
| 980 |     QVERIFY(minX == axisX->min()); | 
| 981 |     QVERIFY(maxX == axisX->max()); | 
| 982 |     QVERIFY(minY == axisY->min()); | 
| 983 |     QVERIFY(maxY == axisY->max()); | 
| 984 |  | 
| 985 | } | 
| 986 |  | 
| 987 | void tst_QChart::createDefaultAxesForLineSeries_data() | 
| 988 | { | 
| 989 |     QTest::addColumn<qreal>(name: "series1minX" ); | 
| 990 |     QTest::addColumn<qreal>(name: "series1midX" ); | 
| 991 |     QTest::addColumn<qreal>(name: "series1maxX" ); | 
| 992 |     QTest::addColumn<qreal>(name: "series2minX" ); | 
| 993 |     QTest::addColumn<qreal>(name: "series2midX" ); | 
| 994 |     QTest::addColumn<qreal>(name: "series2maxX" ); | 
| 995 |     QTest::addColumn<qreal>(name: "overallminX" ); | 
| 996 |     QTest::addColumn<qreal>(name: "overallmaxX" ); | 
| 997 |     QTest::addColumn<qreal>(name: "series1minY" ); | 
| 998 |     QTest::addColumn<qreal>(name: "series1midY" ); | 
| 999 |     QTest::addColumn<qreal>(name: "series1maxY" ); | 
| 1000 |     QTest::addColumn<qreal>(name: "series2minY" ); | 
| 1001 |     QTest::addColumn<qreal>(name: "series2midY" ); | 
| 1002 |     QTest::addColumn<qreal>(name: "series2maxY" ); | 
| 1003 |     QTest::addColumn<qreal>(name: "overallminY" ); | 
| 1004 |     QTest::addColumn<qreal>(name: "overallmaxY" ); | 
| 1005 |     QTest::newRow(dataTag: "series1hasMinAndMax" ) << (qreal)1.0 << (qreal)2.0 << (qreal)3.0 << (qreal)1.1 << (qreal)1.7 << (qreal)2.9 << (qreal)1.0 << (qreal)3.0 | 
| 1006 |                                          << (qreal)1.0 << (qreal)2.0 << (qreal)3.0 << (qreal)1.1 << (qreal)1.7 << (qreal)2.9 << (qreal)1.0 << (qreal)3.0; | 
| 1007 |     QTest::newRow(dataTag: "series2hasMinAndMax" ) << (qreal)1.1 << (qreal)2.0 << (qreal)2.9 << (qreal)1.0 << (qreal)1.7 << (qreal)3.0 << (qreal)1.0 << (qreal)3.0 | 
| 1008 |                                          << (qreal)1.1 << (qreal)2.0 << (qreal)2.9 << (qreal)1.0 << (qreal)1.7 << (qreal)3.0 << (qreal)1.0 << (qreal)3.0; | 
| 1009 |     QTest::newRow(dataTag: "series1hasMinAndMaxX_series2hasMinAndMaxY" ) << (qreal)1.0 << (qreal)2.0 << (qreal)3.0 << (qreal)1.1 << (qreal)1.7 << (qreal)2.9 << (qreal)1.0 << (qreal)3.0 | 
| 1010 |                                                                << (qreal)1.1 << (qreal)2.0 << (qreal)2.9 << (qreal)1.0 << (qreal)2.0 << (qreal)3.0 << (qreal)1.0 << (qreal)3.0; | 
| 1011 |     QTest::newRow(dataTag: "series1hasMin_series2hasMax" ) << (qreal)1.0 << (qreal)2.0 << (qreal)2.9 << (qreal)1.1 << (qreal)1.7 << (qreal)3.0 << (qreal)1.0 << (qreal)3.0 | 
| 1012 |                                                  << (qreal)1.0 << (qreal)2.0 << (qreal)2.9 << (qreal)1.1 << (qreal)1.7 << (qreal)3.0 << (qreal)1.0 << (qreal)3.0; | 
| 1013 |     QTest::newRow(dataTag: "bothSeriesHaveSameMinAndMax" ) << (qreal)1.0 << (qreal)2.0 << (qreal)2.9 << (qreal)1.1 << (qreal)1.7 << (qreal)3.0 << (qreal)1.0 << (qreal)3.0 | 
| 1014 |                                                  << (qreal)1.1 << (qreal)1.1 << (qreal)1.1 << (qreal)1.1 << (qreal)1.1 << (qreal)1.1 << (qreal)0.6 << (qreal)1.6; | 
| 1015 | } | 
| 1016 |  | 
| 1017 | void tst_QChart::createDefaultAxesForLineSeries() | 
| 1018 | { | 
| 1019 |     QFETCH(qreal, series1minX); | 
| 1020 |     QFETCH(qreal, series1midX); | 
| 1021 |     QFETCH(qreal, series1maxX); | 
| 1022 |     QFETCH(qreal, series2minX); | 
| 1023 |     QFETCH(qreal, series2midX); | 
| 1024 |     QFETCH(qreal, series2maxX); | 
| 1025 |     QFETCH(qreal, series1minY); | 
| 1026 |     QFETCH(qreal, series1midY); | 
| 1027 |     QFETCH(qreal, series1maxY); | 
| 1028 |     QFETCH(qreal, series2minY); | 
| 1029 |     QFETCH(qreal, series2midY); | 
| 1030 |     QFETCH(qreal, series2maxY); | 
| 1031 |     QFETCH(qreal, overallminX); | 
| 1032 |     QFETCH(qreal, overallmaxX); | 
| 1033 |     QFETCH(qreal, overallminY); | 
| 1034 |     QFETCH(qreal, overallmaxY); | 
| 1035 |     QLineSeries* series1 = new QLineSeries(this); | 
| 1036 |     series1->append(x: series1minX, y: series1minY); | 
| 1037 |     series1->append(x: series1midX, y: series1midY); | 
| 1038 |     series1->append(x: series1maxX, y: series1maxY); | 
| 1039 |     QLineSeries* series2 = new QLineSeries(this); | 
| 1040 |     series2->append(x: series2minX, y: series2minY); | 
| 1041 |     series2->append(x: series2midX, y: series2midY); | 
| 1042 |     series2->append(x: series2maxX, y: series2maxY); | 
| 1043 |     QChart *chart = newQChartOrQPolarChart(); | 
| 1044 |     chart->addSeries(series: series1); | 
| 1045 |     chart->addSeries(series: series2); | 
| 1046 |     chart->createDefaultAxes(); | 
| 1047 |     auto xAxis = qobject_cast<QValueAxis *>(object: chart->axes(orientation: Qt::Horizontal).value(i: 0)); | 
| 1048 |     QVERIFY(xAxis); | 
| 1049 |     QCOMPARE(xAxis->min(), overallminX); | 
| 1050 |     QCOMPARE(xAxis->max(), overallmaxX); | 
| 1051 |     auto yAxis = qobject_cast<QValueAxis *>(object: chart->axes(orientation: Qt::Vertical).value(i: 0)); | 
| 1052 |     QVERIFY(yAxis); | 
| 1053 |     QCOMPARE(yAxis->min(), overallminY); | 
| 1054 |     QCOMPARE(yAxis->max(), overallmaxY); | 
| 1055 |     QLineSeries *series3 = new QLineSeries(this); | 
| 1056 |     // Numbers clearly out of existing range | 
| 1057 |     series3->append(x: 0, y: 0); | 
| 1058 |     series3->append(x: 100, y: 100); | 
| 1059 |     // Adding a new series should not change the axes as they have not been told to update | 
| 1060 |     chart->addSeries(series: series3); | 
| 1061 |     QCOMPARE(xAxis->min(), overallminX); | 
| 1062 |     QCOMPARE(xAxis->max(), overallmaxX); | 
| 1063 |     QCOMPARE(yAxis->min(), overallminY); | 
| 1064 |     QCOMPARE(yAxis->max(), overallmaxY); | 
| 1065 |     delete chart; | 
| 1066 | } | 
| 1067 |  | 
| 1068 | void tst_QChart::axisPolarOrientation() | 
| 1069 | { | 
| 1070 |     QLineSeries* series1 = new QLineSeries(this); | 
| 1071 |     series1->append(x: 1, y: 2); | 
| 1072 |     series1->append(x: 2, y: 4); | 
| 1073 |     series1->append(x: 3, y: 8); | 
| 1074 |     QPolarChart chart; | 
| 1075 |     chart.addSeries(series: series1); | 
| 1076 |  | 
| 1077 |     QValueAxis *xAxis = new QValueAxis(); | 
| 1078 |     QValueAxis *yAxis = new QValueAxis(); | 
| 1079 |     chart.addAxis(axis: xAxis, polarOrientation: QPolarChart::PolarOrientationAngular); | 
| 1080 |     chart.addAxis(axis: yAxis, polarOrientation: QPolarChart::PolarOrientationRadial); | 
| 1081 |  | 
| 1082 |     QList<QAbstractAxis *> xAxes = chart.axes(polarOrientation: QPolarChart::PolarOrientationAngular); | 
| 1083 |     QList<QAbstractAxis *> yAxes = chart.axes(polarOrientation: QPolarChart::PolarOrientationRadial); | 
| 1084 |  | 
| 1085 |     QCOMPARE(xAxes.size(), 1); | 
| 1086 |     QCOMPARE(yAxes.size(), 1); | 
| 1087 |     QCOMPARE(xAxes[0], xAxis); | 
| 1088 |     QCOMPARE(yAxes[0], yAxis); | 
| 1089 |  | 
| 1090 |     QCOMPARE(chart.axisPolarOrientation(xAxes[0]), QPolarChart::PolarOrientationAngular); | 
| 1091 |     QCOMPARE(chart.axisPolarOrientation(yAxes[0]), QPolarChart::PolarOrientationRadial); | 
| 1092 | } | 
| 1093 |  | 
| 1094 | void tst_QChart::backgroundRoundness() | 
| 1095 | { | 
| 1096 |     createTestData(); | 
| 1097 |     m_chart->createDefaultAxes(); | 
| 1098 |     m_chart->setBackgroundRoundness(100.0); | 
| 1099 |     QVERIFY(m_chart->backgroundRoundness() == 100.0); | 
| 1100 | } | 
| 1101 |  | 
| 1102 | void tst_QChart::zoomInAndOut_data() | 
| 1103 | { | 
| 1104 |     const qreal hourInMSecs = 60.0 * 60.0 * 1000.0; | 
| 1105 |  | 
| 1106 |     QTest::addColumn<QString>(name: "axisXType" ); | 
| 1107 |     QTest::addColumn<QString>(name: "axisYType" ); | 
| 1108 |     QTest::addColumn<qreal>(name: "minX" ); | 
| 1109 |     QTest::addColumn<qreal>(name: "maxX" ); | 
| 1110 |     QTest::addColumn<qreal>(name: "minY" ); | 
| 1111 |     QTest::addColumn<qreal>(name: "maxY" ); | 
| 1112 |  | 
| 1113 |     QTest::newRow(dataTag: "value-value-normal" ) << "QValueAxis"  << "QValueAxis"  << 0.0 << 100.0 << 0.0 << 100.0; | 
| 1114 |     QTest::newRow(dataTag: "value-value-small" ) << "QValueAxis"  << "QValueAxis"  << -1e-12 << 1e-13 << -1e-12 << 1e-13; | 
| 1115 |     QTest::newRow(dataTag: "value-value-mixed" ) << "QValueAxis"  << "QValueAxis"  << 0.0 << 100.0 << -1e-12 << 1e-13; | 
| 1116 |  | 
| 1117 |     QTest::newRow(dataTag: "datetime-datetime-normal" ) << "QDateTimeAxis"  << "QDateTimeAxis"  | 
| 1118 |         << 0.0 << hourInMSecs << 0.0 << hourInMSecs; | 
| 1119 |     QTest::newRow(dataTag: "datetime-datetime-small" ) << "QDateTimeAxis"  << "QDateTimeAxis"  | 
| 1120 |         << 0.0 << 60.0 << 0.0 << 60.0; | 
| 1121 |     QTest::newRow(dataTag: "datetime-datetime-mixed" ) << "QDateTimeAxis"  << "QDateTimeAxis"  | 
| 1122 |         << 0.0 << hourInMSecs << 0.0 << 60.0; | 
| 1123 | } | 
| 1124 |  | 
| 1125 | #define CHECK_AXIS_RANGES_MATCH \ | 
| 1126 |     if (valueAxisX) { \ | 
| 1127 |         QVERIFY(valueAxisX->min() == minX); \ | 
| 1128 |         QVERIFY(valueAxisX->max() == maxX); \ | 
| 1129 |     } else if (dateTimeAxisX) { \ | 
| 1130 |         QVERIFY(dateTimeAxisX->min().toMSecsSinceEpoch() == minX); \ | 
| 1131 |         QVERIFY(dateTimeAxisX->max().toMSecsSinceEpoch() == maxX); \ | 
| 1132 |     } \ | 
| 1133 |     if (valueAxisY) { \ | 
| 1134 |         QVERIFY(valueAxisY->min() == minY); \ | 
| 1135 |         QVERIFY(valueAxisY->max() == maxY); \ | 
| 1136 |     } else if (dateTimeAxisY) { \ | 
| 1137 |         QVERIFY(dateTimeAxisY->min().toMSecsSinceEpoch() == minY); \ | 
| 1138 |         QVERIFY(dateTimeAxisY->max().toMSecsSinceEpoch() == maxY); \ | 
| 1139 |     } | 
| 1140 |  | 
| 1141 | void tst_QChart::zoomInAndOut() | 
| 1142 | { | 
| 1143 |     QFETCH(QString, axisXType); | 
| 1144 |     QFETCH(QString, axisYType); | 
| 1145 |     QFETCH(qreal, minX); | 
| 1146 |     QFETCH(qreal, maxX); | 
| 1147 |     QFETCH(qreal, minY); | 
| 1148 |     QFETCH(qreal, maxY); | 
| 1149 |  | 
| 1150 |     createTestData(); | 
| 1151 |     QAbstractAxis *axisX = 0; | 
| 1152 |     QAbstractAxis *axisY = 0; | 
| 1153 |     QValueAxis *valueAxisX = 0; | 
| 1154 |     QValueAxis *valueAxisY = 0; | 
| 1155 |     QDateTimeAxis *dateTimeAxisX = 0; | 
| 1156 |     QDateTimeAxis *dateTimeAxisY = 0; | 
| 1157 |  | 
| 1158 |     if (axisXType == "QValueAxis" ) { | 
| 1159 |         axisX = valueAxisX = new QValueAxis(m_chart); | 
| 1160 |         valueAxisX->setRange(min: minX, max: maxX); | 
| 1161 |     } else if (axisXType == "QDateTimeAxis" ) { | 
| 1162 |         axisX = dateTimeAxisX = new QDateTimeAxis(m_chart); | 
| 1163 |         dateTimeAxisX->setRange(min: QDateTime::fromMSecsSinceEpoch(msecs: minX), max: QDateTime::fromMSecsSinceEpoch(msecs: maxX)); | 
| 1164 |     } | 
| 1165 |     if (axisXType == "QValueAxis" ) { | 
| 1166 |         axisY = valueAxisY = new QValueAxis(m_chart); | 
| 1167 |         valueAxisY->setRange(min: minY, max: maxY); | 
| 1168 |     } else if (axisXType == "QDateTimeAxis" ) { | 
| 1169 |         axisY = dateTimeAxisY = new QDateTimeAxis(m_chart); | 
| 1170 |         dateTimeAxisY->setRange(min: QDateTime::fromMSecsSinceEpoch(msecs: minY), max: QDateTime::fromMSecsSinceEpoch(msecs: maxY)); | 
| 1171 |     } | 
| 1172 |  | 
| 1173 |     const auto series = m_chart->series().constFirst(); | 
| 1174 |     m_chart->addAxis(axis: axisX, alignment: Qt::AlignBottom); | 
| 1175 |     series->attachAxis(axis: axisX); | 
| 1176 |     m_chart->addAxis(axis: axisY, alignment: Qt::AlignLeft); | 
| 1177 |     series->attachAxis(axis: axisY); | 
| 1178 |     CHECK_AXIS_RANGES_MATCH | 
| 1179 |  | 
| 1180 |     m_chart->zoomIn(); | 
| 1181 |     if (valueAxisX) { | 
| 1182 |         QVERIFY(valueAxisX->min() != minX); | 
| 1183 |         QVERIFY(valueAxisX->max() != maxX); | 
| 1184 |     } else if (dateTimeAxisX) { | 
| 1185 |         QVERIFY(dateTimeAxisX->min().toMSecsSinceEpoch() != minX); | 
| 1186 |         QVERIFY(dateTimeAxisX->max().toMSecsSinceEpoch() != maxX); | 
| 1187 |     } | 
| 1188 |     if (valueAxisY) { | 
| 1189 |         QVERIFY(valueAxisY->min() != minY); | 
| 1190 |         QVERIFY(valueAxisY->max() != maxY); | 
| 1191 |     } else if (dateTimeAxisY) { | 
| 1192 |         QVERIFY(dateTimeAxisY->min().toMSecsSinceEpoch() != minY); | 
| 1193 |         QVERIFY(dateTimeAxisY->max().toMSecsSinceEpoch() != maxY); | 
| 1194 |     } | 
| 1195 |  | 
| 1196 |     m_chart->zoomReset(); | 
| 1197 |     CHECK_AXIS_RANGES_MATCH | 
| 1198 |  | 
| 1199 |     m_chart->zoomIn(); | 
| 1200 |     m_chart->zoomIn(); | 
| 1201 |     m_chart->zoomReset(); | 
| 1202 |     CHECK_AXIS_RANGES_MATCH | 
| 1203 |  | 
| 1204 |     m_chart->zoomOut(); | 
| 1205 |     m_chart->zoomReset(); | 
| 1206 |     CHECK_AXIS_RANGES_MATCH | 
| 1207 |  | 
| 1208 |     m_chart->zoomOut(); | 
| 1209 |     m_chart->zoomOut(); | 
| 1210 |     m_chart->zoomReset(); | 
| 1211 |     CHECK_AXIS_RANGES_MATCH | 
| 1212 | } | 
| 1213 |  | 
| 1214 | void tst_QChart::fixedPlotArea() | 
| 1215 | { | 
| 1216 |     createTestData(); | 
| 1217 |     const QRectF originalPlotArea = m_chart->plotArea(); | 
| 1218 |     m_chart->setPlotArea(originalPlotArea); | 
| 1219 |     QCOMPARE(m_chart->plotArea(), originalPlotArea); | 
| 1220 |     m_view->resize(w: 400, h: 400); | 
| 1221 |     // Should still be the same size | 
| 1222 |     QCOMPARE(m_chart->plotArea(), originalPlotArea); | 
| 1223 |     m_chart->setPlotArea(QRectF()); | 
| 1224 |     // Should still be the same size as we have not triggered an update | 
| 1225 |     QCOMPARE(m_chart->plotArea(), originalPlotArea); | 
| 1226 |     m_view->resize(w: 401, h: 401); | 
| 1227 |     QVERIFY(m_chart->plotArea() != originalPlotArea); | 
| 1228 |     m_chart->setPlotArea(originalPlotArea); | 
| 1229 |     QCOMPARE(m_chart->plotArea(), originalPlotArea); | 
| 1230 | } | 
| 1231 |  | 
| 1232 | QTEST_MAIN(tst_QChart) | 
| 1233 | #include "tst_qchart.moc" | 
| 1234 |  | 
| 1235 |  |