Correct row names in tst_QDateTimeEdit::springForward_data()

The "{forward,back} to %s, correct to nearest" tests were reporting
the time of the transition as %s but, like the jump test, were using
the middle of the gap as the time to set. So compute that mid-time's
string once and use it in all three test names. Also renamed some
local variables to accommodate the new one for this text.

Pick-to: 6.5
Change-Id: Ic6c40c470fc74ae8bcfc0dc9d1596af06318a883
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
Edward Welbourne 2023-03-24 14:52:27 +01:00
parent 28c6868611
commit 4e69b6de4b
1 changed files with 8 additions and 7 deletions

View File

@ -4610,34 +4610,35 @@ void tst_QDateTimeEdit::springForward_data()
QSKIP("Spring forward transition did not actually skip any time!");
const QTime springGap = springTransition.time().addSecs(-gapWidth);
const QByteArray springTime = springGap.toString("hh:mm").toLocal8Bit();
const QTime springGapMiddle = springTransition.time().addSecs(-gapWidth/2);
const QTime springGapMiddle = springTransition.time().addSecs(-gapWidth / 2);
const QByteArray startGapTime = springGap.toString("hh:mm").toLocal8Bit();
const QByteArray midGapTime = springGapMiddle.toString("hh:mm").toLocal8Bit();
QTest::addRow("forward to %s, correct to previous", springTime.data())
QTest::addRow("forward to %s, correct to previous", startGapTime.data())
<< QDateTime(springDate, springGap.addSecs(-gapWidth))
<< QAbstractSpinBox::CorrectToPreviousValue
<< springGap
<< QDateTime(springDate, springGap.addSecs(-gapWidth));
QTest::addRow("back to %s, correct to previous", springTime.data())
QTest::addRow("back to %s, correct to previous", startGapTime.data())
<< springTransition
<< QAbstractSpinBox::CorrectToPreviousValue
<< springGap
<< springTransition;
QTest::addRow("forward to %s, correct to nearest", springTime.data())
QTest::addRow("forward to %s, correct to nearest", midGapTime.data())
<< QDateTime(springDate, springGap.addSecs(-gapWidth))
<< QAbstractSpinBox::CorrectToNearestValue
<< springGapMiddle
<< springTransition;
QTest::addRow("back to %s, correct to nearest", springTime.data())
QTest::addRow("back to %s, correct to nearest", midGapTime.data())
<< springTransition
<< QAbstractSpinBox::CorrectToNearestValue
<< springGapMiddle
<< springTransition;
QTest::addRow("jump to %s, correct to nearest", qPrintable(springGapMiddle.toString("hh:mm")))
QTest::addRow("jump to %s, correct to nearest", midGapTime.data())
<< QDateTime(QDate(1980, 5, 10), springGap)
<< QAbstractSpinBox::CorrectToNearestValue
<< springGapMiddle