summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdatetimeedit
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>2010-07-29 14:09:04 (GMT)
committerFrederik Gladhorn <frederik.gladhorn@nokia.com>2010-07-29 14:09:04 (GMT)
commit96c8fdd87878da258286e053edf1046750485821 (patch)
treec63a6083df1c5e832f2762ffdf94a93de3cc0aa4 /tests/auto/qdatetimeedit
parent11468d1086315c2d4f77f3747488e423d499bf56 (diff)
downloadQt-96c8fdd87878da258286e053edf1046750485821.zip
Qt-96c8fdd87878da258286e053edf1046750485821.tar.gz
Qt-96c8fdd87878da258286e053edf1046750485821.tar.bz2
Setting a timeSpec on QDateTimeEdit breaks the edit when only time is shown
Because of the time zone change we get an "overflow" in the min and max time. For example min 00:00:00 becomes 01:00:00 and max 23:59:59 becomes 00:59:59 which is an invalid time span and the displayed time gets fixed to the newly set min/max value. Autotest included. Task-number: QTBUG-12384 Reviewed-by: Gabriel
Diffstat (limited to 'tests/auto/qdatetimeedit')
-rw-r--r--tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
index 3125258..50b0e0a 100644
--- a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -273,6 +273,9 @@ private slots:
void task196924();
void focusNextPrevChild();
+
+ void taskQTBUG_12384_timeSpecShowTimeOnly();
+
private:
EditorDateEdit* testWidget;
QWidget *testFocusWidget;
@@ -3420,7 +3423,20 @@ void tst_QDateTimeEdit::focusNextPrevChild()
QCOMPARE(edit.currentSection(), QDateTimeEdit::MonthSection);
}
+void tst_QDateTimeEdit::taskQTBUG_12384_timeSpecShowTimeOnly()
+{
+ QDateTime time = QDateTime::fromString("20100723 04:02:40", "yyyyMMdd hh:mm:ss");
+ time.setTimeSpec(Qt::UTC);
+
+ EditorDateEdit edit;
+ edit.setDisplayFormat("hh:mm:ss");
+ edit.setTimeSpec(Qt::UTC);
+ edit.setDateTime(time);
+ QCOMPARE(edit.minimumTime(), QTime(0, 0, 0, 0));
+ QCOMPARE(edit.maximumTime(), QTime(23, 59, 59, 999));
+ QCOMPARE(edit.time(), time.time());
+}
QTEST_MAIN(tst_QDateTimeEdit)
#include "tst_qdatetimeedit.moc"