diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-06-01 10:38:18 (GMT) |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-06-01 10:38:18 (GMT) |
commit | 8d6ac1a041eb26f635914b1c356f47e50cdfdc98 (patch) | |
tree | f317c39984d948391db4cfdc20bfa6fdc8f9aa0c /tests/auto | |
parent | 8709ff7920a378c91ce754a39cae4016709e9e00 (diff) | |
download | Qt-8d6ac1a041eb26f635914b1c356f47e50cdfdc98.zip Qt-8d6ac1a041eb26f635914b1c356f47e50cdfdc98.tar.gz Qt-8d6ac1a041eb26f635914b1c356f47e50cdfdc98.tar.bz2 |
Defines whether the cursor should keep its current position.
Defines whether the cursor should keep its position when
text gets inserted at the current position of the cursor.
For example, we don't want QTextCursor to extend the selection
when inserting characters at the end of an extra selection
representing a user-type but we do want the selection to grow
when rewriting a region of code (e.g. when using our QuickFix engine).
Task-number: QTBUG-11075
Reviewed-by: mae
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qtextcursor/tst_qtextcursor.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp index d44ce72..99babac 100644 --- a/tests/auto/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp @@ -226,9 +226,9 @@ void tst_QTextCursor::navigation1() cursor.movePosition(QTextCursor::End); cursor.insertBlock(); { - int oldPos = cursor.position(); - cursor.movePosition(QTextCursor::End); - QVERIFY(cursor.position() == oldPos); + int oldPos = cursor.position(); + cursor.movePosition(QTextCursor::End); + QVERIFY(cursor.position() == oldPos); } QVERIFY(cursor.atBlockStart()); QVERIFY(cursor.position() == 9); @@ -1699,8 +1699,10 @@ void tst_QTextCursor::adjustCursorsOnInsert() QCOMPARE(selection.position(), posAfter+1); doc->undo(); + selection.setKeepPositionOnInsert(true); cursor.setPosition(posAfter); cursor.insertText(QLatin1String("x")); + selection.setKeepPositionOnInsert(false); QCOMPARE(selection.anchor(), posBefore); QCOMPARE(selection.position(), posAfter); doc->undo(); |