summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qimagereader/images/corrupt-pixel-count.xpm11
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp3
-rw-r--r--tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp21
3 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/qimagereader/images/corrupt-pixel-count.xpm b/tests/auto/qimagereader/images/corrupt-pixel-count.xpm
new file mode 100644
index 0000000..3a736ff
--- /dev/null
+++ b/tests/auto/qimagereader/images/corrupt-pixel-count.xpm
@@ -0,0 +1,11 @@
+/* XPM */
+static const char *marble_xpm[] = {
+/* width height num_colors chars_per_pixel */
+"2 2 2 -2",
+/* colors */
+"a c #adadad",
+"b c #dedede",
+/* pixels */
+"ab",
+"ba"
+};
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 69e8ead..5321864 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -1399,6 +1399,9 @@ void tst_QImageReader::readFromResources_data()
QTest::newRow("corrupt-pixels.xpm") << QString("corrupt-pixels.xpm")
<< QByteArray("xpm") << QSize(0, 0)
<< QString("QImage: XPM pixels missing on image line 3");
+ QTest::newRow("corrupt-pixel-count.xpm") << QString("corrupt-pixel-count.xpm")
+ << QByteArray("xpm") << QSize(0, 0)
+ << QString("");
QTest::newRow("marble.xpm") << QString("marble.xpm")
<< QByteArray("xpm") << QSize(240, 240)
<< QString("");
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()