@@ -0,0 +1,5 | |||
|
1 | !include( ../auto.pri ) { | |
|
2 | error( "Couldn't find the auto.pri file!" ) | |
|
3 | } | |
|
4 | HEADERS += ../qabstractaxis/tst_qabstractaxis.h | |
|
5 | SOURCES += tst_qdatetimeaxis.cpp ../qabstractaxis/tst_qabstractaxis.cpp |
@@ -0,0 +1,259 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | #include "../qabstractaxis/tst_qabstractaxis.h" | |
|
22 | #include "qdatetimeaxis.h" | |
|
23 | #include <qlineseries.h> | |
|
24 | ||
|
25 | class tst_QDateTimeAxis: public tst_QAbstractAxis | |
|
26 | { | |
|
27 | Q_OBJECT | |
|
28 | ||
|
29 | public slots: | |
|
30 | void initTestCase(); | |
|
31 | void cleanupTestCase(); | |
|
32 | void init(); | |
|
33 | void cleanup(); | |
|
34 | ||
|
35 | private slots: | |
|
36 | // void QDateTimeAxis_data(); | |
|
37 | // void QDateTimeAxis(); | |
|
38 | ||
|
39 | // void max_raw_data(); | |
|
40 | // void max_raw(); | |
|
41 | // void max_data(); | |
|
42 | // void max(); | |
|
43 | // void max_animation_data(); | |
|
44 | // void max_animation(); | |
|
45 | // void min_raw_data(); | |
|
46 | // void min_raw(); | |
|
47 | // void min_data(); | |
|
48 | // void min(); | |
|
49 | // void min_animation_data(); | |
|
50 | // void min_animation(); | |
|
51 | // void range_raw_data(); | |
|
52 | // void range_raw(); | |
|
53 | // void range_data(); | |
|
54 | // void range(); | |
|
55 | // void range_animation_data(); | |
|
56 | // void range_animation(); | |
|
57 | ||
|
58 | private: | |
|
59 | QDateTimeAxis* m_intervalsaxis; | |
|
60 | QLineSeries* m_series; | |
|
61 | }; | |
|
62 | ||
|
63 | void tst_QDateTimeAxis::initTestCase() | |
|
64 | { | |
|
65 | } | |
|
66 | ||
|
67 | void tst_QDateTimeAxis::cleanupTestCase() | |
|
68 | { | |
|
69 | } | |
|
70 | ||
|
71 | void tst_QDateTimeAxis::init() | |
|
72 | { | |
|
73 | m_intervalsaxis = new QDateTimeAxis(); | |
|
74 | m_series = new QLineSeries(); | |
|
75 | *m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100); | |
|
76 | tst_QAbstractAxis::init(m_intervalsaxis, m_series); | |
|
77 | m_chart->addSeries(m_series); | |
|
78 | m_chart->createDefaultAxes(); | |
|
79 | } | |
|
80 | ||
|
81 | void tst_QDateTimeAxis::cleanup() | |
|
82 | { | |
|
83 | delete m_series; | |
|
84 | delete m_intervalsaxis; | |
|
85 | m_series = 0; | |
|
86 | m_intervalsaxis = 0; | |
|
87 | tst_QAbstractAxis::cleanup(); | |
|
88 | } | |
|
89 | ||
|
90 | //void tst_QDateTimeAxis::QDateTimeAxis_data() | |
|
91 | //{ | |
|
92 | //} | |
|
93 | ||
|
94 | //void tst_QDateTimeAxis::QDateTimeAxis() | |
|
95 | //{ | |
|
96 | // qabstractaxis(); | |
|
97 | ||
|
98 | // QVERIFY(qFuzzyIsNull(m_intervalsaxis->max())); | |
|
99 | // QVERIFY(qFuzzyIsNull(m_intervalsaxis->min())); | |
|
100 | // QCOMPARE(m_intervalsaxis->type(), QAbstractAxis::AxisTypeIntervals); | |
|
101 | ||
|
102 | // m_chart->setAxisX(m_intervalsaxis, m_series); | |
|
103 | // m_view->show(); | |
|
104 | // QTest::qWaitForWindowShown(m_view); | |
|
105 | ||
|
106 | // QVERIFY(!qFuzzyIsNull(m_intervalsaxis->max())); | |
|
107 | // QVERIFY(!qFuzzyIsNull(m_intervalsaxis->min())); | |
|
108 | //} | |
|
109 | ||
|
110 | //void tst_QDateTimeAxis::max_raw_data() | |
|
111 | //{ | |
|
112 | // QTest::addColumn<qreal>("max"); | |
|
113 | // QTest::newRow("1.0") << 1.0; | |
|
114 | // QTest::newRow("50.0") << 50.0; | |
|
115 | // QTest::newRow("101.0") << 101.0; | |
|
116 | //} | |
|
117 | ||
|
118 | //void tst_QDateTimeAxis::max_raw() | |
|
119 | //{ | |
|
120 | // QFETCH(qreal, max); | |
|
121 | ||
|
122 | // QSignalSpy spy0(m_intervalsaxis, SIGNAL(maxChanged(qreal))); | |
|
123 | // QSignalSpy spy1(m_intervalsaxis, SIGNAL(minChanged(qreal))); | |
|
124 | // QSignalSpy spy2(m_intervalsaxis, SIGNAL(rangeChanged(qreal, qreal))); | |
|
125 | ||
|
126 | // m_intervalsaxis->setMax(max); | |
|
127 | // QVERIFY2(qFuzzyIsNull(m_intervalsaxis->max() - max), "Not equal"); | |
|
128 | ||
|
129 | // QCOMPARE(spy0.count(), 1); | |
|
130 | // QCOMPARE(spy1.count(), 0); | |
|
131 | // QCOMPARE(spy2.count(), 1); | |
|
132 | //} | |
|
133 | ||
|
134 | //void tst_QDateTimeAxis::max_data() | |
|
135 | //{ | |
|
136 | // max_raw_data(); | |
|
137 | //} | |
|
138 | ||
|
139 | //void tst_QDateTimeAxis::max() | |
|
140 | //{ | |
|
141 | // m_chart->setAxisX(m_intervalsaxis, m_series); | |
|
142 | // m_view->show(); | |
|
143 | // QTest::qWaitForWindowShown(m_view); | |
|
144 | // max_raw(); | |
|
145 | //} | |
|
146 | ||
|
147 | //void tst_QDateTimeAxis::max_animation_data() | |
|
148 | //{ | |
|
149 | // max_data(); | |
|
150 | //} | |
|
151 | ||
|
152 | //void tst_QDateTimeAxis::max_animation() | |
|
153 | //{ | |
|
154 | // m_chart->setAnimationOptions(QChart::GridAxisAnimations); | |
|
155 | // max(); | |
|
156 | //} | |
|
157 | ||
|
158 | //void tst_QDateTimeAxis::min_raw_data() | |
|
159 | //{ | |
|
160 | // QTest::addColumn<qreal>("min"); | |
|
161 | // QTest::newRow("-1.0") << -1.0; | |
|
162 | // QTest::newRow("-50.0") << -50.0; | |
|
163 | // QTest::newRow("-101.0") << -101.0; | |
|
164 | //} | |
|
165 | ||
|
166 | //void tst_QDateTimeAxis::min_raw() | |
|
167 | //{ | |
|
168 | // QFETCH(qreal, min); | |
|
169 | ||
|
170 | // QSignalSpy spy0(m_intervalsaxis, SIGNAL(maxChanged(qreal))); | |
|
171 | // QSignalSpy spy1(m_intervalsaxis, SIGNAL(minChanged(qreal))); | |
|
172 | // QSignalSpy spy2(m_intervalsaxis, SIGNAL(rangeChanged(qreal, qreal))); | |
|
173 | ||
|
174 | // m_intervalsaxis->setMin(min); | |
|
175 | // QVERIFY2(qFuzzyIsNull(m_intervalsaxis->min() - min), "Not equal"); | |
|
176 | ||
|
177 | // QCOMPARE(spy0.count(), 0); | |
|
178 | // QCOMPARE(spy1.count(), 1); | |
|
179 | // QCOMPARE(spy2.count(), 1); | |
|
180 | //} | |
|
181 | ||
|
182 | //void tst_QDateTimeAxis::min_data() | |
|
183 | //{ | |
|
184 | // min_raw_data(); | |
|
185 | //} | |
|
186 | ||
|
187 | //void tst_QDateTimeAxis::min() | |
|
188 | //{ | |
|
189 | // m_chart->setAxisX(m_intervalsaxis, m_series); | |
|
190 | // m_view->show(); | |
|
191 | // QTest::qWaitForWindowShown(m_view); | |
|
192 | // min_raw(); | |
|
193 | //} | |
|
194 | ||
|
195 | //void tst_QDateTimeAxis::min_animation_data() | |
|
196 | //{ | |
|
197 | // min_data(); | |
|
198 | //} | |
|
199 | ||
|
200 | //void tst_QDateTimeAxis::min_animation() | |
|
201 | //{ | |
|
202 | // m_chart->setAnimationOptions(QChart::GridAxisAnimations); | |
|
203 | // min(); | |
|
204 | //} | |
|
205 | ||
|
206 | //void tst_QDateTimeAxis::range_raw_data() | |
|
207 | //{ | |
|
208 | // QTest::addColumn<qreal>("min"); | |
|
209 | // QTest::addColumn<qreal>("max"); | |
|
210 | // QTest::newRow("1.0 - 101.0") << -1.0 << 101.0; | |
|
211 | // QTest::newRow("25.0 - 75.0") << 25.0 << 75.0; | |
|
212 | // QTest::newRow("101.0") << 40.0 << 60.0; | |
|
213 | //} | |
|
214 | ||
|
215 | //void tst_QDateTimeAxis::range_raw() | |
|
216 | //{ | |
|
217 | // QFETCH(qreal, min); | |
|
218 | // QFETCH(qreal, max); | |
|
219 | ||
|
220 | // QSignalSpy spy0(m_intervalsaxis, SIGNAL(maxChanged(qreal))); | |
|
221 | // QSignalSpy spy1(m_intervalsaxis, SIGNAL(minChanged(qreal))); | |
|
222 | // QSignalSpy spy2(m_intervalsaxis, SIGNAL(rangeChanged(qreal, qreal))); | |
|
223 | ||
|
224 | // m_intervalsaxis->setRange(min, max); | |
|
225 | // QVERIFY2(qFuzzyIsNull(m_intervalsaxis->min() - min), "Min not equal"); | |
|
226 | // QVERIFY2(qFuzzyIsNull(m_intervalsaxis->max() - max), "Max not equal"); | |
|
227 | ||
|
228 | // QCOMPARE(spy0.count(), 1); | |
|
229 | // QCOMPARE(spy1.count(), 1); | |
|
230 | // QCOMPARE(spy2.count(), 1); | |
|
231 | //} | |
|
232 | ||
|
233 | //void tst_QDateTimeAxis::range_data() | |
|
234 | //{ | |
|
235 | // range_raw_data(); | |
|
236 | //} | |
|
237 | ||
|
238 | //void tst_QDateTimeAxis::range() | |
|
239 | //{ | |
|
240 | // m_chart->setAxisX(m_intervalsaxis, m_series); | |
|
241 | // m_view->show(); | |
|
242 | // QTest::qWaitForWindowShown(m_view); | |
|
243 | // range_raw(); | |
|
244 | //} | |
|
245 | ||
|
246 | //void tst_QDateTimeAxis::range_animation_data() | |
|
247 | //{ | |
|
248 | // range_data(); | |
|
249 | //} | |
|
250 | ||
|
251 | //void tst_QDateTimeAxis::range_animation() | |
|
252 | //{ | |
|
253 | // m_chart->setAnimationOptions(QChart::GridAxisAnimations); | |
|
254 | // range(); | |
|
255 | //} | |
|
256 | ||
|
257 | QTEST_MAIN(tst_QDateTimeAxis) | |
|
258 | #include "tst_qdatetimeaxis.moc" | |
|
259 |
General Comments 0
You need to be logged in to leave comments.
Login now