summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/itemviews
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-03-21 20:41:57 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-28 02:01:49 +0200
commitc3e1abad4e141e6e9d876e5cff194c473a2654eb (patch)
tree6878ee94b8901d402332a027e7081631f8ddcba6 /tests/auto/widgets/itemviews
parente7a6dacf805602eb76786244da76dae29624bfb7 (diff)
Add USER properties to QDateEdit and QTimeEdit.
Both classes had such components before, but there were issues with the NOTIFY signal not being in the same class as the Q_PROPERTY. This patch solves that problem by using a signal of a different name. Task-number: QTBUG-15731 Change-Id: Ibc7ce4dba8a6b88c05d62a90e14d0101c5cd3082 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'tests/auto/widgets/itemviews')
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
index 2b52f5f234..497cdfdeee 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
@@ -780,6 +780,9 @@ void tst_QItemDelegate::dateTimeEditor()
QTimeEdit *timeEditor = qFindChild<QTimeEdit *>(widget.viewport());
QVERIFY(timeEditor);
QCOMPARE(timeEditor->time(), time);
+ // The data must actually be different in order for the model
+ // to be updated.
+ timeEditor->setTime(time.addSecs(60));
widget.clearFocus();
qApp->setActiveWindow(&widget);
@@ -791,6 +794,7 @@ void tst_QItemDelegate::dateTimeEditor()
QDateEdit *dateEditor = qFindChild<QDateEdit *>(widget.viewport());
QVERIFY(dateEditor);
QCOMPARE(dateEditor->date(), date);
+ dateEditor->setDate(date.addDays(60));
widget.clearFocus();
widget.setFocus();
@@ -806,6 +810,12 @@ void tst_QItemDelegate::dateTimeEditor()
QVERIFY(dateTimeEditor);
QCOMPARE(dateTimeEditor->date(), date);
QCOMPARE(dateTimeEditor->time(), time);
+ dateTimeEditor->setTime(time.addSecs(600));
+ widget.clearFocus();
+
+ QVERIFY(item1->data(Qt::EditRole).userType() == QMetaType::QTime);
+ QVERIFY(item2->data(Qt::EditRole).userType() == QMetaType::QDate);
+ QVERIFY(item3->data(Qt::EditRole).userType() == QMetaType::QDateTime);
}
void tst_QItemDelegate::decoration_data()