diff options
Diffstat (limited to 'tests/system/shared/editor_utils.py')
-rw-r--r-- | tests/system/shared/editor_utils.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index 45d533420e..c438804429 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -68,17 +68,12 @@ def openContextMenuOnTextCursorPosition(editor): waitFor("menuVisibleAtEditor(editor, menuInList)", 5000) return menuInList[0] -# this function marks/selects the text inside the given editor from position -# startPosition to endPosition (both inclusive) -def markText(editor, startPosition, endPosition): - cursor = editor.textCursor() - cursor.setPosition(startPosition) - cursor.movePosition(QTextCursor.StartOfLine) - editor.setTextCursor(cursor) - cursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor, endPosition-startPosition) - cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor) - cursor.setPosition(endPosition, QTextCursor.KeepAnchor) - editor.setTextCursor(cursor) +# this function marks/selects the text inside the given editor from current cursor position +# param direction is one of "Left", "Right", "Up", "Down", but "End" and combinations work as well +# param typeCount defines how often the cursor will be moved in the given direction (while marking) +def markText(editor, direction, typeCount=1): + for i in range(typeCount): + type(editor, "<Shift+%s>" % direction) # works for all standard editors def replaceEditorContent(editor, newcontent): |