summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsqltablemodel
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-02-18 16:05:36 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-02-18 16:05:36 (GMT)
commitf175c9e91cfb0395ff746ee0804495f5c01018dd (patch)
treed4448232f54531fa70072e290d281559794063c5 /tests/auto/qsqltablemodel
parent6796df2c4cbfa658d563a0786b4ba83597247b8d (diff)
parent177131d06d0d7a39d5de210ac8ed5dff9ca4999f (diff)
downloadQt-f175c9e91cfb0395ff746ee0804495f5c01018dd.zip
Qt-f175c9e91cfb0395ff746ee0804495f5c01018dd.tar.gz
Qt-f175c9e91cfb0395ff746ee0804495f5c01018dd.tar.bz2
Merge branch 4.7 into qt-master-from-4.7
Diffstat (limited to 'tests/auto/qsqltablemodel')
-rw-r--r--tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
index f7d2180..bf68375 100644
--- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -773,6 +773,27 @@ void tst_QSqlTableModel::removeInsertedRow()
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond"));
QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi"));
+
+ // Now insert a row with a null, and check that removing it also works (QTBUG-15979 etc)
+ model.insertRow(1);
+ model.setData(model.index(1,0), 55);
+ model.setData(model.index(1,1), QString("null columns"));
+ model.setData(model.index(1,2), QVariant());
+
+ model.submitAll();
+
+ QCOMPARE(model.rowCount(), 4);
+ QCOMPARE(model.data(model.index(3, 0)).toInt(), 55);
+ QCOMPARE(model.data(model.index(3, 1)).toString(), QString("null columns"));
+ QCOMPARE(model.data(model.index(3, 2)).isNull(), true);
+
+ QVERIFY(model.removeRow(3));
+ model.submitAll();
+ QCOMPARE(model.rowCount(), 3);
+
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond"));
+ QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi"));
}
void tst_QSqlTableModel::removeInsertedRows()