diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-08-15 12:07:32 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-08-15 12:07:32 (GMT) |
commit | 35665053a56f7c74e45d65234630a130ba24a27a (patch) | |
tree | 1834ae789f99cfc128c766d45818a7e5c0c5c639 | |
parent | 167daf1d0d3144cacd3ed79a3faa0d7c7f5d7f1f (diff) | |
parent | 8d3d3381c127f0f4dd9fc507c3069acddbf40535 (diff) | |
download | Qt-35665053a56f7c74e45d65234630a130ba24a27a.zip Qt-35665053a56f7c74e45d65234630a130ba24a27a.tar.gz Qt-35665053a56f7c74e45d65234630a130ba24a27a.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:
Join user state of removed text blocks
-rw-r--r-- | src/gui/text/qtextdocument_p.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qtextcursor/tst_qtextcursor.cpp | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index fde7216..a31e9d3 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -539,6 +539,7 @@ int QTextDocumentPrivate::remove_block(int pos, int *blockFormat, int command, Q int n = blocks.next(b); Q_ASSERT((int)blocks.position(n) == pos + 1); blocks.setSize(b, blocks.size(b) + blocks.size(n) - 1); + blocks.fragment(b)->userState = blocks.fragment(n)->userState; b = n; } *blockFormat = blocks.fragment(b)->format; diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp index bb5a212..b48cfe7 100644 --- a/tests/auto/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp @@ -50,6 +50,7 @@ #include <qabstracttextdocumentlayout.h> #include <qtextlayout.h> #include <qtextcursor.h> +#include <qtextobject.h> #include <qdebug.h> //TESTED_FILES=gui/text/qtextcursor.cpp gui/text/qtextcursor_p.h @@ -154,6 +155,8 @@ private slots: void cursorPositionWithBlockUndoAndRedo2(); void cursorPositionWithBlockUndoAndRedo3(); + void joinNonEmptyRemovedBlockUserState(); + private: int blockCount(); @@ -1858,5 +1861,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" |