summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsqltablemodel
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2010-11-03 01:58:36 (GMT)
committerMichael Goddard <michael.goddard@nokia.com>2011-02-04 05:41:02 (GMT)
commit3bed865c35d8eb920ba5a68276fdf1690c834a64 (patch)
treedd733baba6540ab7089b5e2d0e7358b344476546 /tests/auto/qsqltablemodel
parent9c61e9a40e774fe32b16c133a5cdd6b9d9d29d83 (diff)
downloadQt-3bed865c35d8eb920ba5a68276fdf1690c834a64.zip
Qt-3bed865c35d8eb920ba5a68276fdf1690c834a64.tar.gz
Qt-3bed865c35d8eb920ba5a68276fdf1690c834a64.tar.bz2
Make sure that setRecord emits dataChanged() with OnManualSubmit.
Since the change is immediately visible through data(), this is needed so that QSortFilterProxyModel etc work correctly. Change-Id: Ied7afce2e6a1f516b502d3501f9d214df54e52f2 Task-number: QTBUG-14831 Reviewed-by: Charles Yin
Diffstat (limited to 'tests/auto/qsqltablemodel')
-rw-r--r--tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
index 1821d9c..9428ef4 100644
--- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -402,9 +402,14 @@ void tst_QSqlTableModel::setRecord()
rec.setValue(2, rec.value(2).toString() + 'X');
QVERIFY(model.setRecord(i, rec));
- if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit)
+ if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit) {
+ // setRecord should emit dataChanged() itself for manualSubmit
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).count(), 2);
+ QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(0)), model.index(i, 0));
+ QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(1)), model.index(i, rec.count() - 1));
QVERIFY(model.submitAll());
- else if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnRowChange && i == model.rowCount() -1)
+ } else if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnRowChange && i == model.rowCount() -1)
model.submit();
else {
// dataChanged() is not emitted when submitAll() is called