| 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 "tst_qabstractaxis.h" |
| 31 | |
| 32 | Q_DECLARE_METATYPE(QPen) |
| 33 | Q_DECLARE_METATYPE(Qt::Orientation) |
| 34 | |
| 35 | void tst_QAbstractAxis::initTestCase() |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | void tst_QAbstractAxis::cleanupTestCase() |
| 40 | { |
| 41 | QTest::qWait(ms: 1); // Allow final deleteLaters to run |
| 42 | } |
| 43 | |
| 44 | void tst_QAbstractAxis::initAxes(QAbstractAxis *axis, QAbstractSeries *series) |
| 45 | { |
| 46 | m_axis = axis; |
| 47 | m_series = series; |
| 48 | m_view = new QChartView(newQChartOrQPolarChart()); |
| 49 | m_view->resize(w: 200, h: 200); |
| 50 | m_chart = m_view->chart(); |
| 51 | } |
| 52 | |
| 53 | void tst_QAbstractAxis::cleanup() |
| 54 | { |
| 55 | delete m_view; |
| 56 | m_view = 0; |
| 57 | m_chart = 0; |
| 58 | m_axis = 0; |
| 59 | } |
| 60 | |
| 61 | void tst_QAbstractAxis::qabstractaxis() |
| 62 | { |
| 63 | QCOMPARE(m_axis->linePen(), QPen()); |
| 64 | QCOMPARE(m_axis->gridLinePen(), QPen()); |
| 65 | QCOMPARE(m_axis->isLineVisible(), true); |
| 66 | QCOMPARE(m_axis->isGridLineVisible(), true); |
| 67 | QCOMPARE(m_axis->isVisible(), true); |
| 68 | QCOMPARE(m_axis->labelsAngle(), 0); |
| 69 | QCOMPARE(m_axis->labelsBrush(), QBrush()); |
| 70 | QCOMPARE(m_axis->labelsFont(), QFont()); |
| 71 | QCOMPARE(m_axis->labelsVisible(), true); |
| 72 | QCOMPARE(m_axis->orientation(), Qt::Orientation(0)); |
| 73 | QCOMPARE(m_axis->minorGridLinePen(), QPen()); |
| 74 | QCOMPARE(m_axis->isMinorGridLineVisible(), true); |
| 75 | m_axis->setLineVisible(false); |
| 76 | m_axis->setLinePen(QPen()); |
| 77 | m_axis->setLinePenColor(QColor()); |
| 78 | m_axis->setGridLinePen(QPen()); |
| 79 | m_axis->setGridLineVisible(false); |
| 80 | m_axis->setGridLineColor(QColor()); |
| 81 | m_axis->setMinorGridLineColor(QColor()); |
| 82 | m_axis->setLabelsAngle(-1); |
| 83 | m_axis->setLabelsBrush(QBrush()); |
| 84 | m_axis->setLabelsColor(QColor()); |
| 85 | m_axis->setLabelsFont(QFont()); |
| 86 | m_axis->setLabelsVisible(false); |
| 87 | m_axis->setMax(QVariant()); |
| 88 | m_axis->setMin(QVariant()); |
| 89 | m_axis->setRange(min: QVariant(), max: QVariant()); |
| 90 | m_axis->setShadesBorderColor(QColor()); |
| 91 | m_axis->setShadesBrush(QBrush()); |
| 92 | m_axis->setShadesColor(QColor()); |
| 93 | m_axis->setShadesPen(QPen()); |
| 94 | m_axis->setShadesVisible(false); |
| 95 | m_axis->setVisible(false); |
| 96 | m_axis->setMinorGridLinePen(QPen()); |
| 97 | m_axis->setMinorGridLineVisible(false); |
| 98 | //TODO QCOMPARE(m_axis->shadesBrush(), QBrush()); |
| 99 | QCOMPARE(m_axis->shadesPen(), QPen()); |
| 100 | QCOMPARE(m_axis->shadesVisible(), false); |
| 101 | m_axis->show(); |
| 102 | m_axis->hide(); |
| 103 | } |
| 104 | |
| 105 | void tst_QAbstractAxis::axisPen_data() |
| 106 | { |
| 107 | QTest::addColumn<QPen>(name: "axisPen" ); |
| 108 | QTest::newRow(dataTag: "null" ) << QPen(); |
| 109 | QTest::newRow(dataTag: "blue" ) << QPen(Qt::blue); |
| 110 | QTest::newRow(dataTag: "black" ) << QPen(Qt::black); |
| 111 | QTest::newRow(dataTag: "red" ) << QPen(Qt::red); |
| 112 | } |
| 113 | |
| 114 | void tst_QAbstractAxis::axisPen() |
| 115 | { |
| 116 | QFETCH(QPen, axisPen); |
| 117 | |
| 118 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 119 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 120 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 121 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 122 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 123 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 124 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 125 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 126 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 127 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 128 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 129 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 130 | |
| 131 | m_axis->setLinePen(axisPen); |
| 132 | QCOMPARE(m_axis->linePen(), axisPen); |
| 133 | |
| 134 | QCOMPARE(spy0.count(), 0); |
| 135 | QCOMPARE(spy1.count(), 0); |
| 136 | QCOMPARE(spy2.count(), 0); |
| 137 | QCOMPARE(spy3.count(), 0); |
| 138 | QCOMPARE(spy4.count(), 0); |
| 139 | QCOMPARE(spy5.count(), 0); |
| 140 | QCOMPARE(spy6.count(), 0); |
| 141 | QCOMPARE(spy7.count(), 0); |
| 142 | QCOMPARE(spy8.count(), 0); |
| 143 | QCOMPARE(spy9.count(), 0); |
| 144 | QCOMPARE(spy10.count(), 0); |
| 145 | QCOMPARE(spy11.count(), 0); |
| 146 | |
| 147 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 148 | m_series->attachAxis(axis: m_axis); |
| 149 | m_view->show(); |
| 150 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 151 | //TODO QCOMPARE(m_axis->axisPen(), axisPen); |
| 152 | } |
| 153 | |
| 154 | void tst_QAbstractAxis::axisPenColor_data() |
| 155 | { |
| 156 | } |
| 157 | |
| 158 | void tst_QAbstractAxis::axisPenColor() |
| 159 | { |
| 160 | QSKIP("Test is not implemented. This is deprecated function" ); |
| 161 | } |
| 162 | |
| 163 | void tst_QAbstractAxis::gridLinePen_data() |
| 164 | { |
| 165 | |
| 166 | QTest::addColumn<QPen>(name: "gridLinePen" ); |
| 167 | QTest::newRow(dataTag: "null" ) << QPen(); |
| 168 | QTest::newRow(dataTag: "blue" ) << QPen(Qt::blue); |
| 169 | QTest::newRow(dataTag: "black" ) << QPen(Qt::black); |
| 170 | QTest::newRow(dataTag: "red" ) << QPen(Qt::red); |
| 171 | |
| 172 | } |
| 173 | |
| 174 | void tst_QAbstractAxis::gridLinePen() |
| 175 | { |
| 176 | QFETCH(QPen, gridLinePen); |
| 177 | |
| 178 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 179 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 180 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 181 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 182 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 183 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 184 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 185 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 186 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 187 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 188 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 189 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 190 | |
| 191 | m_axis->setGridLinePen(gridLinePen); |
| 192 | QCOMPARE(m_axis->gridLinePen(), gridLinePen); |
| 193 | |
| 194 | QCOMPARE(spy0.count(), 0); |
| 195 | QCOMPARE(spy1.count(), 0); |
| 196 | QCOMPARE(spy2.count(), 0); |
| 197 | QCOMPARE(spy3.count(), 0); |
| 198 | QCOMPARE(spy4.count(), 0); |
| 199 | QCOMPARE(spy5.count(), 0); |
| 200 | QCOMPARE(spy6.count(), 0); |
| 201 | QCOMPARE(spy7.count(), 0); |
| 202 | QCOMPARE(spy8.count(), 0); |
| 203 | QCOMPARE(spy9.count(), 0); |
| 204 | QCOMPARE(spy10.count(), 0); |
| 205 | QCOMPARE(spy11.count(), 0); |
| 206 | |
| 207 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 208 | m_series->attachAxis(axis: m_axis); |
| 209 | m_view->show(); |
| 210 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 211 | //TODO QCOMPARE(m_axis->gridLinePen(), gridLinePen); |
| 212 | } |
| 213 | |
| 214 | void tst_QAbstractAxis::minorGridLinePen_data() |
| 215 | { |
| 216 | |
| 217 | QTest::addColumn<QPen>(name: "minorGridLinePen" ); |
| 218 | QTest::newRow(dataTag: "null" ) << QPen(); |
| 219 | QTest::newRow(dataTag: "blue" ) << QPen(Qt::blue); |
| 220 | QTest::newRow(dataTag: "black" ) << QPen(Qt::black); |
| 221 | QTest::newRow(dataTag: "red" ) << QPen(Qt::red); |
| 222 | |
| 223 | } |
| 224 | |
| 225 | void tst_QAbstractAxis::minorGridLinePen() |
| 226 | { |
| 227 | QFETCH(QPen, minorGridLinePen); |
| 228 | |
| 229 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 230 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 231 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 232 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 233 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 234 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 235 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 236 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 237 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 238 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 239 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 240 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 241 | |
| 242 | m_axis->setMinorGridLinePen(minorGridLinePen); |
| 243 | QCOMPARE(m_axis->minorGridLinePen(), minorGridLinePen); |
| 244 | |
| 245 | QCOMPARE(spy0.count(), 0); |
| 246 | QCOMPARE(spy1.count(), 0); |
| 247 | QCOMPARE(spy2.count(), 0); |
| 248 | QCOMPARE(spy3.count(), 0); |
| 249 | QCOMPARE(spy4.count(), 0); |
| 250 | QCOMPARE(spy5.count(), 0); |
| 251 | QCOMPARE(spy6.count(), 0); |
| 252 | QCOMPARE(spy7.count(), 0); |
| 253 | QCOMPARE(spy8.count(), 0); |
| 254 | QCOMPARE(spy9.count(), 0); |
| 255 | QCOMPARE(spy10.count(), 0); |
| 256 | QCOMPARE(spy11.count(), 0); |
| 257 | |
| 258 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 259 | m_series->attachAxis(axis: m_axis); |
| 260 | m_view->show(); |
| 261 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 262 | |
| 263 | } |
| 264 | |
| 265 | void tst_QAbstractAxis::lineVisible_data() |
| 266 | { |
| 267 | QTest::addColumn<bool>(name: "lineVisible" ); |
| 268 | QTest::newRow(dataTag: "true" ) << true; |
| 269 | QTest::newRow(dataTag: "false" ) << false; |
| 270 | } |
| 271 | |
| 272 | void tst_QAbstractAxis::lineVisible() |
| 273 | { |
| 274 | QFETCH(bool, lineVisible); |
| 275 | |
| 276 | m_axis->setLineVisible(!lineVisible); |
| 277 | |
| 278 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 279 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 280 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 281 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 282 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 283 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 284 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 285 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 286 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 287 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 288 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 289 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 290 | |
| 291 | m_axis->setLineVisible(lineVisible); |
| 292 | QCOMPARE(m_axis->isLineVisible(), lineVisible); |
| 293 | |
| 294 | QCOMPARE(spy0.count(), 1); |
| 295 | QCOMPARE(spy1.count(), 0); |
| 296 | QCOMPARE(spy2.count(), 0); |
| 297 | QCOMPARE(spy3.count(), 0); |
| 298 | QCOMPARE(spy4.count(), 0); |
| 299 | QCOMPARE(spy5.count(), 0); |
| 300 | QCOMPARE(spy6.count(), 0); |
| 301 | QCOMPARE(spy7.count(), 0); |
| 302 | QCOMPARE(spy8.count(), 0); |
| 303 | QCOMPARE(spy9.count(), 0); |
| 304 | QCOMPARE(spy10.count(), 0); |
| 305 | QCOMPARE(spy11.count(), 0); |
| 306 | |
| 307 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 308 | m_series->attachAxis(axis: m_axis); |
| 309 | m_view->show(); |
| 310 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 311 | QCOMPARE(m_axis->isLineVisible(), lineVisible); |
| 312 | } |
| 313 | |
| 314 | void tst_QAbstractAxis::gridLineVisible_data() |
| 315 | { |
| 316 | QTest::addColumn<bool>(name: "gridLineVisible" ); |
| 317 | QTest::newRow(dataTag: "true" ) << true; |
| 318 | QTest::newRow(dataTag: "false" ) << false; |
| 319 | } |
| 320 | |
| 321 | void tst_QAbstractAxis::gridLineVisible() |
| 322 | { |
| 323 | QFETCH(bool, gridLineVisible); |
| 324 | |
| 325 | m_axis->setGridLineVisible(!gridLineVisible); |
| 326 | |
| 327 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 328 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 329 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 330 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 331 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 332 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 333 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 334 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 335 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 336 | QSignalSpy spy9(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 337 | |
| 338 | m_axis->setGridLineVisible(gridLineVisible); |
| 339 | QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible); |
| 340 | |
| 341 | QCOMPARE(spy0.count(), 0); |
| 342 | QCOMPARE(spy1.count(), 0); |
| 343 | QCOMPARE(spy2.count(), 1); |
| 344 | QCOMPARE(spy3.count(), 0); |
| 345 | QCOMPARE(spy4.count(), 0); |
| 346 | QCOMPARE(spy5.count(), 0); |
| 347 | QCOMPARE(spy6.count(), 0); |
| 348 | QCOMPARE(spy7.count(), 0); |
| 349 | QCOMPARE(spy8.count(), 0); |
| 350 | QCOMPARE(spy9.count(), 0); |
| 351 | |
| 352 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 353 | m_series->attachAxis(axis: m_axis); |
| 354 | m_view->show(); |
| 355 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 356 | QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible); |
| 357 | |
| 358 | } |
| 359 | |
| 360 | void tst_QAbstractAxis::minorGridLineVisible_data() |
| 361 | { |
| 362 | QTest::addColumn<bool>(name: "minorGridLineVisible" ); |
| 363 | QTest::newRow(dataTag: "true" ) << true; |
| 364 | QTest::newRow(dataTag: "false" ) << false; |
| 365 | } |
| 366 | |
| 367 | void tst_QAbstractAxis::minorGridLineVisible() |
| 368 | { |
| 369 | QFETCH(bool, minorGridLineVisible); |
| 370 | |
| 371 | m_axis->setMinorGridLineVisible(!minorGridLineVisible); |
| 372 | |
| 373 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 374 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 375 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 376 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 377 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 378 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 379 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 380 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 381 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 382 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 383 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 384 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 385 | |
| 386 | m_axis->setMinorGridLineVisible(minorGridLineVisible); |
| 387 | QCOMPARE(m_axis->isMinorGridLineVisible(), minorGridLineVisible); |
| 388 | |
| 389 | QCOMPARE(spy0.count(), 0); |
| 390 | QCOMPARE(spy1.count(), 0); |
| 391 | QCOMPARE(spy2.count(), 0); |
| 392 | QCOMPARE(spy3.count(), 0); |
| 393 | QCOMPARE(spy4.count(), 0); |
| 394 | QCOMPARE(spy5.count(), 0); |
| 395 | QCOMPARE(spy6.count(), 0); |
| 396 | QCOMPARE(spy7.count(), 0); |
| 397 | QCOMPARE(spy8.count(), 0); |
| 398 | QCOMPARE(spy9.count(), 1); |
| 399 | QCOMPARE(spy10.count(), 0); |
| 400 | QCOMPARE(spy11.count(), 0); |
| 401 | |
| 402 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 403 | m_series->attachAxis(axis: m_axis); |
| 404 | m_view->show(); |
| 405 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 406 | QCOMPARE(m_axis->isMinorGridLineVisible(), minorGridLineVisible); |
| 407 | |
| 408 | } |
| 409 | |
| 410 | void tst_QAbstractAxis::gridLineColor_data() |
| 411 | { |
| 412 | QTest::addColumn<QColor>(name: "gridLineColor" ); |
| 413 | QTest::newRow(dataTag: "blue" ) << QColor(Qt::blue); |
| 414 | QTest::newRow(dataTag: "red" ) << QColor(Qt::red); |
| 415 | QTest::newRow(dataTag: "yellow" ) << QColor(Qt::yellow); |
| 416 | } |
| 417 | |
| 418 | void tst_QAbstractAxis::gridLineColor() |
| 419 | { |
| 420 | QFETCH(QColor, gridLineColor); |
| 421 | |
| 422 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 423 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 424 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 425 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 426 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 427 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 428 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 429 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 430 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 431 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 432 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 433 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 434 | |
| 435 | m_axis->setGridLineColor(gridLineColor); |
| 436 | QCOMPARE(m_axis->gridLineColor(), gridLineColor); |
| 437 | |
| 438 | QCOMPARE(spy0.count(), 0); |
| 439 | QCOMPARE(spy1.count(), 0); |
| 440 | QCOMPARE(spy2.count(), 0); |
| 441 | QCOMPARE(spy3.count(), 0); |
| 442 | QCOMPARE(spy4.count(), 0); |
| 443 | QCOMPARE(spy5.count(), 0); |
| 444 | QCOMPARE(spy6.count(), 0); |
| 445 | QCOMPARE(spy7.count(), 0); |
| 446 | QCOMPARE(spy8.count(), 0); |
| 447 | QCOMPARE(spy9.count(), 0); |
| 448 | QCOMPARE(spy10.count(), 1); |
| 449 | QCOMPARE(spy11.count(), 0); |
| 450 | |
| 451 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 452 | m_series->attachAxis(axis: m_axis); |
| 453 | m_view->show(); |
| 454 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 455 | |
| 456 | } |
| 457 | |
| 458 | void tst_QAbstractAxis::minorGridLineColor_data() |
| 459 | { |
| 460 | QTest::addColumn<QColor>(name: "minorGridLineColor" ); |
| 461 | QTest::newRow(dataTag: "blue" ) << QColor(Qt::blue); |
| 462 | QTest::newRow(dataTag: "red" ) << QColor(Qt::red); |
| 463 | QTest::newRow(dataTag: "yellow" ) << QColor(Qt::yellow); |
| 464 | } |
| 465 | |
| 466 | void tst_QAbstractAxis::minorGridLineColor() |
| 467 | { |
| 468 | QFETCH(QColor, minorGridLineColor); |
| 469 | |
| 470 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 471 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 472 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 473 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 474 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 475 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 476 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 477 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 478 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 479 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 480 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 481 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 482 | |
| 483 | m_axis->setMinorGridLineColor(minorGridLineColor); |
| 484 | QCOMPARE(m_axis->minorGridLineColor(), minorGridLineColor); |
| 485 | |
| 486 | QCOMPARE(spy0.count(), 0); |
| 487 | QCOMPARE(spy1.count(), 0); |
| 488 | QCOMPARE(spy2.count(), 0); |
| 489 | QCOMPARE(spy3.count(), 0); |
| 490 | QCOMPARE(spy4.count(), 0); |
| 491 | QCOMPARE(spy5.count(), 0); |
| 492 | QCOMPARE(spy6.count(), 0); |
| 493 | QCOMPARE(spy7.count(), 0); |
| 494 | QCOMPARE(spy8.count(), 0); |
| 495 | QCOMPARE(spy9.count(), 0); |
| 496 | QCOMPARE(spy10.count(), 0); |
| 497 | QCOMPARE(spy11.count(), 1); |
| 498 | |
| 499 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 500 | m_series->attachAxis(axis: m_axis); |
| 501 | m_view->show(); |
| 502 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 503 | |
| 504 | } |
| 505 | |
| 506 | void tst_QAbstractAxis::visible_data() |
| 507 | { |
| 508 | QTest::addColumn<bool>(name: "visible" ); |
| 509 | QTest::newRow(dataTag: "true" ) << true; |
| 510 | QTest::newRow(dataTag: "false" ) << false; |
| 511 | } |
| 512 | |
| 513 | void tst_QAbstractAxis::visible() |
| 514 | { |
| 515 | QFETCH(bool, visible); |
| 516 | |
| 517 | m_axis->setVisible(!visible); |
| 518 | |
| 519 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 520 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 521 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 522 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 523 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 524 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 525 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 526 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 527 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 528 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 529 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 530 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 531 | |
| 532 | m_axis->setVisible(visible); |
| 533 | QCOMPARE(m_axis->isVisible(), visible); |
| 534 | |
| 535 | QCOMPARE(spy0.count(), 0); |
| 536 | QCOMPARE(spy1.count(), 0); |
| 537 | QCOMPARE(spy2.count(), 0); |
| 538 | QCOMPARE(spy3.count(), 0); |
| 539 | QCOMPARE(spy4.count(), 0); |
| 540 | QCOMPARE(spy5.count(), 0); |
| 541 | QCOMPARE(spy6.count(), 0); |
| 542 | QCOMPARE(spy7.count(), 0); |
| 543 | QCOMPARE(spy8.count(), 1); |
| 544 | QCOMPARE(spy9.count(), 0); |
| 545 | QCOMPARE(spy10.count(), 0); |
| 546 | QCOMPARE(spy11.count(), 0); |
| 547 | |
| 548 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 549 | m_series->attachAxis(axis: m_axis); |
| 550 | m_view->show(); |
| 551 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 552 | QCOMPARE(m_axis->isVisible(), visible); |
| 553 | } |
| 554 | |
| 555 | void tst_QAbstractAxis::labelsAngle_data() |
| 556 | { |
| 557 | QTest::addColumn<int>(name: "labelsAngle" ); |
| 558 | QTest::newRow(dataTag: "0" ) << 0; |
| 559 | QTest::newRow(dataTag: "45" ) << 45; |
| 560 | QTest::newRow(dataTag: "90" ) << 90; |
| 561 | } |
| 562 | |
| 563 | void tst_QAbstractAxis::labelsAngle() |
| 564 | { |
| 565 | QFETCH(int, labelsAngle); |
| 566 | |
| 567 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 568 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 569 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 570 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 571 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 572 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 573 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 574 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 575 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 576 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 577 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 578 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 579 | |
| 580 | m_axis->setLabelsAngle(labelsAngle); |
| 581 | QCOMPARE(m_axis->labelsAngle(), labelsAngle); |
| 582 | |
| 583 | QCOMPARE(spy0.count(), 0); |
| 584 | QCOMPARE(spy1.count(), 0); |
| 585 | QCOMPARE(spy2.count(), 0); |
| 586 | QCOMPARE(spy3.count(), 0); |
| 587 | QCOMPARE(spy4.count(), 0); |
| 588 | QCOMPARE(spy5.count(), 0); |
| 589 | QCOMPARE(spy6.count(), 0); |
| 590 | QCOMPARE(spy7.count(), 0); |
| 591 | QCOMPARE(spy8.count(), 0); |
| 592 | QCOMPARE(spy9.count(), 0); |
| 593 | QCOMPARE(spy10.count(), 0); |
| 594 | QCOMPARE(spy11.count(), 0); |
| 595 | |
| 596 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 597 | m_series->attachAxis(axis: m_axis); |
| 598 | m_view->show(); |
| 599 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 600 | QCOMPARE(m_axis->labelsAngle(), labelsAngle); |
| 601 | } |
| 602 | |
| 603 | void tst_QAbstractAxis::labelsBrush_data() |
| 604 | { |
| 605 | QTest::addColumn<QBrush>(name: "labelsBrush" ); |
| 606 | QTest::newRow(dataTag: "null" ) << QBrush(); |
| 607 | QTest::newRow(dataTag: "blue" ) << QBrush(Qt::blue); |
| 608 | QTest::newRow(dataTag: "black" ) << QBrush(Qt::black); |
| 609 | |
| 610 | } |
| 611 | |
| 612 | void tst_QAbstractAxis::labelsBrush() |
| 613 | { |
| 614 | |
| 615 | QFETCH(QBrush, labelsBrush); |
| 616 | |
| 617 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 618 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 619 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 620 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 621 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 622 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 623 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 624 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 625 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 626 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 627 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 628 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 629 | |
| 630 | m_axis->setLabelsBrush(labelsBrush); |
| 631 | QCOMPARE(m_axis->labelsBrush(), labelsBrush); |
| 632 | |
| 633 | QCOMPARE(spy0.count(), 0); |
| 634 | QCOMPARE(spy1.count(), 0); |
| 635 | QCOMPARE(spy2.count(), 0); |
| 636 | QCOMPARE(spy3.count(), 0); |
| 637 | QCOMPARE(spy4.count(), 0); |
| 638 | QCOMPARE(spy5.count(), 0); |
| 639 | //TODO QCOMPARE(spy6.count(), 0); |
| 640 | QCOMPARE(spy7.count(), 0); |
| 641 | QCOMPARE(spy8.count(), 0); |
| 642 | QCOMPARE(spy9.count(), 0); |
| 643 | QCOMPARE(spy10.count(), 0); |
| 644 | QCOMPARE(spy11.count(), 0); |
| 645 | |
| 646 | m_view->show(); |
| 647 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 648 | QCOMPARE(m_axis->labelsBrush(), labelsBrush); |
| 649 | |
| 650 | } |
| 651 | |
| 652 | void tst_QAbstractAxis::labelsColor_data() |
| 653 | { |
| 654 | |
| 655 | } |
| 656 | |
| 657 | void tst_QAbstractAxis::labelsColor() |
| 658 | { |
| 659 | QSKIP("Test is not implemented. This is deprecated function" ); |
| 660 | } |
| 661 | |
| 662 | void tst_QAbstractAxis::labelsFont_data() |
| 663 | { |
| 664 | QTest::addColumn<QFont>(name: "labelsFont" ); |
| 665 | QTest::newRow(dataTag: "null" ) << QFont(); |
| 666 | QTest::newRow(dataTag: "serif" ) << QFont("SansSerif" ); |
| 667 | } |
| 668 | |
| 669 | void tst_QAbstractAxis::labelsFont() |
| 670 | { |
| 671 | |
| 672 | QFETCH(QFont, labelsFont); |
| 673 | |
| 674 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 675 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 676 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 677 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 678 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 679 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 680 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 681 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 682 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 683 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 684 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 685 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 686 | |
| 687 | m_axis->setLabelsFont(labelsFont); |
| 688 | QCOMPARE(m_axis->labelsFont(), labelsFont); |
| 689 | |
| 690 | QCOMPARE(spy0.count(), 0); |
| 691 | QCOMPARE(spy1.count(), 0); |
| 692 | QCOMPARE(spy2.count(), 0); |
| 693 | QCOMPARE(spy3.count(), 0); |
| 694 | QCOMPARE(spy4.count(), 0); |
| 695 | QCOMPARE(spy5.count(), 0); |
| 696 | QCOMPARE(spy6.count(), 0); |
| 697 | QCOMPARE(spy7.count(), 0); |
| 698 | QCOMPARE(spy8.count(), 0); |
| 699 | QCOMPARE(spy9.count(), 0); |
| 700 | QCOMPARE(spy10.count(), 0); |
| 701 | QCOMPARE(spy11.count(), 0); |
| 702 | |
| 703 | m_view->show(); |
| 704 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 705 | QCOMPARE(m_axis->labelsFont(), labelsFont); |
| 706 | |
| 707 | } |
| 708 | |
| 709 | void tst_QAbstractAxis::labelsVisible_data() |
| 710 | { |
| 711 | QTest::addColumn<bool>(name: "labelsVisible" ); |
| 712 | QTest::newRow(dataTag: "true" ) << true; |
| 713 | QTest::newRow(dataTag: "false" ) << false; |
| 714 | } |
| 715 | |
| 716 | void tst_QAbstractAxis::labelsVisible() |
| 717 | { |
| 718 | QFETCH(bool, labelsVisible); |
| 719 | |
| 720 | m_axis->setLabelsVisible(!labelsVisible); |
| 721 | |
| 722 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 723 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 724 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 725 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 726 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 727 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 728 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 729 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 730 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 731 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 732 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 733 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 734 | |
| 735 | m_axis->setLabelsVisible(labelsVisible); |
| 736 | QCOMPARE(m_axis->labelsVisible(), labelsVisible); |
| 737 | |
| 738 | QCOMPARE(spy0.count(), 0); |
| 739 | QCOMPARE(spy1.count(), 0); |
| 740 | QCOMPARE(spy2.count(), 0); |
| 741 | QCOMPARE(spy3.count(), 0); |
| 742 | QCOMPARE(spy4.count(), 1); |
| 743 | QCOMPARE(spy5.count(), 0); |
| 744 | QCOMPARE(spy6.count(), 0); |
| 745 | QCOMPARE(spy7.count(), 0); |
| 746 | QCOMPARE(spy8.count(), 0); |
| 747 | QCOMPARE(spy9.count(), 0); |
| 748 | QCOMPARE(spy10.count(), 0); |
| 749 | QCOMPARE(spy11.count(), 0); |
| 750 | |
| 751 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 752 | m_series->attachAxis(axis: m_axis); |
| 753 | m_view->show(); |
| 754 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 755 | QCOMPARE(m_axis->labelsVisible(), labelsVisible); |
| 756 | } |
| 757 | |
| 758 | void tst_QAbstractAxis::orientation_data() |
| 759 | { |
| 760 | QTest::addColumn<Qt::Orientation>(name: "orientation" ); |
| 761 | QTest::newRow(dataTag: "Vertical" ) << Qt::Vertical; |
| 762 | QTest::newRow(dataTag: "Horizontal" ) << Qt::Horizontal; |
| 763 | } |
| 764 | |
| 765 | void tst_QAbstractAxis::orientation() |
| 766 | { |
| 767 | QFETCH(Qt::Orientation, orientation); |
| 768 | |
| 769 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 770 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 771 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 772 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 773 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 774 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 775 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 776 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 777 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 778 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 779 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 780 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 781 | |
| 782 | if(orientation==Qt::Vertical){ |
| 783 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignLeft); |
| 784 | m_series->attachAxis(axis: m_axis); |
| 785 | }else{ |
| 786 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 787 | m_series->attachAxis(axis: m_axis); |
| 788 | } |
| 789 | QCOMPARE(m_axis->orientation(), orientation); |
| 790 | |
| 791 | QCOMPARE(spy0.count(), 0); |
| 792 | QCOMPARE(spy1.count(), 0); |
| 793 | QCOMPARE(spy2.count(), 0); |
| 794 | QCOMPARE(spy3.count(), 0); |
| 795 | QCOMPARE(spy4.count(), 0); |
| 796 | QCOMPARE(spy5.count(), 0); |
| 797 | QCOMPARE(spy6.count(), 0); |
| 798 | QCOMPARE(spy7.count(), 0); |
| 799 | QCOMPARE(spy8.count(), 0); |
| 800 | QCOMPARE(spy9.count(), 0); |
| 801 | QCOMPARE(spy10.count(), 0); |
| 802 | QCOMPARE(spy11.count(), 0); |
| 803 | |
| 804 | m_view->show(); |
| 805 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 806 | QCOMPARE(m_axis->orientation(), orientation); |
| 807 | } |
| 808 | |
| 809 | void tst_QAbstractAxis::setMax_data() |
| 810 | { |
| 811 | //just check if it does not crash |
| 812 | QTest::addColumn<QVariant>(name: "max" ); |
| 813 | QTest::newRow(dataTag: "something" ) << QVariant("something" ); |
| 814 | QTest::newRow(dataTag: "1.0" ) << QVariant(1.0); |
| 815 | } |
| 816 | |
| 817 | void tst_QAbstractAxis::setMax() |
| 818 | { |
| 819 | QFETCH(QVariant, max); |
| 820 | m_axis->setMax(max); |
| 821 | } |
| 822 | |
| 823 | void tst_QAbstractAxis::setMin_data() |
| 824 | { |
| 825 | //just check if it does not crash |
| 826 | QTest::addColumn<QVariant>(name: "min" ); |
| 827 | QTest::newRow(dataTag: "something" ) << QVariant("something" ); |
| 828 | QTest::newRow(dataTag: "1.0" ) << QVariant(1.0); |
| 829 | } |
| 830 | |
| 831 | // public void setMin(QVariant const& min) |
| 832 | void tst_QAbstractAxis::setMin() |
| 833 | { |
| 834 | QFETCH(QVariant, min); |
| 835 | m_axis->setMin(min); |
| 836 | } |
| 837 | |
| 838 | void tst_QAbstractAxis::setRange_data() |
| 839 | { |
| 840 | //just check if it does not crash |
| 841 | QTest::addColumn<QVariant>(name: "min" ); |
| 842 | QTest::addColumn<QVariant>(name: "max" ); |
| 843 | QTest::newRow(dataTag: "something" ) << QVariant("something0" ) << QVariant("something1" ); |
| 844 | QTest::newRow(dataTag: "-1 1" ) << QVariant(-1.0) << QVariant(1.0); |
| 845 | } |
| 846 | |
| 847 | // public void setRange(QVariant const& min, QVariant const& max) |
| 848 | void tst_QAbstractAxis::setRange() |
| 849 | { |
| 850 | |
| 851 | QFETCH(QVariant, min); |
| 852 | QFETCH(QVariant, max); |
| 853 | m_axis->setRange(min,max); |
| 854 | } |
| 855 | |
| 856 | void tst_QAbstractAxis::shadesBorderColor_data() |
| 857 | { |
| 858 | |
| 859 | } |
| 860 | |
| 861 | void tst_QAbstractAxis::shadesBorderColor() |
| 862 | { |
| 863 | QSKIP("Test is not implemented. This is deprecated function" ); |
| 864 | } |
| 865 | |
| 866 | void tst_QAbstractAxis::shadesBrush_data() |
| 867 | { |
| 868 | QTest::addColumn<QBrush>(name: "shadesBrush" ); |
| 869 | QTest::newRow(dataTag: "null" ) << QBrush(); |
| 870 | QTest::newRow(dataTag: "blue" ) << QBrush(Qt::blue); |
| 871 | QTest::newRow(dataTag: "black" ) << QBrush(Qt::black); |
| 872 | } |
| 873 | |
| 874 | void tst_QAbstractAxis::shadesBrush() |
| 875 | { |
| 876 | QFETCH(QBrush, shadesBrush); |
| 877 | |
| 878 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 879 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 880 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 881 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 882 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 883 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 884 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 885 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 886 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 887 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 888 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 889 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 890 | |
| 891 | m_axis->setShadesBrush(shadesBrush); |
| 892 | QCOMPARE(m_axis->shadesBrush(), shadesBrush); |
| 893 | |
| 894 | QCOMPARE(spy0.count(), 0); |
| 895 | QCOMPARE(spy1.count(), 0); |
| 896 | QCOMPARE(spy2.count(), 0); |
| 897 | QCOMPARE(spy3.count(), 0); |
| 898 | QCOMPARE(spy4.count(), 0); |
| 899 | QCOMPARE(spy5.count(), 0); |
| 900 | //TODO QCOMPARE(spy6.count(), 0); |
| 901 | QCOMPARE(spy7.count(), 0); |
| 902 | QCOMPARE(spy8.count(), 0); |
| 903 | QCOMPARE(spy9.count(), 0); |
| 904 | QCOMPARE(spy10.count(), 0); |
| 905 | QCOMPARE(spy11.count(), 0); |
| 906 | |
| 907 | m_view->show(); |
| 908 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 909 | QCOMPARE(m_axis->shadesBrush(), shadesBrush); |
| 910 | } |
| 911 | |
| 912 | void tst_QAbstractAxis::shadesColor_data() |
| 913 | { |
| 914 | } |
| 915 | |
| 916 | // public QColor shadesColor() const |
| 917 | void tst_QAbstractAxis::shadesColor() |
| 918 | { |
| 919 | QSKIP("Test is not implemented. This is deprecated function" ); |
| 920 | } |
| 921 | |
| 922 | void tst_QAbstractAxis::shadesPen_data() |
| 923 | { |
| 924 | QTest::addColumn<QPen>(name: "shadesPen" ); |
| 925 | QTest::newRow(dataTag: "null" ) << QPen(); |
| 926 | QTest::newRow(dataTag: "blue" ) << QPen(Qt::blue); |
| 927 | QTest::newRow(dataTag: "black" ) << QPen(Qt::black); |
| 928 | QTest::newRow(dataTag: "red" ) << QPen(Qt::red); |
| 929 | } |
| 930 | |
| 931 | void tst_QAbstractAxis::shadesPen() |
| 932 | { |
| 933 | QFETCH(QPen, shadesPen); |
| 934 | |
| 935 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 936 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 937 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 938 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 939 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 940 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 941 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 942 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 943 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 944 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 945 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 946 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 947 | |
| 948 | m_axis->setShadesPen(shadesPen); |
| 949 | QCOMPARE(m_axis->shadesPen(), shadesPen); |
| 950 | |
| 951 | QCOMPARE(spy0.count(), 0); |
| 952 | QCOMPARE(spy1.count(), 0); |
| 953 | QCOMPARE(spy2.count(), 0); |
| 954 | QCOMPARE(spy3.count(), 0); |
| 955 | QCOMPARE(spy4.count(), 0); |
| 956 | QCOMPARE(spy5.count(), 0); |
| 957 | QCOMPARE(spy6.count(), 0); |
| 958 | QCOMPARE(spy7.count(), 0); |
| 959 | QCOMPARE(spy8.count(), 0); |
| 960 | QCOMPARE(spy9.count(), 0); |
| 961 | QCOMPARE(spy10.count(), 0); |
| 962 | QCOMPARE(spy11.count(), 0); |
| 963 | |
| 964 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 965 | m_series->attachAxis(axis: m_axis); |
| 966 | m_view->show(); |
| 967 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 968 | QCOMPARE(m_axis->shadesPen(), shadesPen); |
| 969 | } |
| 970 | |
| 971 | void tst_QAbstractAxis::shadesVisible_data() |
| 972 | { |
| 973 | QTest::addColumn<bool>(name: "shadesVisible" ); |
| 974 | QTest::newRow(dataTag: "true" ) << true; |
| 975 | QTest::newRow(dataTag: "false" ) << false; |
| 976 | } |
| 977 | |
| 978 | void tst_QAbstractAxis::shadesVisible() |
| 979 | { |
| 980 | QFETCH(bool, shadesVisible); |
| 981 | |
| 982 | m_axis->setShadesVisible(!shadesVisible); |
| 983 | |
| 984 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 985 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 986 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 987 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 988 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 989 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 990 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 991 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 992 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 993 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 994 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 995 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 996 | |
| 997 | m_axis->setShadesVisible(shadesVisible); |
| 998 | QCOMPARE(m_axis->shadesVisible(), shadesVisible); |
| 999 | |
| 1000 | QCOMPARE(spy0.count(), 0); |
| 1001 | QCOMPARE(spy1.count(), 0); |
| 1002 | QCOMPARE(spy2.count(), 0); |
| 1003 | QCOMPARE(spy3.count(), 0); |
| 1004 | QCOMPARE(spy4.count(), 0); |
| 1005 | QCOMPARE(spy5.count(), 0); |
| 1006 | QCOMPARE(spy6.count(), 0); |
| 1007 | QCOMPARE(spy7.count(), 1); |
| 1008 | QCOMPARE(spy8.count(), 0); |
| 1009 | QCOMPARE(spy9.count(), 0); |
| 1010 | QCOMPARE(spy10.count(), 0); |
| 1011 | QCOMPARE(spy11.count(), 0); |
| 1012 | |
| 1013 | m_chart->addAxis(axis: m_axis, alignment: Qt::AlignBottom); |
| 1014 | m_series->attachAxis(axis: m_axis); |
| 1015 | m_view->show(); |
| 1016 | QVERIFY(QTest::qWaitForWindowExposed(m_view)); |
| 1017 | QCOMPARE(m_axis->shadesVisible(), shadesVisible); |
| 1018 | } |
| 1019 | |
| 1020 | void tst_QAbstractAxis::show_data() |
| 1021 | { |
| 1022 | |
| 1023 | } |
| 1024 | |
| 1025 | void tst_QAbstractAxis::show() |
| 1026 | { |
| 1027 | m_axis->hide(); |
| 1028 | QCOMPARE(m_axis->isVisible(), false); |
| 1029 | |
| 1030 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 1031 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 1032 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 1033 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 1034 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 1035 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 1036 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 1037 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 1038 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 1039 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 1040 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 1041 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 1042 | |
| 1043 | m_axis->show(); |
| 1044 | |
| 1045 | QCOMPARE(spy0.count(), 0); |
| 1046 | QCOMPARE(spy1.count(), 0); |
| 1047 | QCOMPARE(spy2.count(), 0); |
| 1048 | QCOMPARE(spy3.count(), 0); |
| 1049 | QCOMPARE(spy4.count(), 0); |
| 1050 | QCOMPARE(spy5.count(), 0); |
| 1051 | QCOMPARE(spy6.count(), 0); |
| 1052 | QCOMPARE(spy7.count(), 0); |
| 1053 | QCOMPARE(spy8.count(), 1); |
| 1054 | QCOMPARE(spy9.count(), 0); |
| 1055 | QCOMPARE(spy10.count(), 0); |
| 1056 | QCOMPARE(spy11.count(), 0); |
| 1057 | QCOMPARE(m_axis->isVisible(), true); |
| 1058 | } |
| 1059 | |
| 1060 | void tst_QAbstractAxis::hide_data() |
| 1061 | { |
| 1062 | |
| 1063 | } |
| 1064 | |
| 1065 | void tst_QAbstractAxis::hide() |
| 1066 | { |
| 1067 | m_axis->show(); |
| 1068 | QCOMPARE(m_axis->isVisible(),true); |
| 1069 | |
| 1070 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
| 1071 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
| 1072 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); |
| 1073 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
| 1074 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
| 1075 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
| 1076 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
| 1077 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
| 1078 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
| 1079 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); |
| 1080 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); |
| 1081 | QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); |
| 1082 | |
| 1083 | m_axis->hide(); |
| 1084 | |
| 1085 | QCOMPARE(spy0.count(), 0); |
| 1086 | QCOMPARE(spy1.count(), 0); |
| 1087 | QCOMPARE(spy2.count(), 0); |
| 1088 | QCOMPARE(spy3.count(), 0); |
| 1089 | QCOMPARE(spy4.count(), 0); |
| 1090 | QCOMPARE(spy5.count(), 0); |
| 1091 | QCOMPARE(spy6.count(), 0); |
| 1092 | QCOMPARE(spy7.count(), 0); |
| 1093 | QCOMPARE(spy8.count(), 1); |
| 1094 | QCOMPARE(spy9.count(), 0); |
| 1095 | QCOMPARE(spy10.count(), 0); |
| 1096 | QCOMPARE(spy11.count(), 0); |
| 1097 | QCOMPARE(m_axis->isVisible(),false); |
| 1098 | } |
| 1099 | |
| 1100 | |
| 1101 | |
| 1102 | |
| 1103 | |
| 1104 | |
| 1105 | |
| 1106 | |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | |
| 1111 | |