summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2012-07-12 12:55:04 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-12 18:29:25 +0200
commitf94d0ea1dca36d5a93c83564cb873537edf6e2c7 (patch)
tree108d9c14600f0f17f4d7b69e2b5ce765d59e36b2 /tests/auto/gui
parent89a558d6b0fac4281153e80470e393ba227494c4 (diff)
Fix crash when column is inserted before rowspanned cell
When you're inserting a column in front of a rowspanned cell and this cell is not the first in the rowspan, we would get the wrong logical index of the new cell (putting it in front of the initial cell with the rowspan). If the cell does not span all rows, the table will get into a broken state and trigger asserts in update(). To fix this, we search for the first cell after the insertion point which has a logical index higher than the cell directly before the insertion point. Change-Id: I42e91a20d77b2ba9c5607f6cab23f51ed888cbd3 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/text/qtexttable/tst_qtexttable.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp
index 89dbbd7e85..d0b5f8952f 100644
--- a/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp
+++ b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp
@@ -104,6 +104,7 @@ private slots:
void QTBUG11282_insertBeforeMergedEnding_data();
void QTBUG11282_insertBeforeMergedEnding();
#endif
+ void QTBUG22011_insertBeforeRowSpan();
private:
QTextTable *create2x2Table();
@@ -1004,5 +1005,33 @@ void tst_QTextTable::QTBUG11282_insertBeforeMergedEnding()
}
#endif
+void tst_QTextTable::QTBUG22011_insertBeforeRowSpan()
+{
+ QTextDocument doc;
+ QTextCursor cursor(&doc);
+ QTextTable *table = cursor.insertTable(1,1); // 1x1
+
+ table->appendColumns(1); // 1x2
+ table->appendRows(1); // 2x2
+ table->mergeCells(0, 0, 2, 1); // 2x2
+ table->insertColumns(1, 1); // 2x3
+ table->mergeCells(0, 1, 1, 2); // 2x3
+ table->appendRows(1); // 3x3
+ table->mergeCells(0, 0, 3, 1); // 3x3
+ table->appendRows(1); // 4x3
+ table->insertColumns(1, 1); // 4x4
+ table->mergeCells(0, 1, 1, 3);
+ table->mergeCells(1, 1, 1, 2);
+ table->mergeCells(2, 1, 1, 2);
+ table->mergeCells(3, 0, 1, 2);
+ table->insertColumns(3, 1); // 4x5
+ table->mergeCells(0, 1, 1, 4);
+
+ table->appendColumns(1); // 4x6
+
+ QCOMPARE(table->rows(), 4);
+ QCOMPARE(table->columns(), 6);
+}
+
QTEST_MAIN(tst_QTextTable)
#include "tst_qtexttable.moc"