diff options
author | Leandro Melo <leandro.melo@nokia.com> | 2011-08-12 18:45:42 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-17 09:09:03 +0100 |
commit | 85a14abd2e52c832374dd67b3acf05f2b6eaea0e (patch) | |
tree | e724cd3d8cab92d34c4de85926d015171672c087 /tests/auto/gui | |
parent | 402a8c036b2922a23a0a5310c608793d099dd26b (diff) |
Join user state of removed text blocks
Note: Indentation of surrounding code was fixed.
Done-with: mae
(cherry picked from commit 8d3d3381c127f0f4dd9fc507c3069acddbf40535)
Change-Id: I8d3d3381c127f0f4dd9fc507c3069acddbf40535
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r-- | tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp index 09b9a06a1d..d999af166d 100644 --- a/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp @@ -50,6 +50,7 @@ #include <qabstracttextdocumentlayout.h> #include <qtextlayout.h> #include <qtextcursor.h> +#include <qtextobject.h> #include <qdebug.h> QT_FORWARD_DECLARE_CLASS(QTextDocument) @@ -152,6 +153,8 @@ private slots: void cursorPositionWithBlockUndoAndRedo2(); void cursorPositionWithBlockUndoAndRedo3(); + void joinNonEmptyRemovedBlockUserState(); + private: int blockCount(); @@ -1976,5 +1979,20 @@ void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo3() QCOMPARE(cursor.position(), cursorPositionBefore); } +void tst_QTextCursor::joinNonEmptyRemovedBlockUserState() +{ + cursor.insertText("Hello"); + cursor.insertBlock(); + cursor.insertText("World"); + cursor.block().setUserState(10); + + cursor.movePosition(QTextCursor::EndOfBlock); + cursor.movePosition(QTextCursor::PreviousBlock, QTextCursor::KeepAnchor); + cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); + cursor.removeSelectedText(); + + QCOMPARE(cursor.block().userState(), 10); +} + QTEST_MAIN(tst_QTextCursor) #include "tst_qtextcursor.moc" |