Explain the cases where we must exclude some QDTE test cases
The stepIntoDSTGap() hour cases were already conditioned on hour > 0, explain why. The month and year tests need similar checks for kindred reasons; add and document those checks. Pick-to: 6.5 Change-Id: Ibcb69449fcd572ee94306a805fd680e9b5155322 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
ee46c645a6
commit
9f11574a7d
@ -4713,7 +4713,7 @@ void tst_QDateTimeEdit::stepIntoDSTGap_data()
|
|||||||
const QTime springGap = springTransition.time().addSecs(-gapWidth);
|
const QTime springGap = springTransition.time().addSecs(-gapWidth);
|
||||||
const QByteArray springTime = springGap.toString("hh:mm").toLocal8Bit();
|
const QByteArray springTime = springGap.toString("hh:mm").toLocal8Bit();
|
||||||
|
|
||||||
// change hour
|
// change hour (can't change day):
|
||||||
if (springGap.hour() != 0) {
|
if (springGap.hour() != 0) {
|
||||||
QTest::addRow("hour up into %s gap", springTime.data())
|
QTest::addRow("hour up into %s gap", springTime.data())
|
||||||
<< QDateTime(spring, springGap.addSecs(-3600))
|
<< QDateTime(spring, springGap.addSecs(-3600))
|
||||||
@ -4748,28 +4748,31 @@ void tst_QDateTimeEdit::stepIntoDSTGap_data()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// change month
|
// change month
|
||||||
QTest::addRow("month up into %s gap", springTime.data())
|
// Previous month may well be February, so lack the day-of-month that
|
||||||
<< QDateTime(spring.addMonths(-1), springGap)
|
// matches spring (e.g. Asia/Jerusalem, March 30).
|
||||||
<< QDateTimeEdit::MonthSection
|
if (QDate prior = spring.addMonths(-1); prior.day() == spring.day()) {
|
||||||
<< +1
|
QTest::addRow("month up into %s gap", springTime.data())
|
||||||
<< springTransition;
|
<< QDateTime(prior, springGap) << QDateTimeEdit::MonthSection << +1 << springTransition;
|
||||||
QTest::addRow("month down into %s gap", springTime.data())
|
}
|
||||||
<< QDateTime(spring.addMonths(1), springGap)
|
// America/{Jujuy,Cordoba,Catamarca} did a 2007 Dec 30th 00:00 spring
|
||||||
<< QDateTimeEdit::MonthSection
|
// forward; and QDTE month steps won't change the year.
|
||||||
<< -1
|
if (QDate prior = spring.addMonths(1);
|
||||||
<< springTransition;
|
prior.year() == spring.year() && prior.day() == spring.day()) {
|
||||||
|
QTest::addRow("month down into %s gap", springTime.data())
|
||||||
|
<< QDateTime(prior, springGap) << QDateTimeEdit::MonthSection << -1 << springTransition;
|
||||||
|
}
|
||||||
|
|
||||||
// change year
|
// change year
|
||||||
QTest::addRow("year up into %s gap", springTime.data())
|
// Some zones (e.g. Asia/Baghdad) do transitions on a fixed date; for these,
|
||||||
<< QDateTime(spring.addYears(-1), springGap)
|
// the springGap moment is invalid every year, so skip this test.
|
||||||
<< QDateTimeEdit::YearSection
|
if (QDateTime prior = QDateTime(spring.addYears(-1), springGap); prior.isValid()) {
|
||||||
<< +1
|
QTest::addRow("year up into %s gap", springTime.data())
|
||||||
<< springTransition;
|
<< prior << QDateTimeEdit::YearSection << +1 << springTransition;
|
||||||
QTest::addRow("year down into %s gap", springTime.data())
|
}
|
||||||
<< QDateTime(spring.addYears(1), springGap)
|
if (QDateTime later(spring.addYears(1), springGap); later.isValid()) {
|
||||||
<< QDateTimeEdit::YearSection
|
QTest::addRow("year down into %s gap", springTime.data())
|
||||||
<< -1
|
<< later << QDateTimeEdit::YearSection << -1 << springTransition;
|
||||||
<< springTransition;
|
}
|
||||||
#else
|
#else
|
||||||
QSKIP("Needs timezone feature enabled");
|
QSKIP("Needs timezone feature enabled");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user