diff options
author | mae <qt-info@nokia.com> | 2009-08-20 15:22:04 (GMT) |
---|---|---|
committer | mae <qt-info@nokia.com> | 2009-08-20 16:10:54 (GMT) |
commit | 9933000d86bd9560769cb900b9e22083a073d837 (patch) | |
tree | 46b6cf6a00512a9a367e5ec1b5fda0f91d29971a /tests/auto/qtextdocument | |
parent | fc0ba93d93c9fb5570d8484599bdd7bbccf95829 (diff) | |
download | Qt-9933000d86bd9560769cb900b9e22083a073d837.zip Qt-9933000d86bd9560769cb900b9e22083a073d837.tar.gz Qt-9933000d86bd9560769cb900b9e22083a073d837.tar.bz2 |
Extend testUndoBlock() with a single command block insert
Test a newly discovered bug when a beginEditBlock()/endEditoBlock()
contains only one single insertion command. It should still be treated
as an undo block of its own.
Diffstat (limited to 'tests/auto/qtextdocument')
-rw-r--r-- | tests/auto/qtextdocument/tst_qtextdocument.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index 4643df0..cffa437 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -2490,6 +2490,25 @@ void tst_QTextDocument::testUndoBlocks() QCOMPARE(doc->toPlainText(), QString("Hello WorldOne\nTwo\nThree")); doc->undo(); QCOMPARE(doc->toPlainText(), QString("Hello World")); + cursor.insertText("One\nTwo\nThree"); + cursor.insertText("Trailing text"); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("Hello WorldOne\nTwo\nThree")); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("Hello World")); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("")); + + cursor.insertText("quod"); + cursor.beginEditBlock(); + cursor.insertText(" erat"); + cursor.endEditBlock(); + cursor.insertText(" demonstrandum"); + QCOMPARE(doc->toPlainText(), QString("quod erat demonstrandum")); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("quod erat")); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("quod")); doc->undo(); QCOMPARE(doc->toPlainText(), QString("")); } |