summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMark Brand <mabrand@mabrand.nl>2012-02-29 01:51:23 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-15 15:35:22 +0100
commit3d7cec6577fa32fb6036b346db57c53e38ea2ffd (patch)
treeef364191256bdbc778629403cf3307a31e125301 /tests/auto
parentf6ca63f896b5f9a330ff497aebff6943653dc35d (diff)
QSqlTableModel: disallow insert if changes are pending
For OnFieldChange and OnRowChange, inserting rows should not be allowed if there are pending changes in cache. Change-Id: Ia794332959a35a1de87e798ba1a74ace3dfae68f Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
index bb1131655d..0bdcb3bce6 100644
--- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -590,11 +590,15 @@ void tst_QSqlTableModel::insertRowFailure()
QCOMPARE(model.data(model.index(1, 1)).toString(), QString("blah"));
QFAIL_SQL(model, setRecord(1, values));
QCOMPARE(model.data(model.index(1, 1)).toString(), QString("blah"));
+ QFAIL_SQL(model, insertRow(2));
+ QCOMPARE(model.rowCount(), 2);
} else {
QVERIFY_SQL(model, setData(model.index(1, 1), QString("eggs")));
QCOMPARE(model.data(model.index(1, 1)).toString(), QString("eggs"));
QVERIFY_SQL(model, setRecord(1, values));
QCOMPARE(model.data(model.index(1, 1)).toString(), QString("spam"));
+ QVERIFY_SQL(model, insertRow(2));
+ QCOMPARE(model.rowCount(), 3);
}
// restore empty table