##// END OF EJS Templates
QAbstractAxis: fixed tests after renaming
Marek Rosa -
r1845:0282556dc0a1
parent child
Show More
@@ -1,143 +1,143
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #ifndef QABSTRACTAXIS_H
21 #ifndef QABSTRACTAXIS_H
22 #define QABSTRACTAXIS_H
22 #define QABSTRACTAXIS_H
23
23
24 #include <qchartglobal.h>
24 #include <qchartglobal.h>
25 #include <QPen>
25 #include <QPen>
26 #include <QFont>
26 #include <QFont>
27 #include <QVariant>
27 #include <QVariant>
28
28
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
30
31 class QAbstractAxisPrivate;
31 class QAbstractAxisPrivate;
32
32
33 class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject
33 class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject
34 {
34 {
35 Q_OBJECT
35 Q_OBJECT
36 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
36 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
37 Q_PROPERTY(bool arrowVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged)
37 Q_PROPERTY(bool lineVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged)
38 Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged)
38 Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged)
39 Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
39 Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
40 Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle)
40 Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle)
41 Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont)
41 Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont)
42 Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged)
42 Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged)
43 Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged)
43 Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged)
44 Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged)
44 Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged)
45 Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged)
45 Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged)
46 Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged)
46 Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged)
47
47
48 public:
48 public:
49
49
50 enum AxisType {
50 enum AxisType {
51 AxisTypeNoAxis = 0x0,
51 AxisTypeNoAxis = 0x0,
52 AxisTypeValue = 0x1,
52 AxisTypeValue = 0x1,
53 AxisTypeBarCategory = 0x2,
53 AxisTypeBarCategory = 0x2,
54 AxisTypeCategory = 0x3,
54 AxisTypeCategory = 0x3,
55 AxisTypeDateTime = 0x4
55 AxisTypeDateTime = 0x4
56 };
56 };
57
57
58 Q_DECLARE_FLAGS(AxisTypes, AxisType)
58 Q_DECLARE_FLAGS(AxisTypes, AxisType)
59
59
60 protected:
60 protected:
61 explicit QAbstractAxis(QAbstractAxisPrivate &d,QObject *parent = 0);
61 explicit QAbstractAxis(QAbstractAxisPrivate &d,QObject *parent = 0);
62
62
63 public:
63 public:
64 ~QAbstractAxis();
64 ~QAbstractAxis();
65
65
66 virtual AxisType type() const = 0;
66 virtual AxisType type() const = 0;
67
67
68 //visibilty hadnling
68 //visibilty hadnling
69 bool isVisible() const;
69 bool isVisible() const;
70 void setVisible(bool visible = true);
70 void setVisible(bool visible = true);
71
71
72
72
73 //axis handling
73 //axis handling
74 bool isLineVisible() const;
74 bool isLineVisible() const;
75 void setLineVisible(bool visible = true);
75 void setLineVisible(bool visible = true);
76 void setLinePen(const QPen &pen);
76 void setLinePen(const QPen &pen);
77 QPen linePen() const;
77 QPen linePen() const;
78 void setLinePenColor(QColor color);
78 void setLinePenColor(QColor color);
79 QColor linePenColor() const;
79 QColor linePenColor() const;
80
80
81 //grid handling
81 //grid handling
82 bool isGridLineVisible() const;
82 bool isGridLineVisible() const;
83 void setGridLineVisible(bool visible = true);
83 void setGridLineVisible(bool visible = true);
84 void setGridLinePen(const QPen &pen);
84 void setGridLinePen(const QPen &pen);
85 QPen gridLinePen() const;
85 QPen gridLinePen() const;
86
86
87 //labels handling
87 //labels handling
88 bool labelsVisible() const;
88 bool labelsVisible() const;
89 void setLabelsVisible(bool visible = true);
89 void setLabelsVisible(bool visible = true);
90 void setLabelsPen(const QPen &pen);
90 void setLabelsPen(const QPen &pen);
91 QPen labelsPen() const;
91 QPen labelsPen() const;
92 void setLabelsBrush(const QBrush &brush);
92 void setLabelsBrush(const QBrush &brush);
93 QBrush labelsBrush() const;
93 QBrush labelsBrush() const;
94 void setLabelsFont(const QFont &font);
94 void setLabelsFont(const QFont &font);
95 QFont labelsFont() const;
95 QFont labelsFont() const;
96 void setLabelsAngle(int angle);
96 void setLabelsAngle(int angle);
97 int labelsAngle() const;
97 int labelsAngle() const;
98 void setLabelsColor(QColor color);
98 void setLabelsColor(QColor color);
99 QColor labelsColor() const;
99 QColor labelsColor() const;
100
100
101 //shades handling
101 //shades handling
102 bool shadesVisible() const;
102 bool shadesVisible() const;
103 void setShadesVisible(bool visible = true);
103 void setShadesVisible(bool visible = true);
104 void setShadesPen(const QPen &pen);
104 void setShadesPen(const QPen &pen);
105 QPen shadesPen() const;
105 QPen shadesPen() const;
106 void setShadesBrush(const QBrush &brush);
106 void setShadesBrush(const QBrush &brush);
107 QBrush shadesBrush() const;
107 QBrush shadesBrush() const;
108 void setShadesColor(QColor color);
108 void setShadesColor(QColor color);
109 QColor shadesColor() const;
109 QColor shadesColor() const;
110 void setShadesBorderColor(QColor color);
110 void setShadesBorderColor(QColor color);
111 QColor shadesBorderColor() const;
111 QColor shadesBorderColor() const;
112
112
113 Qt::Orientation orientation();
113 Qt::Orientation orientation();
114
114
115 //range handling
115 //range handling
116 void setMin(const QVariant &min);
116 void setMin(const QVariant &min);
117 void setMax(const QVariant &max);
117 void setMax(const QVariant &max);
118 void setRange(const QVariant &min, const QVariant &max);
118 void setRange(const QVariant &min, const QVariant &max);
119
119
120 void show();
120 void show();
121 void hide();
121 void hide();
122
122
123 Q_SIGNALS:
123 Q_SIGNALS:
124 void visibleChanged(bool visible);
124 void visibleChanged(bool visible);
125 void lineVisibleChanged(bool visible);
125 void lineVisibleChanged(bool visible);
126 void labelsVisibleChanged(bool visible);
126 void labelsVisibleChanged(bool visible);
127 void gridVisibleChanged(bool visible);
127 void gridVisibleChanged(bool visible);
128 void colorChanged(QColor color);
128 void colorChanged(QColor color);
129 void labelsColorChanged(QColor color);
129 void labelsColorChanged(QColor color);
130 void shadesVisibleChanged(bool visible);
130 void shadesVisibleChanged(bool visible);
131 void shadesColorChanged(QColor color);
131 void shadesColorChanged(QColor color);
132 void shadesBorderColorChanged(QColor color);
132 void shadesBorderColorChanged(QColor color);
133
133
134 protected:
134 protected:
135 QScopedPointer<QAbstractAxisPrivate> d_ptr;
135 QScopedPointer<QAbstractAxisPrivate> d_ptr;
136 Q_DISABLE_COPY(QAbstractAxis)
136 Q_DISABLE_COPY(QAbstractAxis)
137 friend class ChartDataSet;
137 friend class ChartDataSet;
138 friend class ChartAxis;
138 friend class ChartAxis;
139 friend class ChartPresenter;
139 friend class ChartPresenter;
140 };
140 };
141
141
142 QTCOMMERCIALCHART_END_NAMESPACE
142 QTCOMMERCIALCHART_END_NAMESPACE
143 #endif
143 #endif
@@ -1,847 +1,847
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include "tst_qabstractaxis.h"
21 #include "tst_qabstractaxis.h"
22
22
23 Q_DECLARE_METATYPE(QPen)
23 Q_DECLARE_METATYPE(QPen)
24 Q_DECLARE_METATYPE(Qt::Orientation)
24 Q_DECLARE_METATYPE(Qt::Orientation)
25
25
26 void tst_QAbstractAxis::initTestCase()
26 void tst_QAbstractAxis::initTestCase()
27 {
27 {
28 }
28 }
29
29
30 void tst_QAbstractAxis::cleanupTestCase()
30 void tst_QAbstractAxis::cleanupTestCase()
31 {
31 {
32 }
32 }
33
33
34 void tst_QAbstractAxis::init(QAbstractAxis* axis, QAbstractSeries* series)
34 void tst_QAbstractAxis::init(QAbstractAxis* axis, QAbstractSeries* series)
35 {
35 {
36 m_axis = axis;
36 m_axis = axis;
37 m_series = series;
37 m_series = series;
38 m_view = new QChartView(new QChart());
38 m_view = new QChartView(new QChart());
39 m_chart = m_view->chart();
39 m_chart = m_view->chart();
40 }
40 }
41
41
42 void tst_QAbstractAxis::cleanup()
42 void tst_QAbstractAxis::cleanup()
43 {
43 {
44 delete m_view;
44 delete m_view;
45 m_view = 0;
45 m_view = 0;
46 m_chart = 0;
46 m_chart = 0;
47 m_axis = 0;
47 m_axis = 0;
48 }
48 }
49
49
50 void tst_QAbstractAxis::qabstractaxis()
50 void tst_QAbstractAxis::qabstractaxis()
51 {
51 {
52 QCOMPARE(m_axis->linePen(), QPen());
52 QCOMPARE(m_axis->linePen(), QPen());
53 //TODO QCOMPARE(m_axis->axisPenColor(), QColor());
53 //TODO QCOMPARE(m_axis->axisPenColor(), QColor());
54 QCOMPARE(m_axis->gridLinePen(), QPen());
54 QCOMPARE(m_axis->gridLinePen(), QPen());
55 QCOMPARE(m_axis->isLineVisible(), true);
55 QCOMPARE(m_axis->isLineVisible(), true);
56 QCOMPARE(m_axis->isGridLineVisible(), true);
56 QCOMPARE(m_axis->isGridLineVisible(), true);
57 QCOMPARE(m_axis->isVisible(), false);
57 QCOMPARE(m_axis->isVisible(), false);
58 QCOMPARE(m_axis->labelsAngle(), 0);
58 QCOMPARE(m_axis->labelsAngle(), 0);
59 QCOMPARE(m_axis->labelsBrush(), QBrush());
59 QCOMPARE(m_axis->labelsBrush(), QBrush());
60 //TODO QCOMPARE(m_axis->labelsColor(), QColor());
60 //TODO QCOMPARE(m_axis->labelsColor(), QColor());
61 QCOMPARE(m_axis->labelsFont(), QFont());
61 QCOMPARE(m_axis->labelsFont(), QFont());
62 QCOMPARE(m_axis->labelsPen(), QPen());
62 QCOMPARE(m_axis->labelsPen(), QPen());
63 QCOMPARE(m_axis->labelsVisible(), true);
63 QCOMPARE(m_axis->labelsVisible(), true);
64 QCOMPARE(m_axis->orientation(), Qt::Orientation(0));
64 QCOMPARE(m_axis->orientation(), Qt::Orientation(0));
65 m_axis->setLineVisible(false);
65 m_axis->setLineVisible(false);
66 m_axis->setLinePen(QPen());
66 m_axis->setLinePen(QPen());
67 m_axis->setLinePenColor(QColor());
67 m_axis->setLinePenColor(QColor());
68 m_axis->setGridLinePen(QPen());
68 m_axis->setGridLinePen(QPen());
69 m_axis->setGridLineVisible(false);
69 m_axis->setGridLineVisible(false);
70 m_axis->setLabelsAngle(-1);
70 m_axis->setLabelsAngle(-1);
71 m_axis->setLabelsBrush(QBrush());
71 m_axis->setLabelsBrush(QBrush());
72 m_axis->setLabelsColor(QColor());
72 m_axis->setLabelsColor(QColor());
73 m_axis->setLabelsFont(QFont());
73 m_axis->setLabelsFont(QFont());
74 m_axis->setLabelsPen(QPen());
74 m_axis->setLabelsPen(QPen());
75 m_axis->setLabelsVisible(false);
75 m_axis->setLabelsVisible(false);
76 m_axis->setMax(QVariant());
76 m_axis->setMax(QVariant());
77 m_axis->setMin(QVariant());
77 m_axis->setMin(QVariant());
78 m_axis->setRange(QVariant(), QVariant());
78 m_axis->setRange(QVariant(), QVariant());
79 m_axis->setShadesBorderColor(QColor());
79 m_axis->setShadesBorderColor(QColor());
80 m_axis->setShadesBrush(QBrush());
80 m_axis->setShadesBrush(QBrush());
81 m_axis->setShadesColor(QColor());
81 m_axis->setShadesColor(QColor());
82 m_axis->setShadesPen(QPen());
82 m_axis->setShadesPen(QPen());
83 m_axis->setShadesVisible(false);
83 m_axis->setShadesVisible(false);
84 m_axis->setVisible(false);
84 m_axis->setVisible(false);
85 //TODO QCOMPARE(m_axis->shadesBorderColor(), QColor());
85 //TODO QCOMPARE(m_axis->shadesBorderColor(), QColor());
86 //TODO QCOMPARE(m_axis->shadesBrush(), QBrush());
86 //TODO QCOMPARE(m_axis->shadesBrush(), QBrush());
87 //TODO QCOMPARE(m_axis->shadesColor(), QColor());
87 //TODO QCOMPARE(m_axis->shadesColor(), QColor());
88 QCOMPARE(m_axis->shadesPen(), QPen());
88 QCOMPARE(m_axis->shadesPen(), QPen());
89 QCOMPARE(m_axis->shadesVisible(), false);
89 QCOMPARE(m_axis->shadesVisible(), false);
90 m_axis->show();
90 m_axis->show();
91 m_axis->hide();
91 m_axis->hide();
92 }
92 }
93
93
94 void tst_QAbstractAxis::axisPen_data()
94 void tst_QAbstractAxis::axisPen_data()
95 {
95 {
96 QTest::addColumn<QPen>("axisPen");
96 QTest::addColumn<QPen>("axisPen");
97 QTest::newRow("null") << QPen();
97 QTest::newRow("null") << QPen();
98 QTest::newRow("blue") << QPen(Qt::blue);
98 QTest::newRow("blue") << QPen(Qt::blue);
99 QTest::newRow("black") << QPen(Qt::black);
99 QTest::newRow("black") << QPen(Qt::black);
100 QTest::newRow("red") << QPen(Qt::red);
100 QTest::newRow("red") << QPen(Qt::red);
101 }
101 }
102
102
103 void tst_QAbstractAxis::axisPen()
103 void tst_QAbstractAxis::axisPen()
104 {
104 {
105 QFETCH(QPen, axisPen);
105 QFETCH(QPen, axisPen);
106
106
107 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
107 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
108 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
108 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
109 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
109 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
110 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
110 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
111 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
111 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
112 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
112 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
113 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
113 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
114 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
114 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
115 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
115 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
116
116
117 m_axis->setLinePen(axisPen);
117 m_axis->setLinePen(axisPen);
118 QCOMPARE(m_axis->linePen(), axisPen);
118 QCOMPARE(m_axis->linePen(), axisPen);
119
119
120 QCOMPARE(spy0.count(), 0);
120 QCOMPARE(spy0.count(), 0);
121 QCOMPARE(spy1.count(), 0);
121 QCOMPARE(spy1.count(), 0);
122 QCOMPARE(spy2.count(), 0);
122 QCOMPARE(spy2.count(), 0);
123 QCOMPARE(spy3.count(), 0);
123 QCOMPARE(spy3.count(), 0);
124 QCOMPARE(spy4.count(), 0);
124 QCOMPARE(spy4.count(), 0);
125 QCOMPARE(spy5.count(), 0);
125 QCOMPARE(spy5.count(), 0);
126 QCOMPARE(spy6.count(), 0);
126 QCOMPARE(spy6.count(), 0);
127 QCOMPARE(spy7.count(), 0);
127 QCOMPARE(spy7.count(), 0);
128 QCOMPARE(spy8.count(), 0);
128 QCOMPARE(spy8.count(), 0);
129
129
130 m_chart->setAxisX(m_axis, m_series);
130 m_chart->setAxisX(m_axis, m_series);
131 m_view->show();
131 m_view->show();
132 QTest::qWaitForWindowShown(m_view);
132 QTest::qWaitForWindowShown(m_view);
133 //TODO QCOMPARE(m_axis->axisPen(), axisPen);
133 //TODO QCOMPARE(m_axis->axisPen(), axisPen);
134 }
134 }
135
135
136 void tst_QAbstractAxis::axisPenColor_data()
136 void tst_QAbstractAxis::axisPenColor_data()
137 {
137 {
138 }
138 }
139
139
140 void tst_QAbstractAxis::axisPenColor()
140 void tst_QAbstractAxis::axisPenColor()
141 {
141 {
142 QSKIP("Test is not implemented. This is depreciated function", SkipAll);
142 QSKIP("Test is not implemented. This is depreciated function", SkipAll);
143 }
143 }
144
144
145 void tst_QAbstractAxis::gridLinePen_data()
145 void tst_QAbstractAxis::gridLinePen_data()
146 {
146 {
147
147
148 QTest::addColumn<QPen>("gridLinePen");
148 QTest::addColumn<QPen>("gridLinePen");
149 QTest::newRow("null") << QPen();
149 QTest::newRow("null") << QPen();
150 QTest::newRow("blue") << QPen(Qt::blue);
150 QTest::newRow("blue") << QPen(Qt::blue);
151 QTest::newRow("black") << QPen(Qt::black);
151 QTest::newRow("black") << QPen(Qt::black);
152 QTest::newRow("red") << QPen(Qt::red);
152 QTest::newRow("red") << QPen(Qt::red);
153
153
154 }
154 }
155
155
156 void tst_QAbstractAxis::gridLinePen()
156 void tst_QAbstractAxis::gridLinePen()
157 {
157 {
158 QFETCH(QPen, gridLinePen);
158 QFETCH(QPen, gridLinePen);
159
159
160 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
160 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
161 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
161 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
162 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
162 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
163 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
163 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
164 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
164 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
165 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
165 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
166 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
166 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
167 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
167 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
168 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
168 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
169
169
170 m_axis->setGridLinePen(gridLinePen);
170 m_axis->setGridLinePen(gridLinePen);
171 QCOMPARE(m_axis->gridLinePen(), gridLinePen);
171 QCOMPARE(m_axis->gridLinePen(), gridLinePen);
172
172
173 QCOMPARE(spy0.count(), 0);
173 QCOMPARE(spy0.count(), 0);
174 QCOMPARE(spy1.count(), 0);
174 QCOMPARE(spy1.count(), 0);
175 QCOMPARE(spy2.count(), 0);
175 QCOMPARE(spy2.count(), 0);
176 QCOMPARE(spy3.count(), 0);
176 QCOMPARE(spy3.count(), 0);
177 QCOMPARE(spy4.count(), 0);
177 QCOMPARE(spy4.count(), 0);
178 QCOMPARE(spy5.count(), 0);
178 QCOMPARE(spy5.count(), 0);
179 QCOMPARE(spy6.count(), 0);
179 QCOMPARE(spy6.count(), 0);
180 QCOMPARE(spy7.count(), 0);
180 QCOMPARE(spy7.count(), 0);
181 QCOMPARE(spy8.count(), 0);
181 QCOMPARE(spy8.count(), 0);
182
182
183 m_chart->setAxisX(m_axis, m_series);
183 m_chart->setAxisX(m_axis, m_series);
184 m_view->show();
184 m_view->show();
185 QTest::qWaitForWindowShown(m_view);
185 QTest::qWaitForWindowShown(m_view);
186 //TODO QCOMPARE(m_axis->gridLinePen(), gridLinePen);
186 //TODO QCOMPARE(m_axis->gridLinePen(), gridLinePen);
187 }
187 }
188
188
189 void tst_QAbstractAxis::arrowVisible_data()
189 void tst_QAbstractAxis::lineVisible_data()
190 {
190 {
191 QTest::addColumn<bool>("arrowVisible");
191 QTest::addColumn<bool>("lineVisible");
192 QTest::newRow("true") << true;
192 QTest::newRow("true") << true;
193 QTest::newRow("false") << false;
193 QTest::newRow("false") << false;
194 }
194 }
195
195
196 void tst_QAbstractAxis::arrowVisible()
196 void tst_QAbstractAxis::lineVisible()
197 {
197 {
198 QFETCH(bool, arrowVisible);
198 QFETCH(bool, lineVisible);
199
199
200 m_axis->setLineVisible(!arrowVisible);
200 m_axis->setLineVisible(!lineVisible);
201
201
202 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
202 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
203 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
203 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
204 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
204 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
205 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
205 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
206 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
206 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
207 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
207 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
208 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
208 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
209 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
209 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
210 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
210 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
211
211
212 m_axis->setLineVisible(arrowVisible);
212 m_axis->setLineVisible(lineVisible);
213 QCOMPARE(m_axis->isLineVisible(), arrowVisible);
213 QCOMPARE(m_axis->isLineVisible(), lineVisible);
214
214
215 QCOMPARE(spy0.count(), 1);
215 QCOMPARE(spy0.count(), 1);
216 QCOMPARE(spy1.count(), 0);
216 QCOMPARE(spy1.count(), 0);
217 QCOMPARE(spy2.count(), 0);
217 QCOMPARE(spy2.count(), 0);
218 QCOMPARE(spy3.count(), 0);
218 QCOMPARE(spy3.count(), 0);
219 QCOMPARE(spy4.count(), 0);
219 QCOMPARE(spy4.count(), 0);
220 QCOMPARE(spy5.count(), 0);
220 QCOMPARE(spy5.count(), 0);
221 QCOMPARE(spy6.count(), 0);
221 QCOMPARE(spy6.count(), 0);
222 QCOMPARE(spy7.count(), 0);
222 QCOMPARE(spy7.count(), 0);
223 QCOMPARE(spy8.count(), 0);
223 QCOMPARE(spy8.count(), 0);
224
224
225 m_chart->setAxisX(m_axis, m_series);
225 m_chart->setAxisX(m_axis, m_series);
226 m_view->show();
226 m_view->show();
227 QTest::qWaitForWindowShown(m_view);
227 QTest::qWaitForWindowShown(m_view);
228 QCOMPARE(m_axis->isLineVisible(), arrowVisible);
228 QCOMPARE(m_axis->isLineVisible(), lineVisible);
229 }
229 }
230
230
231 void tst_QAbstractAxis::gridLineVisible_data()
231 void tst_QAbstractAxis::gridLineVisible_data()
232 {
232 {
233 QTest::addColumn<bool>("gridLineVisible");
233 QTest::addColumn<bool>("gridLineVisible");
234 QTest::newRow("true") << true;
234 QTest::newRow("true") << true;
235 QTest::newRow("false") << false;
235 QTest::newRow("false") << false;
236 }
236 }
237
237
238 void tst_QAbstractAxis::gridLineVisible()
238 void tst_QAbstractAxis::gridLineVisible()
239 {
239 {
240 QFETCH(bool, gridLineVisible);
240 QFETCH(bool, gridLineVisible);
241
241
242 m_axis->setGridLineVisible(!gridLineVisible);
242 m_axis->setGridLineVisible(!gridLineVisible);
243
243
244 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
244 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
245 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
245 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
246 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
246 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
247 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
247 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
248 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
248 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
249 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
249 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
250 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
250 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
251 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
251 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
252 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
252 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
253
253
254 m_axis->setGridLineVisible(gridLineVisible);
254 m_axis->setGridLineVisible(gridLineVisible);
255 QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible);
255 QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible);
256
256
257 QCOMPARE(spy0.count(), 0);
257 QCOMPARE(spy0.count(), 0);
258 QCOMPARE(spy1.count(), 0);
258 QCOMPARE(spy1.count(), 0);
259 QCOMPARE(spy2.count(), 1);
259 QCOMPARE(spy2.count(), 1);
260 QCOMPARE(spy3.count(), 0);
260 QCOMPARE(spy3.count(), 0);
261 QCOMPARE(spy4.count(), 0);
261 QCOMPARE(spy4.count(), 0);
262 QCOMPARE(spy5.count(), 0);
262 QCOMPARE(spy5.count(), 0);
263 QCOMPARE(spy6.count(), 0);
263 QCOMPARE(spy6.count(), 0);
264 QCOMPARE(spy7.count(), 0);
264 QCOMPARE(spy7.count(), 0);
265 QCOMPARE(spy8.count(), 0);
265 QCOMPARE(spy8.count(), 0);
266
266
267 m_chart->setAxisX(m_axis, m_series);
267 m_chart->setAxisX(m_axis, m_series);
268 m_view->show();
268 m_view->show();
269 QTest::qWaitForWindowShown(m_view);
269 QTest::qWaitForWindowShown(m_view);
270 QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible);
270 QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible);
271
271
272 }
272 }
273
273
274 void tst_QAbstractAxis::visible_data()
274 void tst_QAbstractAxis::visible_data()
275 {
275 {
276 QTest::addColumn<bool>("visible");
276 QTest::addColumn<bool>("visible");
277 QTest::newRow("true") << true;
277 QTest::newRow("true") << true;
278 QTest::newRow("false") << false;
278 QTest::newRow("false") << false;
279 }
279 }
280
280
281 void tst_QAbstractAxis::visible()
281 void tst_QAbstractAxis::visible()
282 {
282 {
283 QFETCH(bool, visible);
283 QFETCH(bool, visible);
284
284
285 m_axis->setVisible(!visible);
285 m_axis->setVisible(!visible);
286
286
287 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
287 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
288 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
288 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
289 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
289 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
290 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
290 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
291 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
291 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
292 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
292 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
293 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
293 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
294 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
294 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
295 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
295 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
296
296
297 m_axis->setVisible(visible);
297 m_axis->setVisible(visible);
298 QCOMPARE(m_axis->isVisible(), visible);
298 QCOMPARE(m_axis->isVisible(), visible);
299
299
300 QCOMPARE(spy0.count(), 0);
300 QCOMPARE(spy0.count(), 0);
301 QCOMPARE(spy1.count(), 0);
301 QCOMPARE(spy1.count(), 0);
302 QCOMPARE(spy2.count(), 0);
302 QCOMPARE(spy2.count(), 0);
303 QCOMPARE(spy3.count(), 0);
303 QCOMPARE(spy3.count(), 0);
304 QCOMPARE(spy4.count(), 0);
304 QCOMPARE(spy4.count(), 0);
305 QCOMPARE(spy5.count(), 0);
305 QCOMPARE(spy5.count(), 0);
306 QCOMPARE(spy6.count(), 0);
306 QCOMPARE(spy6.count(), 0);
307 QCOMPARE(spy7.count(), 0);
307 QCOMPARE(spy7.count(), 0);
308 QCOMPARE(spy8.count(), 1);
308 QCOMPARE(spy8.count(), 1);
309
309
310 m_chart->setAxisX(m_axis, m_series);
310 m_chart->setAxisX(m_axis, m_series);
311 m_view->show();
311 m_view->show();
312 QTest::qWaitForWindowShown(m_view);
312 QTest::qWaitForWindowShown(m_view);
313 QCOMPARE(m_axis->isVisible(), true);
313 QCOMPARE(m_axis->isVisible(), true);
314 }
314 }
315
315
316 void tst_QAbstractAxis::labelsAngle_data()
316 void tst_QAbstractAxis::labelsAngle_data()
317 {
317 {
318 QTest::addColumn<int>("labelsAngle");
318 QTest::addColumn<int>("labelsAngle");
319 QTest::newRow("0") << 0;
319 QTest::newRow("0") << 0;
320 QTest::newRow("45") << 45;
320 QTest::newRow("45") << 45;
321 QTest::newRow("90") << 90;
321 QTest::newRow("90") << 90;
322 }
322 }
323
323
324 void tst_QAbstractAxis::labelsAngle()
324 void tst_QAbstractAxis::labelsAngle()
325 {
325 {
326 QFETCH(int, labelsAngle);
326 QFETCH(int, labelsAngle);
327
327
328 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
328 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
329 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
329 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
330 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
330 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
331 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
331 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
332 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
332 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
333 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
333 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
334 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
334 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
335 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
335 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
336 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
336 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
337
337
338 m_axis->setLabelsAngle(labelsAngle);
338 m_axis->setLabelsAngle(labelsAngle);
339 QCOMPARE(m_axis->labelsAngle(), labelsAngle);
339 QCOMPARE(m_axis->labelsAngle(), labelsAngle);
340
340
341 QCOMPARE(spy0.count(), 0);
341 QCOMPARE(spy0.count(), 0);
342 QCOMPARE(spy1.count(), 0);
342 QCOMPARE(spy1.count(), 0);
343 QCOMPARE(spy2.count(), 0);
343 QCOMPARE(spy2.count(), 0);
344 QCOMPARE(spy3.count(), 0);
344 QCOMPARE(spy3.count(), 0);
345 QCOMPARE(spy4.count(), 0);
345 QCOMPARE(spy4.count(), 0);
346 QCOMPARE(spy5.count(), 0);
346 QCOMPARE(spy5.count(), 0);
347 QCOMPARE(spy6.count(), 0);
347 QCOMPARE(spy6.count(), 0);
348 QCOMPARE(spy7.count(), 0);
348 QCOMPARE(spy7.count(), 0);
349 QCOMPARE(spy8.count(), 0);
349 QCOMPARE(spy8.count(), 0);
350
350
351 m_chart->setAxisX(m_axis, m_series);
351 m_chart->setAxisX(m_axis, m_series);
352 m_view->show();
352 m_view->show();
353 QTest::qWaitForWindowShown(m_view);
353 QTest::qWaitForWindowShown(m_view);
354 QCOMPARE(m_axis->labelsAngle(), labelsAngle);
354 QCOMPARE(m_axis->labelsAngle(), labelsAngle);
355 }
355 }
356
356
357 void tst_QAbstractAxis::labelsBrush_data()
357 void tst_QAbstractAxis::labelsBrush_data()
358 {
358 {
359 QTest::addColumn<QBrush>("labelsBrush");
359 QTest::addColumn<QBrush>("labelsBrush");
360 QTest::newRow("null") << QBrush();
360 QTest::newRow("null") << QBrush();
361 QTest::newRow("blue") << QBrush(Qt::blue);
361 QTest::newRow("blue") << QBrush(Qt::blue);
362 QTest::newRow("black") << QBrush(Qt::black);
362 QTest::newRow("black") << QBrush(Qt::black);
363
363
364 }
364 }
365
365
366 void tst_QAbstractAxis::labelsBrush()
366 void tst_QAbstractAxis::labelsBrush()
367 {
367 {
368
368
369 QFETCH(QBrush, labelsBrush);
369 QFETCH(QBrush, labelsBrush);
370
370
371 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
371 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
372 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
372 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
373 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
373 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
374 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
374 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
375 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
375 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
376 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
376 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
377 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
377 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
378 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
378 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
379 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
379 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
380
380
381 m_axis->setLabelsBrush(labelsBrush);
381 m_axis->setLabelsBrush(labelsBrush);
382 QCOMPARE(m_axis->labelsBrush(), labelsBrush);
382 QCOMPARE(m_axis->labelsBrush(), labelsBrush);
383
383
384 QCOMPARE(spy0.count(), 0);
384 QCOMPARE(spy0.count(), 0);
385 QCOMPARE(spy1.count(), 0);
385 QCOMPARE(spy1.count(), 0);
386 QCOMPARE(spy2.count(), 0);
386 QCOMPARE(spy2.count(), 0);
387 QCOMPARE(spy3.count(), 0);
387 QCOMPARE(spy3.count(), 0);
388 QCOMPARE(spy4.count(), 0);
388 QCOMPARE(spy4.count(), 0);
389 QCOMPARE(spy5.count(), 0);
389 QCOMPARE(spy5.count(), 0);
390 //TODO QCOMPARE(spy6.count(), 0);
390 //TODO QCOMPARE(spy6.count(), 0);
391 QCOMPARE(spy7.count(), 0);
391 QCOMPARE(spy7.count(), 0);
392 QCOMPARE(spy8.count(), 0);
392 QCOMPARE(spy8.count(), 0);
393
393
394 m_view->show();
394 m_view->show();
395 QTest::qWaitForWindowShown(m_view);
395 QTest::qWaitForWindowShown(m_view);
396 QCOMPARE(m_axis->labelsBrush(), labelsBrush);
396 QCOMPARE(m_axis->labelsBrush(), labelsBrush);
397
397
398 }
398 }
399
399
400 void tst_QAbstractAxis::labelsColor_data()
400 void tst_QAbstractAxis::labelsColor_data()
401 {
401 {
402
402
403 }
403 }
404
404
405 void tst_QAbstractAxis::labelsColor()
405 void tst_QAbstractAxis::labelsColor()
406 {
406 {
407 QSKIP("Test is not implemented. This is depreciated function", SkipAll);
407 QSKIP("Test is not implemented. This is depreciated function", SkipAll);
408 }
408 }
409
409
410 void tst_QAbstractAxis::labelsFont_data()
410 void tst_QAbstractAxis::labelsFont_data()
411 {
411 {
412 QTest::addColumn<QFont>("labelsFont");
412 QTest::addColumn<QFont>("labelsFont");
413 QTest::newRow("null") << QFont();
413 QTest::newRow("null") << QFont();
414 QTest::newRow("serif") << QFont("SansSerif");
414 QTest::newRow("serif") << QFont("SansSerif");
415 }
415 }
416
416
417 void tst_QAbstractAxis::labelsFont()
417 void tst_QAbstractAxis::labelsFont()
418 {
418 {
419
419
420 QFETCH(QFont, labelsFont);
420 QFETCH(QFont, labelsFont);
421
421
422 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
422 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
423 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
423 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
424 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
424 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
425 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
425 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
426 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
426 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
427 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
427 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
428 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
428 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
429 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
429 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
430 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
430 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
431
431
432 m_axis->setLabelsFont(labelsFont);
432 m_axis->setLabelsFont(labelsFont);
433 QCOMPARE(m_axis->labelsFont(), labelsFont);
433 QCOMPARE(m_axis->labelsFont(), labelsFont);
434
434
435 QCOMPARE(spy0.count(), 0);
435 QCOMPARE(spy0.count(), 0);
436 QCOMPARE(spy1.count(), 0);
436 QCOMPARE(spy1.count(), 0);
437 QCOMPARE(spy2.count(), 0);
437 QCOMPARE(spy2.count(), 0);
438 QCOMPARE(spy3.count(), 0);
438 QCOMPARE(spy3.count(), 0);
439 QCOMPARE(spy4.count(), 0);
439 QCOMPARE(spy4.count(), 0);
440 QCOMPARE(spy5.count(), 0);
440 QCOMPARE(spy5.count(), 0);
441 QCOMPARE(spy6.count(), 0);
441 QCOMPARE(spy6.count(), 0);
442 QCOMPARE(spy7.count(), 0);
442 QCOMPARE(spy7.count(), 0);
443 QCOMPARE(spy8.count(), 0);
443 QCOMPARE(spy8.count(), 0);
444
444
445 m_view->show();
445 m_view->show();
446 QTest::qWaitForWindowShown(m_view);
446 QTest::qWaitForWindowShown(m_view);
447 QCOMPARE(m_axis->labelsFont(), labelsFont);
447 QCOMPARE(m_axis->labelsFont(), labelsFont);
448
448
449 }
449 }
450
450
451 void tst_QAbstractAxis::labelsPen_data()
451 void tst_QAbstractAxis::labelsPen_data()
452 {
452 {
453 QTest::addColumn<QPen>("labelsPen");
453 QTest::addColumn<QPen>("labelsPen");
454 QTest::newRow("null") << QPen();
454 QTest::newRow("null") << QPen();
455 QTest::newRow("blue") << QPen(Qt::blue);
455 QTest::newRow("blue") << QPen(Qt::blue);
456 QTest::newRow("black") << QPen(Qt::black);
456 QTest::newRow("black") << QPen(Qt::black);
457 QTest::newRow("red") << QPen(Qt::red);
457 QTest::newRow("red") << QPen(Qt::red);
458 }
458 }
459
459
460 void tst_QAbstractAxis::labelsPen()
460 void tst_QAbstractAxis::labelsPen()
461 {
461 {
462 QFETCH(QPen, labelsPen);
462 QFETCH(QPen, labelsPen);
463
463
464 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
464 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
465 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
465 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
466 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
466 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
467 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
467 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
468 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
468 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
469 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
469 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
470 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
470 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
471 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
471 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
472 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
472 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
473
473
474 m_axis->setLabelsPen(labelsPen);
474 m_axis->setLabelsPen(labelsPen);
475 QCOMPARE(m_axis->labelsPen(), labelsPen);
475 QCOMPARE(m_axis->labelsPen(), labelsPen);
476
476
477 QCOMPARE(spy0.count(), 0);
477 QCOMPARE(spy0.count(), 0);
478 QCOMPARE(spy1.count(), 0);
478 QCOMPARE(spy1.count(), 0);
479 QCOMPARE(spy2.count(), 0);
479 QCOMPARE(spy2.count(), 0);
480 QCOMPARE(spy3.count(), 0);
480 QCOMPARE(spy3.count(), 0);
481 QCOMPARE(spy4.count(), 0);
481 QCOMPARE(spy4.count(), 0);
482 QCOMPARE(spy5.count(), 0);
482 QCOMPARE(spy5.count(), 0);
483 QCOMPARE(spy6.count(), 0);
483 QCOMPARE(spy6.count(), 0);
484 QCOMPARE(spy7.count(), 0);
484 QCOMPARE(spy7.count(), 0);
485 QCOMPARE(spy8.count(), 0);
485 QCOMPARE(spy8.count(), 0);
486
486
487 m_chart->setAxisX(m_axis, m_series);
487 m_chart->setAxisX(m_axis, m_series);
488 m_view->show();
488 m_view->show();
489 QTest::qWaitForWindowShown(m_view);
489 QTest::qWaitForWindowShown(m_view);
490 //TODO QCOMPARE(m_axis->labelsPen(), labelsPen);
490 //TODO QCOMPARE(m_axis->labelsPen(), labelsPen);
491 }
491 }
492
492
493 void tst_QAbstractAxis::labelsVisible_data()
493 void tst_QAbstractAxis::labelsVisible_data()
494 {
494 {
495 QTest::addColumn<bool>("labelsVisible");
495 QTest::addColumn<bool>("labelsVisible");
496 QTest::newRow("true") << true;
496 QTest::newRow("true") << true;
497 QTest::newRow("false") << false;
497 QTest::newRow("false") << false;
498 }
498 }
499
499
500 void tst_QAbstractAxis::labelsVisible()
500 void tst_QAbstractAxis::labelsVisible()
501 {
501 {
502 QFETCH(bool, labelsVisible);
502 QFETCH(bool, labelsVisible);
503
503
504 m_axis->setLabelsVisible(!labelsVisible);
504 m_axis->setLabelsVisible(!labelsVisible);
505
505
506 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
506 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
507 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
507 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
508 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
508 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
509 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
509 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
510 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
510 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
511 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
511 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
512 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
512 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
513 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
513 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
514 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
514 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
515
515
516 m_axis->setLabelsVisible(labelsVisible);
516 m_axis->setLabelsVisible(labelsVisible);
517 QCOMPARE(m_axis->labelsVisible(), labelsVisible);
517 QCOMPARE(m_axis->labelsVisible(), labelsVisible);
518
518
519 QCOMPARE(spy0.count(), 0);
519 QCOMPARE(spy0.count(), 0);
520 QCOMPARE(spy1.count(), 0);
520 QCOMPARE(spy1.count(), 0);
521 QCOMPARE(spy2.count(), 0);
521 QCOMPARE(spy2.count(), 0);
522 QCOMPARE(spy3.count(), 0);
522 QCOMPARE(spy3.count(), 0);
523 QCOMPARE(spy4.count(), 1);
523 QCOMPARE(spy4.count(), 1);
524 QCOMPARE(spy5.count(), 0);
524 QCOMPARE(spy5.count(), 0);
525 QCOMPARE(spy6.count(), 0);
525 QCOMPARE(spy6.count(), 0);
526 QCOMPARE(spy7.count(), 0);
526 QCOMPARE(spy7.count(), 0);
527 QCOMPARE(spy8.count(), 0);
527 QCOMPARE(spy8.count(), 0);
528
528
529 m_chart->setAxisX(m_axis, m_series);
529 m_chart->setAxisX(m_axis, m_series);
530 m_view->show();
530 m_view->show();
531 QTest::qWaitForWindowShown(m_view);
531 QTest::qWaitForWindowShown(m_view);
532 QCOMPARE(m_axis->labelsVisible(), labelsVisible);
532 QCOMPARE(m_axis->labelsVisible(), labelsVisible);
533 }
533 }
534
534
535 void tst_QAbstractAxis::orientation_data()
535 void tst_QAbstractAxis::orientation_data()
536 {
536 {
537 QTest::addColumn<Qt::Orientation>("orientation");
537 QTest::addColumn<Qt::Orientation>("orientation");
538 QTest::newRow("Vertical") << Qt::Vertical;
538 QTest::newRow("Vertical") << Qt::Vertical;
539 QTest::newRow("Horizontal") << Qt::Horizontal;
539 QTest::newRow("Horizontal") << Qt::Horizontal;
540 }
540 }
541
541
542 void tst_QAbstractAxis::orientation()
542 void tst_QAbstractAxis::orientation()
543 {
543 {
544 QFETCH(Qt::Orientation, orientation);
544 QFETCH(Qt::Orientation, orientation);
545
545
546 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
546 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
547 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
547 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
548 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
548 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
549 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
549 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
550 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
550 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
551 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
551 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
552 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
552 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
553 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
553 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
554 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
554 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
555
555
556 if(orientation==Qt::Vertical){
556 if(orientation==Qt::Vertical){
557 m_chart->setAxisY(m_axis,m_series);
557 m_chart->setAxisY(m_axis,m_series);
558 }else{
558 }else{
559 m_chart->setAxisX(m_axis,m_series);
559 m_chart->setAxisX(m_axis,m_series);
560 }
560 }
561 QCOMPARE(m_axis->orientation(), orientation);
561 QCOMPARE(m_axis->orientation(), orientation);
562
562
563 QCOMPARE(spy0.count(), 0);
563 QCOMPARE(spy0.count(), 0);
564 QCOMPARE(spy1.count(), 0);
564 QCOMPARE(spy1.count(), 0);
565 QCOMPARE(spy2.count(), 0);
565 QCOMPARE(spy2.count(), 0);
566 QCOMPARE(spy3.count(), 0);
566 QCOMPARE(spy3.count(), 0);
567 QCOMPARE(spy4.count(), 0);
567 QCOMPARE(spy4.count(), 0);
568 QCOMPARE(spy5.count(), 0);
568 QCOMPARE(spy5.count(), 0);
569 QCOMPARE(spy6.count(), 0);
569 QCOMPARE(spy6.count(), 0);
570 QCOMPARE(spy7.count(), 0);
570 QCOMPARE(spy7.count(), 0);
571 QCOMPARE(spy8.count(), 1);
571 QCOMPARE(spy8.count(), 1);
572
572
573 m_view->show();
573 m_view->show();
574 QTest::qWaitForWindowShown(m_view);
574 QTest::qWaitForWindowShown(m_view);
575 QCOMPARE(m_axis->orientation(), orientation);
575 QCOMPARE(m_axis->orientation(), orientation);
576 }
576 }
577
577
578 void tst_QAbstractAxis::setMax_data()
578 void tst_QAbstractAxis::setMax_data()
579 {
579 {
580 //just check if it does not crash
580 //just check if it does not crash
581 QTest::addColumn<QVariant>("max");
581 QTest::addColumn<QVariant>("max");
582 QTest::newRow("something") << QVariant("something");
582 QTest::newRow("something") << QVariant("something");
583 QTest::newRow("1.0") << QVariant(1.0);
583 QTest::newRow("1.0") << QVariant(1.0);
584 }
584 }
585
585
586 void tst_QAbstractAxis::setMax()
586 void tst_QAbstractAxis::setMax()
587 {
587 {
588 QFETCH(QVariant, max);
588 QFETCH(QVariant, max);
589 m_axis->setMax(max);
589 m_axis->setMax(max);
590 }
590 }
591
591
592 void tst_QAbstractAxis::setMin_data()
592 void tst_QAbstractAxis::setMin_data()
593 {
593 {
594 //just check if it does not crash
594 //just check if it does not crash
595 QTest::addColumn<QVariant>("min");
595 QTest::addColumn<QVariant>("min");
596 QTest::newRow("something") << QVariant("something");
596 QTest::newRow("something") << QVariant("something");
597 QTest::newRow("1.0") << QVariant(1.0);
597 QTest::newRow("1.0") << QVariant(1.0);
598 }
598 }
599
599
600 // public void setMin(QVariant const& min)
600 // public void setMin(QVariant const& min)
601 void tst_QAbstractAxis::setMin()
601 void tst_QAbstractAxis::setMin()
602 {
602 {
603 QFETCH(QVariant, min);
603 QFETCH(QVariant, min);
604 m_axis->setMin(min);
604 m_axis->setMin(min);
605 }
605 }
606
606
607 void tst_QAbstractAxis::setRange_data()
607 void tst_QAbstractAxis::setRange_data()
608 {
608 {
609 //just check if it does not crash
609 //just check if it does not crash
610 QTest::addColumn<QVariant>("min");
610 QTest::addColumn<QVariant>("min");
611 QTest::addColumn<QVariant>("max");
611 QTest::addColumn<QVariant>("max");
612 QTest::newRow("something") << QVariant("something0") << QVariant("something1");
612 QTest::newRow("something") << QVariant("something0") << QVariant("something1");
613 QTest::newRow("-1 1") << QVariant(-1.0) << QVariant(1.0);
613 QTest::newRow("-1 1") << QVariant(-1.0) << QVariant(1.0);
614 }
614 }
615
615
616 // public void setRange(QVariant const& min, QVariant const& max)
616 // public void setRange(QVariant const& min, QVariant const& max)
617 void tst_QAbstractAxis::setRange()
617 void tst_QAbstractAxis::setRange()
618 {
618 {
619
619
620 QFETCH(QVariant, min);
620 QFETCH(QVariant, min);
621 QFETCH(QVariant, max);
621 QFETCH(QVariant, max);
622 m_axis->setRange(min,max);
622 m_axis->setRange(min,max);
623 }
623 }
624
624
625 void tst_QAbstractAxis::shadesBorderColor_data()
625 void tst_QAbstractAxis::shadesBorderColor_data()
626 {
626 {
627
627
628 }
628 }
629
629
630 void tst_QAbstractAxis::shadesBorderColor()
630 void tst_QAbstractAxis::shadesBorderColor()
631 {
631 {
632 QSKIP("Test is not implemented. This is depreciated function", SkipAll);
632 QSKIP("Test is not implemented. This is depreciated function", SkipAll);
633 }
633 }
634
634
635 void tst_QAbstractAxis::shadesBrush_data()
635 void tst_QAbstractAxis::shadesBrush_data()
636 {
636 {
637 QTest::addColumn<QBrush>("shadesBrush");
637 QTest::addColumn<QBrush>("shadesBrush");
638 QTest::newRow("null") << QBrush();
638 QTest::newRow("null") << QBrush();
639 QTest::newRow("blue") << QBrush(Qt::blue);
639 QTest::newRow("blue") << QBrush(Qt::blue);
640 QTest::newRow("black") << QBrush(Qt::black);
640 QTest::newRow("black") << QBrush(Qt::black);
641 }
641 }
642
642
643 void tst_QAbstractAxis::shadesBrush()
643 void tst_QAbstractAxis::shadesBrush()
644 {
644 {
645 QFETCH(QBrush, shadesBrush);
645 QFETCH(QBrush, shadesBrush);
646
646
647 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
647 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
648 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
648 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
649 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
649 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
650 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
650 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
651 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
651 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
652 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
652 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
653 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
653 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
654 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
654 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
655 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
655 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
656
656
657 m_axis->setShadesBrush(shadesBrush);
657 m_axis->setShadesBrush(shadesBrush);
658 QCOMPARE(m_axis->shadesBrush(), shadesBrush);
658 QCOMPARE(m_axis->shadesBrush(), shadesBrush);
659
659
660 QCOMPARE(spy0.count(), 0);
660 QCOMPARE(spy0.count(), 0);
661 QCOMPARE(spy1.count(), 0);
661 QCOMPARE(spy1.count(), 0);
662 QCOMPARE(spy2.count(), 0);
662 QCOMPARE(spy2.count(), 0);
663 QCOMPARE(spy3.count(), 0);
663 QCOMPARE(spy3.count(), 0);
664 QCOMPARE(spy4.count(), 0);
664 QCOMPARE(spy4.count(), 0);
665 QCOMPARE(spy5.count(), 0);
665 QCOMPARE(spy5.count(), 0);
666 //TODO QCOMPARE(spy6.count(), 0);
666 //TODO QCOMPARE(spy6.count(), 0);
667 QCOMPARE(spy7.count(), 0);
667 QCOMPARE(spy7.count(), 0);
668 QCOMPARE(spy8.count(), 0);
668 QCOMPARE(spy8.count(), 0);
669
669
670 m_view->show();
670 m_view->show();
671 QTest::qWaitForWindowShown(m_view);
671 QTest::qWaitForWindowShown(m_view);
672 QCOMPARE(m_axis->shadesBrush(), shadesBrush);
672 QCOMPARE(m_axis->shadesBrush(), shadesBrush);
673 }
673 }
674
674
675 void tst_QAbstractAxis::shadesColor_data()
675 void tst_QAbstractAxis::shadesColor_data()
676 {
676 {
677 }
677 }
678
678
679 // public QColor shadesColor() const
679 // public QColor shadesColor() const
680 void tst_QAbstractAxis::shadesColor()
680 void tst_QAbstractAxis::shadesColor()
681 {
681 {
682 QSKIP("Test is not implemented. This is depreciated function", SkipAll);
682 QSKIP("Test is not implemented. This is depreciated function", SkipAll);
683 }
683 }
684
684
685 void tst_QAbstractAxis::shadesPen_data()
685 void tst_QAbstractAxis::shadesPen_data()
686 {
686 {
687 QTest::addColumn<QPen>("shadesPen");
687 QTest::addColumn<QPen>("shadesPen");
688 QTest::newRow("null") << QPen();
688 QTest::newRow("null") << QPen();
689 QTest::newRow("blue") << QPen(Qt::blue);
689 QTest::newRow("blue") << QPen(Qt::blue);
690 QTest::newRow("black") << QPen(Qt::black);
690 QTest::newRow("black") << QPen(Qt::black);
691 QTest::newRow("red") << QPen(Qt::red);
691 QTest::newRow("red") << QPen(Qt::red);
692 }
692 }
693
693
694 void tst_QAbstractAxis::shadesPen()
694 void tst_QAbstractAxis::shadesPen()
695 {
695 {
696 QFETCH(QPen, shadesPen);
696 QFETCH(QPen, shadesPen);
697
697
698 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
698 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
699 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
699 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
700 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
700 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
701 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
701 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
702 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
702 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
703 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
703 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
704 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
704 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
705 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
705 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
706 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
706 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
707
707
708 m_axis->setShadesPen(shadesPen);
708 m_axis->setShadesPen(shadesPen);
709 QCOMPARE(m_axis->shadesPen(), shadesPen);
709 QCOMPARE(m_axis->shadesPen(), shadesPen);
710
710
711 QCOMPARE(spy0.count(), 0);
711 QCOMPARE(spy0.count(), 0);
712 QCOMPARE(spy1.count(), 0);
712 QCOMPARE(spy1.count(), 0);
713 QCOMPARE(spy2.count(), 0);
713 QCOMPARE(spy2.count(), 0);
714 QCOMPARE(spy3.count(), 0);
714 QCOMPARE(spy3.count(), 0);
715 QCOMPARE(spy4.count(), 0);
715 QCOMPARE(spy4.count(), 0);
716 QCOMPARE(spy5.count(), 0);
716 QCOMPARE(spy5.count(), 0);
717 QCOMPARE(spy6.count(), 0);
717 QCOMPARE(spy6.count(), 0);
718 QCOMPARE(spy7.count(), 0);
718 QCOMPARE(spy7.count(), 0);
719 QCOMPARE(spy8.count(), 0);
719 QCOMPARE(spy8.count(), 0);
720
720
721 m_chart->setAxisX(m_axis, m_series);
721 m_chart->setAxisX(m_axis, m_series);
722 m_view->show();
722 m_view->show();
723 QTest::qWaitForWindowShown(m_view);
723 QTest::qWaitForWindowShown(m_view);
724 QCOMPARE(m_axis->shadesPen(), shadesPen);
724 QCOMPARE(m_axis->shadesPen(), shadesPen);
725 }
725 }
726
726
727 void tst_QAbstractAxis::shadesVisible_data()
727 void tst_QAbstractAxis::shadesVisible_data()
728 {
728 {
729 QTest::addColumn<bool>("shadesVisible");
729 QTest::addColumn<bool>("shadesVisible");
730 QTest::newRow("true") << true;
730 QTest::newRow("true") << true;
731 QTest::newRow("false") << false;
731 QTest::newRow("false") << false;
732 }
732 }
733
733
734 void tst_QAbstractAxis::shadesVisible()
734 void tst_QAbstractAxis::shadesVisible()
735 {
735 {
736 QFETCH(bool, shadesVisible);
736 QFETCH(bool, shadesVisible);
737
737
738 m_axis->setShadesVisible(!shadesVisible);
738 m_axis->setShadesVisible(!shadesVisible);
739
739
740 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
740 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
741 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
741 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
742 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
742 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
743 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
743 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
744 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
744 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
745 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
745 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
746 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
746 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
747 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
747 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
748 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
748 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
749
749
750 m_axis->setShadesVisible(shadesVisible);
750 m_axis->setShadesVisible(shadesVisible);
751 QCOMPARE(m_axis->shadesVisible(), shadesVisible);
751 QCOMPARE(m_axis->shadesVisible(), shadesVisible);
752
752
753 QCOMPARE(spy0.count(), 0);
753 QCOMPARE(spy0.count(), 0);
754 QCOMPARE(spy1.count(), 0);
754 QCOMPARE(spy1.count(), 0);
755 QCOMPARE(spy2.count(), 0);
755 QCOMPARE(spy2.count(), 0);
756 QCOMPARE(spy3.count(), 0);
756 QCOMPARE(spy3.count(), 0);
757 QCOMPARE(spy4.count(), 0);
757 QCOMPARE(spy4.count(), 0);
758 QCOMPARE(spy5.count(), 0);
758 QCOMPARE(spy5.count(), 0);
759 QCOMPARE(spy6.count(), 0);
759 QCOMPARE(spy6.count(), 0);
760 QCOMPARE(spy7.count(), 1);
760 QCOMPARE(spy7.count(), 1);
761 QCOMPARE(spy8.count(), 0);
761 QCOMPARE(spy8.count(), 0);
762
762
763 m_chart->setAxisX(m_axis, m_series);
763 m_chart->setAxisX(m_axis, m_series);
764 m_view->show();
764 m_view->show();
765 QTest::qWaitForWindowShown(m_view);
765 QTest::qWaitForWindowShown(m_view);
766 QCOMPARE(m_axis->shadesVisible(), shadesVisible);
766 QCOMPARE(m_axis->shadesVisible(), shadesVisible);
767 }
767 }
768
768
769 void tst_QAbstractAxis::show_data()
769 void tst_QAbstractAxis::show_data()
770 {
770 {
771
771
772 }
772 }
773
773
774 void tst_QAbstractAxis::show()
774 void tst_QAbstractAxis::show()
775 {
775 {
776 m_axis->hide();
776 m_axis->hide();
777 QCOMPARE(m_axis->isVisible(), false);
777 QCOMPARE(m_axis->isVisible(), false);
778
778
779 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
779 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
780 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
780 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
781 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
781 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
782 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
782 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
783 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
783 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
784 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
784 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
785 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
785 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
786 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
786 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
787 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
787 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
788
788
789 m_axis->show();
789 m_axis->show();
790
790
791 QCOMPARE(spy0.count(), 0);
791 QCOMPARE(spy0.count(), 0);
792 QCOMPARE(spy1.count(), 0);
792 QCOMPARE(spy1.count(), 0);
793 QCOMPARE(spy2.count(), 0);
793 QCOMPARE(spy2.count(), 0);
794 QCOMPARE(spy3.count(), 0);
794 QCOMPARE(spy3.count(), 0);
795 QCOMPARE(spy4.count(), 0);
795 QCOMPARE(spy4.count(), 0);
796 QCOMPARE(spy5.count(), 0);
796 QCOMPARE(spy5.count(), 0);
797 QCOMPARE(spy6.count(), 0);
797 QCOMPARE(spy6.count(), 0);
798 QCOMPARE(spy7.count(), 0);
798 QCOMPARE(spy7.count(), 0);
799 QCOMPARE(spy8.count(), 1);
799 QCOMPARE(spy8.count(), 1);
800 QCOMPARE(m_axis->isVisible(), true);
800 QCOMPARE(m_axis->isVisible(), true);
801 }
801 }
802
802
803 void tst_QAbstractAxis::hide_data()
803 void tst_QAbstractAxis::hide_data()
804 {
804 {
805
805
806 }
806 }
807
807
808 void tst_QAbstractAxis::hide()
808 void tst_QAbstractAxis::hide()
809 {
809 {
810 m_axis->show();
810 m_axis->show();
811 QCOMPARE(m_axis->isVisible(),true);
811 QCOMPARE(m_axis->isVisible(),true);
812
812
813 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
813 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
814 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
814 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
815 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
815 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
816 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
816 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
817 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
817 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
818 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
818 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
819 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
819 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
820 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
820 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
821 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
821 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
822
822
823 m_axis->hide();
823 m_axis->hide();
824
824
825 QCOMPARE(spy0.count(), 0);
825 QCOMPARE(spy0.count(), 0);
826 QCOMPARE(spy1.count(), 0);
826 QCOMPARE(spy1.count(), 0);
827 QCOMPARE(spy2.count(), 0);
827 QCOMPARE(spy2.count(), 0);
828 QCOMPARE(spy3.count(), 0);
828 QCOMPARE(spy3.count(), 0);
829 QCOMPARE(spy4.count(), 0);
829 QCOMPARE(spy4.count(), 0);
830 QCOMPARE(spy5.count(), 0);
830 QCOMPARE(spy5.count(), 0);
831 QCOMPARE(spy6.count(), 0);
831 QCOMPARE(spy6.count(), 0);
832 QCOMPARE(spy7.count(), 0);
832 QCOMPARE(spy7.count(), 0);
833 QCOMPARE(spy8.count(), 1);
833 QCOMPARE(spy8.count(), 1);
834 QCOMPARE(m_axis->isVisible(),false);
834 QCOMPARE(m_axis->isVisible(),false);
835 }
835 }
836
836
837
837
838
838
839
839
840
840
841
841
842
842
843
843
844
844
845
845
846
846
847
847
@@ -1,98 +1,98
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #ifndef TST_QABSTRACTSERIES_H
21 #ifndef TST_QABSTRACTSERIES_H
22 #define TST_QABSTRACTSERIES_H
22 #define TST_QABSTRACTSERIES_H
23
23
24 #include <QtTest/QtTest>
24 #include <QtTest/QtTest>
25 #include <tst_definitions.h>
25 #include <tst_definitions.h>
26 #include <qabstractaxis.h>
26 #include <qabstractaxis.h>
27 #include <qchartview.h>
27 #include <qchartview.h>
28
28
29 QTCOMMERCIALCHART_USE_NAMESPACE
29 QTCOMMERCIALCHART_USE_NAMESPACE
30
30
31 class tst_QAbstractAxis : public QObject
31 class tst_QAbstractAxis : public QObject
32 {
32 {
33 Q_OBJECT
33 Q_OBJECT
34
34
35 public slots:
35 public slots:
36 virtual void initTestCase();
36 virtual void initTestCase();
37 virtual void cleanupTestCase();
37 virtual void cleanupTestCase();
38 virtual void init(QAbstractAxis* axis,QAbstractSeries* series);
38 virtual void init(QAbstractAxis* axis,QAbstractSeries* series);
39 virtual void cleanup();
39 virtual void cleanup();
40
40
41 private slots:
41 private slots:
42 void axisPen_data();
42 void axisPen_data();
43 void axisPen();
43 void axisPen();
44 void axisPenColor_data();
44 void axisPenColor_data();
45 void axisPenColor();
45 void axisPenColor();
46 void gridLinePen_data();
46 void gridLinePen_data();
47 void gridLinePen();
47 void gridLinePen();
48 void arrowVisible_data();
48 void lineVisible_data();
49 void arrowVisible();
49 void lineVisible();
50 void gridLineVisible_data();
50 void gridLineVisible_data();
51 void gridLineVisible();
51 void gridLineVisible();
52 void visible_data();
52 void visible_data();
53 void visible();
53 void visible();
54 void labelsAngle_data();
54 void labelsAngle_data();
55 void labelsAngle();
55 void labelsAngle();
56 void labelsBrush_data();
56 void labelsBrush_data();
57 void labelsBrush();
57 void labelsBrush();
58 void labelsColor_data();
58 void labelsColor_data();
59 void labelsColor();
59 void labelsColor();
60 void labelsFont_data();
60 void labelsFont_data();
61 void labelsFont();
61 void labelsFont();
62 void labelsPen_data();
62 void labelsPen_data();
63 void labelsPen();
63 void labelsPen();
64 void labelsVisible_data();
64 void labelsVisible_data();
65 void labelsVisible();
65 void labelsVisible();
66 void orientation_data();
66 void orientation_data();
67 void orientation();
67 void orientation();
68 void setMax_data();
68 void setMax_data();
69 void setMax();
69 void setMax();
70 void setMin_data();
70 void setMin_data();
71 void setMin();
71 void setMin();
72 void setRange_data();
72 void setRange_data();
73 void setRange();
73 void setRange();
74 void shadesBorderColor_data();
74 void shadesBorderColor_data();
75 void shadesBorderColor();
75 void shadesBorderColor();
76 void shadesBrush_data();
76 void shadesBrush_data();
77 void shadesBrush();
77 void shadesBrush();
78 void shadesColor_data();
78 void shadesColor_data();
79 void shadesColor();
79 void shadesColor();
80 void shadesPen_data();
80 void shadesPen_data();
81 void shadesPen();
81 void shadesPen();
82 void shadesVisible_data();
82 void shadesVisible_data();
83 void shadesVisible();
83 void shadesVisible();
84 void show_data();
84 void show_data();
85 void show();
85 void show();
86 void hide_data();
86 void hide_data();
87 void hide();
87 void hide();
88
88
89 protected:
89 protected:
90 void qabstractaxis();
90 void qabstractaxis();
91 protected:
91 protected:
92 QChartView* m_view;
92 QChartView* m_view;
93 QChart* m_chart;
93 QChart* m_chart;
94 QAbstractAxis* m_axis;
94 QAbstractAxis* m_axis;
95 QAbstractSeries* m_series;
95 QAbstractSeries* m_series;
96 };
96 };
97
97
98 #endif
98 #endif
General Comments 0
You need to be logged in to leave comments. Login now