tst_qabstractaxis.cpp
1083 lines
| 35.4 KiB
| text/x-c
|
CppLexer
|
r1699 | /**************************************************************************** | ||
** | ||||
|
r2776 | ** Copyright (C) 2015 The Qt Company Ltd | ||
|
r1699 | ** All rights reserved. | ||
|
r2776 | ** For any questions to The Qt Company, please use contact form at http://qt.io | ||
|
r1699 | ** | ||
|
r2740 | ** This file is part of the Qt Charts module. | ||
|
r1699 | ** | ||
|
r2740 | ** Licensees holding valid commercial license for Qt may use this file in | ||
** accordance with the Qt License Agreement provided with the Software | ||||
** or, alternatively, in accordance with the terms contained in a written | ||||
|
r2776 | ** agreement between you and The Qt Company. | ||
|
r1699 | ** | ||
** If you have questions regarding the use of this file, please use | ||||
|
r2740 | ** contact form at http://qt.io | ||
|
r1699 | ** | ||
****************************************************************************/ | ||||
#include "tst_qabstractaxis.h" | ||||
Q_DECLARE_METATYPE(QPen) | ||||
|
r1704 | Q_DECLARE_METATYPE(Qt::Orientation) | ||
|
r1699 | |||
void tst_QAbstractAxis::initTestCase() | ||||
{ | ||||
} | ||||
void tst_QAbstractAxis::cleanupTestCase() | ||||
{ | ||||
|
r2733 | QTest::qWait(1); // Allow final deleteLaters to run | ||
|
r1699 | } | ||
|
r1708 | void tst_QAbstractAxis::init(QAbstractAxis* axis, QAbstractSeries* series) | ||
|
r1699 | { | ||
m_axis = axis; | ||||
|
r1704 | m_series = series; | ||
|
r2483 | m_view = new QChartView(newQChartOrQPolarChart()); | ||
|
r1699 | m_chart = m_view->chart(); | ||
} | ||||
void tst_QAbstractAxis::cleanup() | ||||
{ | ||||
delete m_view; | ||||
m_view = 0; | ||||
m_chart = 0; | ||||
m_axis = 0; | ||||
} | ||||
void tst_QAbstractAxis::qabstractaxis() | ||||
{ | ||||
|
r1844 | QCOMPARE(m_axis->linePen(), QPen()); | ||
|
r1699 | QCOMPARE(m_axis->gridLinePen(), QPen()); | ||
|
r1844 | QCOMPARE(m_axis->isLineVisible(), true); | ||
|
r1699 | QCOMPARE(m_axis->isGridLineVisible(), true); | ||
|
r2266 | QCOMPARE(m_axis->isVisible(), true); | ||
|
r1699 | QCOMPARE(m_axis->labelsAngle(), 0); | ||
QCOMPARE(m_axis->labelsBrush(), QBrush()); | ||||
QCOMPARE(m_axis->labelsFont(), QFont()); | ||||
QCOMPARE(m_axis->labelsVisible(), true); | ||||
QCOMPARE(m_axis->orientation(), Qt::Orientation(0)); | ||||
|
r2795 | QCOMPARE(m_axis->minorGridLinePen(), QPen()); | ||
QCOMPARE(m_axis->isMinorGridLineVisible(), true); | ||||
|
r1844 | m_axis->setLineVisible(false); | ||
m_axis->setLinePen(QPen()); | ||||
m_axis->setLinePenColor(QColor()); | ||||
|
r1699 | m_axis->setGridLinePen(QPen()); | ||
m_axis->setGridLineVisible(false); | ||||
|
r2810 | m_axis->setGridLineColor(QColor()); | ||
m_axis->setMinorGridLineColor(QColor()); | ||||
|
r1699 | m_axis->setLabelsAngle(-1); | ||
m_axis->setLabelsBrush(QBrush()); | ||||
m_axis->setLabelsColor(QColor()); | ||||
m_axis->setLabelsFont(QFont()); | ||||
m_axis->setLabelsVisible(false); | ||||
m_axis->setMax(QVariant()); | ||||
m_axis->setMin(QVariant()); | ||||
m_axis->setRange(QVariant(), QVariant()); | ||||
m_axis->setShadesBorderColor(QColor()); | ||||
m_axis->setShadesBrush(QBrush()); | ||||
m_axis->setShadesColor(QColor()); | ||||
m_axis->setShadesPen(QPen()); | ||||
m_axis->setShadesVisible(false); | ||||
m_axis->setVisible(false); | ||||
|
r2795 | m_axis->setMinorGridLinePen(QPen()); | ||
m_axis->setMinorGridLineVisible(false); | ||||
|
r1699 | //TODO QCOMPARE(m_axis->shadesBrush(), QBrush()); | ||
QCOMPARE(m_axis->shadesPen(), QPen()); | ||||
QCOMPARE(m_axis->shadesVisible(), false); | ||||
m_axis->show(); | ||||
m_axis->hide(); | ||||
} | ||||
void tst_QAbstractAxis::axisPen_data() | ||||
{ | ||||
QTest::addColumn<QPen>("axisPen"); | ||||
QTest::newRow("null") << QPen(); | ||||
QTest::newRow("blue") << QPen(Qt::blue); | ||||
QTest::newRow("black") << QPen(Qt::black); | ||||
QTest::newRow("red") << QPen(Qt::red); | ||||
} | ||||
void tst_QAbstractAxis::axisPen() | ||||
{ | ||||
QFETCH(QPen, axisPen); | ||||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1699 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1699 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1844 | m_axis->setLinePen(axisPen); | ||
QCOMPARE(m_axis->linePen(), axisPen); | ||||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
QCOMPARE(spy8.count(), 0); | ||||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1699 | |||
|
r1704 | m_chart->setAxisX(m_axis, m_series); | ||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
//TODO QCOMPARE(m_axis->axisPen(), axisPen); | ||||
|
r1699 | } | ||
void tst_QAbstractAxis::axisPenColor_data() | ||||
{ | ||||
} | ||||
void tst_QAbstractAxis::axisPenColor() | ||||
{ | ||||
|
r2367 | QSKIP("Test is not implemented. This is deprecated function"); | ||
|
r1699 | } | ||
void tst_QAbstractAxis::gridLinePen_data() | ||||
{ | ||||
QTest::addColumn<QPen>("gridLinePen"); | ||||
QTest::newRow("null") << QPen(); | ||||
QTest::newRow("blue") << QPen(Qt::blue); | ||||
QTest::newRow("black") << QPen(Qt::black); | ||||
QTest::newRow("red") << QPen(Qt::red); | ||||
} | ||||
void tst_QAbstractAxis::gridLinePen() | ||||
{ | ||||
QFETCH(QPen, gridLinePen); | ||||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1699 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1699 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2810 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
m_axis->setGridLinePen(gridLinePen); | ||||
QCOMPARE(m_axis->gridLinePen(), gridLinePen); | ||||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
QCOMPARE(spy8.count(), 0); | ||||
|
r2810 | QCOMPARE(spy9.count(), 0); | ||
QCOMPARE(spy10.count(), 0); | ||||
QCOMPARE(spy11.count(), 0); | ||||
|
r1699 | |||
|
r1704 | m_chart->setAxisX(m_axis, m_series); | ||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
//TODO QCOMPARE(m_axis->gridLinePen(), gridLinePen); | ||||
|
r1699 | } | ||
|
r2795 | void tst_QAbstractAxis::minorGridLinePen_data() | ||
{ | ||||
QTest::addColumn<QPen>("minorGridLinePen"); | ||||
QTest::newRow("null") << QPen(); | ||||
QTest::newRow("blue") << QPen(Qt::blue); | ||||
QTest::newRow("black") << QPen(Qt::black); | ||||
QTest::newRow("red") << QPen(Qt::red); | ||||
} | ||||
void tst_QAbstractAxis::minorGridLinePen() | ||||
{ | ||||
QFETCH(QPen, minorGridLinePen); | ||||
QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||||
QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||||
QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||||
QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r2795 | |||
m_axis->setMinorGridLinePen(minorGridLinePen); | ||||
QCOMPARE(m_axis->minorGridLinePen(), minorGridLinePen); | ||||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
QCOMPARE(spy8.count(), 0); | ||||
QCOMPARE(spy9.count(), 0); | ||||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r2795 | |||
m_chart->setAxisX(m_axis, m_series); | ||||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
} | ||||
|
r1845 | void tst_QAbstractAxis::lineVisible_data() | ||
|
r1699 | { | ||
|
r1845 | QTest::addColumn<bool>("lineVisible"); | ||
|
r1699 | QTest::newRow("true") << true; | ||
QTest::newRow("false") << false; | ||||
} | ||||
|
r1845 | void tst_QAbstractAxis::lineVisible() | ||
|
r1699 | { | ||
|
r1845 | QFETCH(bool, lineVisible); | ||
|
r1699 | |||
|
r1845 | m_axis->setLineVisible(!lineVisible); | ||
|
r1699 | |||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1845 | m_axis->setLineVisible(lineVisible); | ||
QCOMPARE(m_axis->isLineVisible(), lineVisible); | ||||
|
r1699 | |||
|
r1704 | QCOMPARE(spy0.count(), 1); | ||
|
r1699 | QCOMPARE(spy1.count(), 0); | ||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
QCOMPARE(spy8.count(), 0); | ||||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1704 | |||
m_chart->setAxisX(m_axis, m_series); | ||||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
|
r1845 | QCOMPARE(m_axis->isLineVisible(), lineVisible); | ||
|
r1699 | } | ||
|
r1704 | void tst_QAbstractAxis::gridLineVisible_data() | ||
|
r1699 | { | ||
|
r1704 | QTest::addColumn<bool>("gridLineVisible"); | ||
|
r1699 | QTest::newRow("true") << true; | ||
QTest::newRow("false") << false; | ||||
} | ||||
|
r1704 | void tst_QAbstractAxis::gridLineVisible() | ||
|
r1699 | { | ||
|
r1704 | QFETCH(bool, gridLineVisible); | ||
|
r1699 | |||
|
r1704 | m_axis->setGridLineVisible(!gridLineVisible); | ||
|
r1699 | |||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2810 | QSignalSpy spy9(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
|
r1699 | |||
|
r1704 | m_axis->setGridLineVisible(gridLineVisible); | ||
QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible); | ||||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
|
r1704 | QCOMPARE(spy2.count(), 1); | ||
|
r1699 | QCOMPARE(spy3.count(), 0); | ||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
QCOMPARE(spy8.count(), 0); | ||||
|
r2810 | QCOMPARE(spy9.count(), 0); | ||
|
r1704 | |||
m_chart->setAxisX(m_axis, m_series); | ||||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible); | ||||
|
r1699 | } | ||
|
r2795 | void tst_QAbstractAxis::minorGridLineVisible_data() | ||
{ | ||||
QTest::addColumn<bool>("minorGridLineVisible"); | ||||
QTest::newRow("true") << true; | ||||
QTest::newRow("false") << false; | ||||
} | ||||
void tst_QAbstractAxis::minorGridLineVisible() | ||||
{ | ||||
QFETCH(bool, minorGridLineVisible); | ||||
m_axis->setMinorGridLineVisible(!minorGridLineVisible); | ||||
QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||||
QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||||
QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||||
QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r2795 | |||
m_axis->setMinorGridLineVisible(minorGridLineVisible); | ||||
QCOMPARE(m_axis->isMinorGridLineVisible(), minorGridLineVisible); | ||||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
QCOMPARE(spy8.count(), 0); | ||||
QCOMPARE(spy9.count(), 1); | ||||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r2795 | |||
m_chart->setAxisX(m_axis, m_series); | ||||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
QCOMPARE(m_axis->isMinorGridLineVisible(), minorGridLineVisible); | ||||
} | ||||
|
r2810 | void tst_QAbstractAxis::gridLineColor_data() | ||
{ | ||||
QTest::addColumn<QColor>("gridLineColor"); | ||||
QTest::newRow("blue") << QColor(Qt::blue); | ||||
QTest::newRow("red") << QColor(Qt::red); | ||||
QTest::newRow("yellow") << QColor(Qt::yellow); | ||||
} | ||||
void tst_QAbstractAxis::gridLineColor() | ||||
{ | ||||
QFETCH(QColor, gridLineColor); | ||||
QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||||
QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||||
QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||||
QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||||
QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
m_axis->setGridLineColor(gridLineColor); | ||||
QCOMPARE(m_axis->gridLineColor(), gridLineColor); | ||||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
QCOMPARE(spy8.count(), 0); | ||||
QCOMPARE(spy9.count(), 0); | ||||
QCOMPARE(spy10.count(), 1); | ||||
QCOMPARE(spy11.count(), 0); | ||||
m_chart->setAxisX(m_axis, m_series); | ||||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
} | ||||
void tst_QAbstractAxis::minorGridLineColor_data() | ||||
{ | ||||
QTest::addColumn<QColor>("minorGridLineColor"); | ||||
QTest::newRow("blue") << QColor(Qt::blue); | ||||
QTest::newRow("red") << QColor(Qt::red); | ||||
QTest::newRow("yellow") << QColor(Qt::yellow); | ||||
} | ||||
void tst_QAbstractAxis::minorGridLineColor() | ||||
{ | ||||
QFETCH(QColor, minorGridLineColor); | ||||
QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||||
QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||||
QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||||
QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||||
QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
m_axis->setMinorGridLineColor(minorGridLineColor); | ||||
QCOMPARE(m_axis->minorGridLineColor(), minorGridLineColor); | ||||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
QCOMPARE(spy8.count(), 0); | ||||
QCOMPARE(spy9.count(), 0); | ||||
QCOMPARE(spy10.count(), 0); | ||||
QCOMPARE(spy11.count(), 1); | ||||
m_chart->setAxisX(m_axis, m_series); | ||||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
} | ||||
|
r1704 | void tst_QAbstractAxis::visible_data() | ||
|
r1699 | { | ||
|
r1704 | QTest::addColumn<bool>("visible"); | ||
|
r1699 | QTest::newRow("true") << true; | ||
QTest::newRow("false") << false; | ||||
} | ||||
|
r1704 | void tst_QAbstractAxis::visible() | ||
|
r1699 | { | ||
|
r1704 | QFETCH(bool, visible); | ||
|
r1699 | |||
|
r1704 | m_axis->setVisible(!visible); | ||
|
r1699 | |||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1704 | m_axis->setVisible(visible); | ||
QCOMPARE(m_axis->isVisible(), visible); | ||||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
|
r1704 | QCOMPARE(spy8.count(), 1); | ||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1704 | |||
m_chart->setAxisX(m_axis, m_series); | ||||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
|
r2266 | QCOMPARE(m_axis->isVisible(), visible); | ||
|
r1699 | } | ||
void tst_QAbstractAxis::labelsAngle_data() | ||||
{ | ||||
QTest::addColumn<int>("labelsAngle"); | ||||
QTest::newRow("0") << 0; | ||||
|
r1704 | QTest::newRow("45") << 45; | ||
QTest::newRow("90") << 90; | ||||
|
r1699 | } | ||
void tst_QAbstractAxis::labelsAngle() | ||||
{ | ||||
QFETCH(int, labelsAngle); | ||||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1704 | m_axis->setLabelsAngle(labelsAngle); | ||
QCOMPARE(m_axis->labelsAngle(), labelsAngle); | ||||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
QCOMPARE(spy8.count(), 0); | ||||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1704 | |||
m_chart->setAxisX(m_axis, m_series); | ||||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
QCOMPARE(m_axis->labelsAngle(), labelsAngle); | ||||
|
r1699 | } | ||
void tst_QAbstractAxis::labelsBrush_data() | ||||
{ | ||||
QTest::addColumn<QBrush>("labelsBrush"); | ||||
QTest::newRow("null") << QBrush(); | ||||
|
r1704 | QTest::newRow("blue") << QBrush(Qt::blue); | ||
QTest::newRow("black") << QBrush(Qt::black); | ||||
|
r1699 | } | ||
void tst_QAbstractAxis::labelsBrush() | ||||
{ | ||||
|
r1704 | QFETCH(QBrush, labelsBrush); | ||
|
r1699 | |||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1704 | m_axis->setLabelsBrush(labelsBrush); | ||
QCOMPARE(m_axis->labelsBrush(), labelsBrush); | ||||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
|
r1704 | //TODO QCOMPARE(spy6.count(), 0); | ||
|
r1699 | QCOMPARE(spy7.count(), 0); | ||
QCOMPARE(spy8.count(), 0); | ||||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1704 | |||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
QCOMPARE(m_axis->labelsBrush(), labelsBrush); | ||||
|
r1699 | } | ||
void tst_QAbstractAxis::labelsColor_data() | ||||
{ | ||||
|
r1704 | |||
|
r1699 | } | ||
void tst_QAbstractAxis::labelsColor() | ||||
{ | ||||
|
r2367 | QSKIP("Test is not implemented. This is deprecated function"); | ||
|
r1699 | } | ||
void tst_QAbstractAxis::labelsFont_data() | ||||
{ | ||||
QTest::addColumn<QFont>("labelsFont"); | ||||
QTest::newRow("null") << QFont(); | ||||
|
r1704 | QTest::newRow("serif") << QFont("SansSerif"); | ||
|
r1699 | } | ||
void tst_QAbstractAxis::labelsFont() | ||||
{ | ||||
|
r1704 | QFETCH(QFont, labelsFont); | ||
|
r1699 | |||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1704 | m_axis->setLabelsFont(labelsFont); | ||
QCOMPARE(m_axis->labelsFont(), labelsFont); | ||||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
QCOMPARE(spy8.count(), 0); | ||||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1704 | |||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
QCOMPARE(m_axis->labelsFont(), labelsFont); | ||||
|
r1699 | } | ||
void tst_QAbstractAxis::labelsVisible_data() | ||||
{ | ||||
QTest::addColumn<bool>("labelsVisible"); | ||||
QTest::newRow("true") << true; | ||||
QTest::newRow("false") << false; | ||||
} | ||||
void tst_QAbstractAxis::labelsVisible() | ||||
{ | ||||
QFETCH(bool, labelsVisible); | ||||
|
r1704 | m_axis->setLabelsVisible(!labelsVisible); | ||
|
r1699 | |||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1704 | m_axis->setLabelsVisible(labelsVisible); | ||
QCOMPARE(m_axis->labelsVisible(), labelsVisible); | ||||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
|
r1704 | QCOMPARE(spy4.count(), 1); | ||
|
r1699 | QCOMPARE(spy5.count(), 0); | ||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
QCOMPARE(spy8.count(), 0); | ||||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1704 | |||
m_chart->setAxisX(m_axis, m_series); | ||||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
QCOMPARE(m_axis->labelsVisible(), labelsVisible); | ||||
|
r1699 | } | ||
void tst_QAbstractAxis::orientation_data() | ||||
{ | ||||
QTest::addColumn<Qt::Orientation>("orientation"); | ||||
|
r1704 | QTest::newRow("Vertical") << Qt::Vertical; | ||
QTest::newRow("Horizontal") << Qt::Horizontal; | ||||
|
r1699 | } | ||
void tst_QAbstractAxis::orientation() | ||||
{ | ||||
QFETCH(Qt::Orientation, orientation); | ||||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1704 | if(orientation==Qt::Vertical){ | ||
m_chart->setAxisY(m_axis,m_series); | ||||
}else{ | ||||
m_chart->setAxisX(m_axis,m_series); | ||||
} | ||||
QCOMPARE(m_axis->orientation(), orientation); | ||||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
|
r2382 | QCOMPARE(spy8.count(), 0); | ||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1704 | |||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
QCOMPARE(m_axis->orientation(), orientation); | ||||
|
r1699 | } | ||
|
r1704 | void tst_QAbstractAxis::setMax_data() | ||
|
r1699 | { | ||
|
r1704 | //just check if it does not crash | ||
QTest::addColumn<QVariant>("max"); | ||||
QTest::newRow("something") << QVariant("something"); | ||||
QTest::newRow("1.0") << QVariant(1.0); | ||||
|
r1699 | } | ||
|
r1704 | void tst_QAbstractAxis::setMax() | ||
|
r1699 | { | ||
|
r1704 | QFETCH(QVariant, max); | ||
m_axis->setMax(max); | ||||
} | ||||
|
r1699 | |||
|
r1704 | void tst_QAbstractAxis::setMin_data() | ||
{ | ||||
//just check if it does not crash | ||||
QTest::addColumn<QVariant>("min"); | ||||
QTest::newRow("something") << QVariant("something"); | ||||
QTest::newRow("1.0") << QVariant(1.0); | ||||
} | ||||
|
r1699 | |||
|
r1704 | // public void setMin(QVariant const& min) | ||
void tst_QAbstractAxis::setMin() | ||||
{ | ||||
QFETCH(QVariant, min); | ||||
m_axis->setMin(min); | ||||
} | ||||
|
r1699 | |||
|
r1704 | void tst_QAbstractAxis::setRange_data() | ||
{ | ||||
//just check if it does not crash | ||||
QTest::addColumn<QVariant>("min"); | ||||
QTest::addColumn<QVariant>("max"); | ||||
QTest::newRow("something") << QVariant("something0") << QVariant("something1"); | ||||
QTest::newRow("-1 1") << QVariant(-1.0) << QVariant(1.0); | ||||
} | ||||
|
r1699 | |||
|
r1704 | // public void setRange(QVariant const& min, QVariant const& max) | ||
void tst_QAbstractAxis::setRange() | ||||
{ | ||||
QFETCH(QVariant, min); | ||||
QFETCH(QVariant, max); | ||||
m_axis->setRange(min,max); | ||||
|
r1699 | } | ||
|
r1704 | void tst_QAbstractAxis::shadesBorderColor_data() | ||
|
r1699 | { | ||
|
r1704 | |||
} | ||||
void tst_QAbstractAxis::shadesBorderColor() | ||||
{ | ||||
|
r2367 | QSKIP("Test is not implemented. This is deprecated function"); | ||
|
r1699 | } | ||
|
r1704 | void tst_QAbstractAxis::shadesBrush_data() | ||
|
r1699 | { | ||
|
r1704 | QTest::addColumn<QBrush>("shadesBrush"); | ||
QTest::newRow("null") << QBrush(); | ||||
QTest::newRow("blue") << QBrush(Qt::blue); | ||||
QTest::newRow("black") << QBrush(Qt::black); | ||||
} | ||||
|
r1699 | |||
|
r1704 | void tst_QAbstractAxis::shadesBrush() | ||
{ | ||||
QFETCH(QBrush, shadesBrush); | ||||
|
r1699 | |||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1704 | m_axis->setShadesBrush(shadesBrush); | ||
QCOMPARE(m_axis->shadesBrush(), shadesBrush); | ||||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
|
r1704 | //TODO QCOMPARE(spy6.count(), 0); | ||
|
r1699 | QCOMPARE(spy7.count(), 0); | ||
QCOMPARE(spy8.count(), 0); | ||||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1704 | |||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
QCOMPARE(m_axis->shadesBrush(), shadesBrush); | ||||
} | ||||
void tst_QAbstractAxis::shadesColor_data() | ||||
{ | ||||
|
r1699 | } | ||
|
r1704 | // public QColor shadesColor() const | ||
void tst_QAbstractAxis::shadesColor() | ||||
|
r1699 | { | ||
|
r2367 | QSKIP("Test is not implemented. This is deprecated function"); | ||
|
r1699 | } | ||
|
r1704 | void tst_QAbstractAxis::shadesPen_data() | ||
|
r1699 | { | ||
|
r1704 | QTest::addColumn<QPen>("shadesPen"); | ||
QTest::newRow("null") << QPen(); | ||||
QTest::newRow("blue") << QPen(Qt::blue); | ||||
QTest::newRow("black") << QPen(Qt::black); | ||||
QTest::newRow("red") << QPen(Qt::red); | ||||
} | ||||
|
r1699 | |||
|
r1704 | void tst_QAbstractAxis::shadesPen() | ||
{ | ||||
QFETCH(QPen, shadesPen); | ||||
|
r1699 | |||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1704 | m_axis->setShadesPen(shadesPen); | ||
QCOMPARE(m_axis->shadesPen(), shadesPen); | ||||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
QCOMPARE(spy8.count(), 0); | ||||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1699 | |||
|
r1704 | m_chart->setAxisX(m_axis, m_series); | ||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
QCOMPARE(m_axis->shadesPen(), shadesPen); | ||||
|
r1699 | } | ||
|
r1704 | void tst_QAbstractAxis::shadesVisible_data() | ||
|
r1699 | { | ||
QTest::addColumn<bool>("shadesVisible"); | ||||
QTest::newRow("true") << true; | ||||
QTest::newRow("false") << false; | ||||
} | ||||
void tst_QAbstractAxis::shadesVisible() | ||||
{ | ||||
QFETCH(bool, shadesVisible); | ||||
|
r1704 | m_axis->setShadesVisible(!shadesVisible); | ||
|
r1699 | |||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1704 | m_axis->setShadesVisible(shadesVisible); | ||
QCOMPARE(m_axis->shadesVisible(), shadesVisible); | ||||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
|
r1704 | QCOMPARE(spy7.count(), 1); | ||
|
r1699 | QCOMPARE(spy8.count(), 0); | ||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1699 | |||
|
r1704 | m_chart->setAxisX(m_axis, m_series); | ||
m_view->show(); | ||||
QTest::qWaitForWindowShown(m_view); | ||||
QCOMPARE(m_axis->shadesVisible(), shadesVisible); | ||||
|
r1699 | } | ||
|
r1704 | void tst_QAbstractAxis::show_data() | ||
|
r1699 | { | ||
} | ||||
|
r1704 | void tst_QAbstractAxis::show() | ||
|
r1699 | { | ||
|
r1704 | m_axis->hide(); | ||
QCOMPARE(m_axis->isVisible(), false); | ||||
|
r1699 | |||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1704 | m_axis->show(); | ||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
|
r1704 | QCOMPARE(spy8.count(), 1); | ||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1704 | QCOMPARE(m_axis->isVisible(), true); | ||
|
r1699 | } | ||
|
r1704 | void tst_QAbstractAxis::hide_data() | ||
|
r1699 | { | ||
} | ||||
|
r1704 | void tst_QAbstractAxis::hide() | ||
|
r1699 | { | ||
|
r1704 | m_axis->show(); | ||
QCOMPARE(m_axis->isVisible(),true); | ||||
|
r1699 | |||
|
r1845 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | ||
|
r2282 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | ||
|
r1704 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | ||
QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | ||||
QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | ||||
QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | ||||
QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | ||||
QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | ||||
|
r2795 | QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool))); | ||
|
r2810 | QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor))); | ||
QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor))); | ||||
|
r1699 | |||
|
r1704 | m_axis->hide(); | ||
|
r1699 | |||
QCOMPARE(spy0.count(), 0); | ||||
QCOMPARE(spy1.count(), 0); | ||||
QCOMPARE(spy2.count(), 0); | ||||
QCOMPARE(spy3.count(), 0); | ||||
QCOMPARE(spy4.count(), 0); | ||||
QCOMPARE(spy5.count(), 0); | ||||
QCOMPARE(spy6.count(), 0); | ||||
QCOMPARE(spy7.count(), 0); | ||||
|
r1704 | QCOMPARE(spy8.count(), 1); | ||
|
r2795 | QCOMPARE(spy9.count(), 0); | ||
|
r2810 | QCOMPARE(spy10.count(), 0); | ||
QCOMPARE(spy11.count(), 0); | ||||
|
r1704 | QCOMPARE(m_axis->isVisible(),false); | ||
|
r1699 | } | ||