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