Improve QDateTimeEdit autotest.

Reinstate a check that was presumably disabled because it wasn't
checking for the right expected date.  At present pressing Enter in a
QDateTimeEdit without changing the date still emits the dataChanged()
signal.  By reinstating the test, we ensure that the behaviour can't
change by accident.

Change-Id: I1b766af6ced001a4191606247338dbc91049cb8d
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Jason McDonald 2012-01-10 09:53:44 +10:00 committed by Qt by Nokia
parent 626223ca27
commit 226a7c77cb

View File

@ -1063,15 +1063,15 @@ void tst_QDateTimeEdit::enterKey()
QCOMPARE(testWidget->lineEdit()->selectedText(), QString("9")); QCOMPARE(testWidget->lineEdit()->selectedText(), QString("9"));
QCOMPARE(testWidget->date(), QDate(2004, 5, 9)); QCOMPARE(testWidget->date(), QDate(2004, 5, 9));
// Current behaviour is that pressing the Enter key in a QDateTimeEdit
// causes the dateChanged() signal to be emitted, even if the date
// wasn't actually changed. While this behaviour is questionable,
// we include this test so a change to the behaviour can't go unnoticed.
QSignalSpy enterSpy(testWidget, SIGNAL(dateChanged(const QDate &))); QSignalSpy enterSpy(testWidget, SIGNAL(dateChanged(const QDate &)));
QTest::keyClick(testWidget, Qt::Key_Enter); QTest::keyClick(testWidget, Qt::Key_Enter);
QCOMPARE(enterSpy.count(), 1); QCOMPARE(enterSpy.count(), 1);
#if 0
QVariantList list = enterSpy.takeFirst(); QVariantList list = enterSpy.takeFirst();
QCOMPARE(list.at(0).toDate(), QDate(2004, 9, 15)); QCOMPARE(list.at(0).toDate(), QDate(2004, 5, 9));
#endif
} }
void tst_QDateTimeEdit::specialValueText() void tst_QDateTimeEdit::specialValueText()