From 226a7c77cb35f33fc3b2d49bd9b75c86e429b580 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 10 Jan 2012 09:53:44 +1000 Subject: 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 --- tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index 4ce77ddee9..6514ed589c 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -1063,15 +1063,15 @@ void tst_QDateTimeEdit::enterKey() QCOMPARE(testWidget->lineEdit()->selectedText(), QString("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 &))); QTest::keyClick(testWidget, Qt::Key_Enter); QCOMPARE(enterSpy.count(), 1); - -#if 0 QVariantList list = enterSpy.takeFirst(); - QCOMPARE(list.at(0).toDate(), QDate(2004, 9, 15)); -#endif - + QCOMPARE(list.at(0).toDate(), QDate(2004, 5, 9)); } void tst_QDateTimeEdit::specialValueText() -- cgit v1.2.3