diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2010-07-17 23:31:36 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2010-07-17 23:31:36 (GMT) |
commit | 8d545a21b6aa89675b404a9d7bf08b7499d26e5e (patch) | |
tree | 761c900e05538a337517435d5337392f7fc8931d /tests/auto/qtexttable/tst_qtexttable.cpp | |
parent | 571b85896ee3663479b4a10d2418e2e19b3639f3 (diff) | |
parent | d61c74faef2ed787aacc53c03b8361fa57bccc8e (diff) | |
download | Qt-8d545a21b6aa89675b404a9d7bf08b7499d26e5e.zip Qt-8d545a21b6aa89675b404a9d7bf08b7499d26e5e.tar.gz Qt-8d545a21b6aa89675b404a9d7bf08b7499d26e5e.tar.bz2 |
Merge remote branch 'origin/4.7' into 4.7-from-4.6
Conflicts:
tests/auto/qtexttable/tst_qtexttable.cpp
Diffstat (limited to 'tests/auto/qtexttable/tst_qtexttable.cpp')
-rw-r--r-- | tests/auto/qtexttable/tst_qtexttable.cpp | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/tests/auto/qtexttable/tst_qtexttable.cpp b/tests/auto/qtexttable/tst_qtexttable.cpp index c6ead5a..a811b85 100644 --- a/tests/auto/qtexttable/tst_qtexttable.cpp +++ b/tests/auto/qtexttable/tst_qtexttable.cpp @@ -48,9 +48,14 @@ #include <qtexttable.h> #include <qdebug.h> #include <qtextcursor.h> +#include <qtextdocument.h> +#include <qtextedit.h> //TESTED_FILES= +typedef QList<int> IntList; +Q_DECLARE_METATYPE(IntList) + QT_FORWARD_DECLARE_CLASS(QTextDocument) class tst_QTextTable : public QObject @@ -78,6 +83,7 @@ private slots: void insertRows(); void deleteInTable(); void mergeCells(); + void mergeAndInsert(); void splitCells(); void blocksForTableShouldHaveEmptyFormat(); void removeTableByRemoveRows(); @@ -93,7 +99,9 @@ private slots: void removeColumns3(); void removeColumns4(); void removeColumns5(); - void removeColumnsInTableWithMergedRows(); + void removeColumnsInTableWithMergedRows(); + void QTBUG11282_insertBeforeMergedEnding_data(); + void QTBUG11282_insertBeforeMergedEnding(); private: QTextTable *create2x2Table(); @@ -587,6 +595,16 @@ void tst_QTextTable::mergeCells() QVERIFY(table->cellAt(0, 1) == table->cellAt(1, 1)); } +void tst_QTextTable::mergeAndInsert() +{ + QTextTable *table = cursor.insertTable(4,3); + table->mergeCells(0,1,3,2); + table->mergeCells(3,0,1,3); + //Don't crash ! + table->insertColumns(1,2); + QCOMPARE(table->columns(), 5); +} + void tst_QTextTable::splitCells() { QTextTable *table = create4x4Table(); @@ -945,5 +963,42 @@ void tst_QTextTable::removeColumnsInTableWithMergedRows() QCOMPARE(table->columns(), 1); } +void tst_QTextTable::QTBUG11282_insertBeforeMergedEnding_data() +{ + QTest::addColumn<int>("rows"); + QTest::addColumn<int>("columns"); + QTest::addColumn<QList<int> >("merge"); + QTest::addColumn<QList<int> >("insert"); + + QTest::newRow("2x3, merge two, insert one") << 2 << 3 << (QList<int>() << 1 << 2 << 2) + << (QList<int>() << 1 << 1) ; + QTest::newRow("3x4, merge three, insert one") << 3 << 4 << (QList<int>() << 1 << 3 << 3) + << (QList<int>() << 1 << 1) ; + QTest::newRow("4x3, merge two, insert two") << 4 << 3 << (QList<int>() << 1 << 4 << 2) + << (QList<int>() << 1 << 2) ; + QTest::newRow("4x4, merge middle two, insert one") << 4 << 4 << (QList<int>() << 1 << 4 << 2) + << (QList<int>() << 1 << 1) ; +} + +void tst_QTextTable::QTBUG11282_insertBeforeMergedEnding() +{ + QFETCH(int, rows); + QFETCH(int, columns); + QFETCH(QList<int>, merge); + QFETCH(QList<int>, insert); + QTextTable *table = cursor.insertTable(rows, columns); + QTextEdit *textEdit = new QTextEdit; + textEdit->setDocument(doc); + textEdit->show(); + QTest::qWaitForWindowShown(textEdit); + table->mergeCells(0,merge.at(0), merge.at(1), merge.at(2)); + //Don't crash ! + table->insertColumns(insert.at(0), insert.at(1)); + //Check that the final size is what we expected + QCOMPARE(table->rows(), rows); + QCOMPARE(table->columns(), columns + insert.at(1)); + delete textEdit; +} + QTEST_MAIN(tst_QTextTable) #include "tst_qtexttable.moc" |