summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qtextcursor/tst_qtextcursor.cpp18
1 files changed, 18 insertions, 0 deletions
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"