diff options
author | mae <qt-info@nokia.com> | 2009-05-08 11:35:58 (GMT) |
---|---|---|
committer | mae <qt-info@nokia.com> | 2009-05-08 14:42:50 (GMT) |
commit | da1234d6ea6c5e3c0b84d64fbe9ac15a7c3f30d3 (patch) | |
tree | 158963a38c83a5a561fb40adf4cf2b0708afb039 /tests/auto | |
parent | 4c7004122a858cd6d891efc7923ba11484fbf997 (diff) | |
download | Qt-da1234d6ea6c5e3c0b84d64fbe9ac15a7c3f30d3.zip Qt-da1234d6ea6c5e3c0b84d64fbe9ac15a7c3f30d3.tar.gz Qt-da1234d6ea6c5e3c0b84d64fbe9ac15a7c3f30d3.tar.bz2 |
Extend QTextDocument test
This new test tests desired undo merging behaviour after insertions.
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qtextdocument/tst_qtextdocument.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index 4ef5299..63a172b 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -161,6 +161,8 @@ private slots: void testUndoCommandAdded(); + void testUndoBlocks(); + private: void backgroundImage_checkExpectedHtml(const QTextDocument &doc); @@ -2435,5 +2437,21 @@ void tst_QTextDocument::testUndoCommandAdded() QCOMPARE(spy.count(), 1); } +void tst_QTextDocument::testUndoBlocks() +{ + QVERIFY(doc); + cursor.insertText("Hello World"); + cursor.insertText("period"); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("")); + cursor.insertText("Hello World"); + cursor.insertText("One\nTwo\nThree"); + QCOMPARE(doc->toPlainText(), QString("Hello WorldOne\nTwo\nThree")); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("Hello World")); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("")); +} + QTEST_MAIN(tst_QTextDocument) #include "tst_qtextdocument.moc" |