summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtexttable/tst_qtexttable.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-16 03:35:55 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-16 03:35:55 (GMT)
commit8d8566d061e26f18e1bde1255fdc1375035c8eaa (patch)
tree7467b6c7742a3d3828b918ecec8a73e1f7998791 /tests/auto/qtexttable/tst_qtexttable.cpp
parent6986f382c8d7b49342f47fe00445685945157187 (diff)
parent17e7b024ba01aba0e525f7fd03b9c5c0ed34e7c8 (diff)
downloadQt-8d8566d061e26f18e1bde1255fdc1375035c8eaa.zip
Qt-8d8566d061e26f18e1bde1255fdc1375035c8eaa.tar.gz
Qt-8d8566d061e26f18e1bde1255fdc1375035c8eaa.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (104 commits) Fixed tst_maketestselftest::tests_pro_files failure remove nasty hack by using a stricter regexp (for language codes) cosmetics: quote the dot in the regexp remove dependency of ts targets on sub-tools add commit-ts target to commit ts files without line number info (re-)add 'untranslated' ts targets more fine-grained ts targets split qt_help out into an own ts target Unbreak the Maemo 5 build after the Symbian fix QNAM HTTP: Fix problem with cached files and metaDataChanged() Add a testcase for QTBUG-11213 to prevent future regressions. Autotest: reenable the NTLM proxy test on tst_QTcpSocket Autotest: add a small, boring test for QAuthenticator Add documentation for the QAuthenticator options. Expose the QAuthenticator map of options in the API. Add a QAuthenticatorPrivate parsing for the headers without QHttpResponseHeader Revert BIC change "Build Qt with option -Zc:wchar_t under MSVC" Fix for tst_qmdisubwindow::fixedMinMaxSize failure on Cocoa Add unit tests for QMimeData. fix qconfig.h reference for shadow builds ...
Diffstat (limited to 'tests/auto/qtexttable/tst_qtexttable.cpp')
-rw-r--r--tests/auto/qtexttable/tst_qtexttable.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/auto/qtexttable/tst_qtexttable.cpp b/tests/auto/qtexttable/tst_qtexttable.cpp
index 2e6007e..9dcc369 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,6 +99,8 @@ private slots:
void removeColumns3();
void removeColumns4();
void removeColumns5();
+ void QTBUG11282_insertBeforeMergedEnding_data();
+ void QTBUG11282_insertBeforeMergedEnding();
private:
QTextTable *create2x2Table();
@@ -586,6 +594,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();
@@ -931,5 +949,42 @@ void tst_QTextTable::removeColumns5()
QCOMPARE(table->cellAt(3, 2).firstPosition(), 11);
}
+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"