|
@@
-48,10
+48,10
private slots:
|
|
48
|
48
|
void min();
|
|
49
|
49
|
// void min_animation_data();
|
|
50
|
50
|
// void min_animation();
|
|
51
|
|
// void range_raw_data();
|
|
52
|
|
// void range_raw();
|
|
53
|
|
// void range_data();
|
|
54
|
|
// void range();
|
|
|
51
|
void range_raw_data();
|
|
|
52
|
void range_raw();
|
|
|
53
|
void range_data();
|
|
|
54
|
void range();
|
|
55
|
55
|
// void range_animation_data();
|
|
56
|
56
|
// void range_animation();
|
|
57
|
57
|
|
|
@@
-77,7
+77,7
void tst_QDateTimeAxis::init()
|
|
77
|
77
|
m_dateTimeAxisY = new QDateTimeAxis();
|
|
78
|
78
|
m_series = new QLineSeries();
|
|
79
|
79
|
*m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100);
|
|
80
|
|
// tst_QAbstractAxis::init(m_datetimeaxis, m_series);
|
|
|
80
|
// tst_QAbstractAxis::init(m_datetimeaxis, m_series);
|
|
81
|
81
|
|
|
82
|
82
|
m_view = new QChartView(new QChart());
|
|
83
|
83
|
m_chart = m_view->chart();
|
|
@@
-97,7
+97,7
void tst_QDateTimeAxis::cleanup()
|
|
97
|
97
|
delete m_view;
|
|
98
|
98
|
m_view = 0;
|
|
99
|
99
|
m_chart = 0;
|
|
100
|
|
// tst_QAbstractAxis::cleanup();
|
|
|
100
|
// tst_QAbstractAxis::cleanup();
|
|
101
|
101
|
}
|
|
102
|
102
|
|
|
103
|
103
|
void tst_QDateTimeAxis::qdatetimeaxis_data()
|
|
@@
-106,10
+106,10
void tst_QDateTimeAxis::qdatetimeaxis_data()
|
|
106
|
106
|
|
|
107
|
107
|
void tst_QDateTimeAxis::qdatetimeaxis()
|
|
108
|
108
|
{
|
|
109
|
|
// qabstractaxis();
|
|
|
109
|
// qabstractaxis();
|
|
110
|
110
|
|
|
111
|
|
// QVERIFY(m_datetimeaxis->max().toMSecsSinceEpoch() == 0);
|
|
112
|
|
// QVERIFY(m_datetimeaxis->min().toMSecsSinceEpoch() == 0);
|
|
|
111
|
// QVERIFY(m_datetimeaxis->max().toMSecsSinceEpoch() == 0);
|
|
|
112
|
// QVERIFY(m_datetimeaxis->min().toMSecsSinceEpoch() == 0);
|
|
113
|
113
|
QCOMPARE(m_dateTimeAxisX->type(), QAbstractAxis::AxisTypeDateTime);
|
|
114
|
114
|
|
|
115
|
115
|
m_view->show();
|
|
@@
-148,7
+148,7
void tst_QDateTimeAxis::max_raw()
|
|
148
|
148
|
QCOMPARE(spy1.count(), 0);
|
|
149
|
149
|
QCOMPARE(spy2.count(), 1);
|
|
150
|
150
|
} else {
|
|
151
|
|
QVERIFY2(m_dateTimeAxisX->max() != max, "Date is invalid");
|
|
|
151
|
QVERIFY2(m_dateTimeAxisX->max() != max, "Date is invalid and should not be set");
|
|
152
|
152
|
QCOMPARE(spy0.count(), 0);
|
|
153
|
153
|
QCOMPARE(spy1.count(), 0);
|
|
154
|
154
|
QCOMPARE(spy2.count(), 0);
|
|
@@
-207,7
+207,7
void tst_QDateTimeAxis::min_raw()
|
|
207
|
207
|
QCOMPARE(spy1.count(), 1);
|
|
208
|
208
|
QCOMPARE(spy2.count(), 1);
|
|
209
|
209
|
} else {
|
|
210
|
|
QVERIFY2(m_dateTimeAxisX->min() != min, "Date is invalid");
|
|
|
210
|
QVERIFY2(m_dateTimeAxisX->min() != min, "Date is invalid and should not be set");
|
|
211
|
211
|
QCOMPARE(spy0.count(), 0);
|
|
212
|
212
|
QCOMPARE(spy1.count(), 0);
|
|
213
|
213
|
QCOMPARE(spy2.count(), 0);
|
|
@@
-238,45
+238,68
void tst_QDateTimeAxis::min()
|
|
238
|
238
|
// min();
|
|
239
|
239
|
//}
|
|
240
|
240
|
|
|
241
|
|
//void tst_QDateTimeAxis::range_raw_data()
|
|
242
|
|
//{
|
|
243
|
|
// QTest::addColumn<qreal>("min");
|
|
244
|
|
// QTest::addColumn<qreal>("max");
|
|
245
|
|
// QTest::newRow("1.0 - 101.0") << -1.0 << 101.0;
|
|
246
|
|
// QTest::newRow("25.0 - 75.0") << 25.0 << 75.0;
|
|
247
|
|
// QTest::newRow("101.0") << 40.0 << 60.0;
|
|
248
|
|
//}
|
|
|
241
|
void tst_QDateTimeAxis::range_raw_data()
|
|
|
242
|
{
|
|
|
243
|
QTest::addColumn<QDateTime>("min");
|
|
|
244
|
QTest::addColumn<bool>("minValid");
|
|
|
245
|
QTest::addColumn<QDateTime>("max");
|
|
|
246
|
QTest::addColumn<bool>("maxValid");
|
|
249
|
247
|
|
|
250
|
|
//void tst_QDateTimeAxis::range_raw()
|
|
251
|
|
//{
|
|
252
|
|
// QFETCH(qreal, min);
|
|
253
|
|
// QFETCH(qreal, max);
|
|
|
248
|
QDateTime minDateTime;
|
|
|
249
|
QDateTime maxDateTime;
|
|
|
250
|
minDateTime.setDate(QDate(1908, 1, 11));
|
|
|
251
|
maxDateTime.setDate(QDate(1958, 11, 21));
|
|
|
252
|
QTest::newRow("11.1.1908 - min valid, 21.12.1958 - max valid") << minDateTime << true << maxDateTime << true; // negative MSecs from Epoch, min < max
|
|
254
|
253
|
|
|
255
|
|
// QSignalSpy spy0(m_intervalsaxis, SIGNAL(maxChanged(qreal)));
|
|
256
|
|
// QSignalSpy spy1(m_intervalsaxis, SIGNAL(minChanged(qreal)));
|
|
257
|
|
// QSignalSpy spy2(m_intervalsaxis, SIGNAL(rangeChanged(qreal, qreal)));
|
|
|
254
|
minDateTime.setDate(QDate(2012, 17, 32));
|
|
|
255
|
QTest::newRow("32.17.2012 - min invalid, 21.12.1958 - max valid") << minDateTime << false << maxDateTime << true;
|
|
258
|
256
|
|
|
259
|
|
// m_intervalsaxis->setRange(min, max);
|
|
260
|
|
// QVERIFY2(qFuzzyIsNull(m_intervalsaxis->min() - min), "Min not equal");
|
|
261
|
|
// QVERIFY2(qFuzzyIsNull(m_intervalsaxis->max() - max), "Max not equal");
|
|
|
257
|
maxDateTime.setDate(QDate(2017, 0, 1));
|
|
|
258
|
QTest::newRow("32.17.2012 - min invalid, 1.0.2017 - max invalid") << minDateTime << false << maxDateTime << false;
|
|
262
|
259
|
|
|
263
|
|
// QCOMPARE(spy0.count(), 1);
|
|
264
|
|
// QCOMPARE(spy1.count(), 1);
|
|
265
|
|
// QCOMPARE(spy2.count(), 1);
|
|
266
|
|
//}
|
|
|
260
|
minDateTime.setDate(QDate(2012, 1, 1));
|
|
|
261
|
QTest::newRow("1.1.2012 - min valid, 1.0.2017 - max invalid") << minDateTime << true << maxDateTime << false;
|
|
267
|
262
|
|
|
268
|
|
//void tst_QDateTimeAxis::range_data()
|
|
269
|
|
//{
|
|
270
|
|
// range_raw_data();
|
|
271
|
|
//}
|
|
|
263
|
maxDateTime.setDate(QDate(2005, 2, 5));
|
|
|
264
|
QTest::newRow("1.1.2012 - min valid, 5.2.2005 - max valid") << minDateTime << true << maxDateTime << true; // min > max
|
|
|
265
|
}
|
|
272
|
266
|
|
|
273
|
|
//void tst_QDateTimeAxis::range()
|
|
274
|
|
//{
|
|
275
|
|
// m_chart->setAxisX(m_intervalsaxis, m_series);
|
|
276
|
|
// m_view->show();
|
|
277
|
|
// QTest::qWaitForWindowShown(m_view);
|
|
278
|
|
// range_raw();
|
|
279
|
|
//}
|
|
|
267
|
void tst_QDateTimeAxis::range_raw()
|
|
|
268
|
{
|
|
|
269
|
QFETCH(QDateTime, min);
|
|
|
270
|
QFETCH(bool, minValid);
|
|
|
271
|
QFETCH(QDateTime, max);
|
|
|
272
|
QFETCH(bool, maxValid);
|
|
|
273
|
|
|
|
274
|
QSignalSpy spy0(m_dateTimeAxisX, SIGNAL(maxChanged(QDateTime)));
|
|
|
275
|
QSignalSpy spy1(m_dateTimeAxisX, SIGNAL(minChanged(QDateTime)));
|
|
|
276
|
QSignalSpy spy2(m_dateTimeAxisX, SIGNAL(rangeChanged(QDateTime, QDateTime)));
|
|
|
277
|
|
|
|
278
|
m_dateTimeAxisX->setRange(min, max);
|
|
|
279
|
|
|
|
280
|
if (minValid && maxValid && min < max) {
|
|
|
281
|
QCOMPARE(spy0.count(), 1);
|
|
|
282
|
QCOMPARE(spy1.count(), 1);
|
|
|
283
|
QCOMPARE(spy2.count(), 1);
|
|
|
284
|
} else {
|
|
|
285
|
QCOMPARE(spy0.count(), 0);
|
|
|
286
|
QCOMPARE(spy1.count(), 0);
|
|
|
287
|
QCOMPARE(spy2.count(), 0);
|
|
|
288
|
}
|
|
|
289
|
}
|
|
|
290
|
|
|
|
291
|
void tst_QDateTimeAxis::range_data()
|
|
|
292
|
{
|
|
|
293
|
range_raw_data();
|
|
|
294
|
}
|
|
|
295
|
|
|
|
296
|
void tst_QDateTimeAxis::range()
|
|
|
297
|
{
|
|
|
298
|
m_chart->setAxisX(m_dateTimeAxisX, m_series);
|
|
|
299
|
m_view->show();
|
|
|
300
|
QTest::qWaitForWindowShown(m_view);
|
|
|
301
|
range_raw();
|
|
|
302
|
}
|
|
280
|
303
|
|
|
281
|
304
|
//void tst_QDateTimeAxis::range_animation_data()
|
|
282
|
305
|
//{
|