Skip to content

Commit

Permalink
Fix HLM commands tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bgallois committed Jun 21, 2020
1 parent bd008bf commit 72a89d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
21 changes: 12 additions & 9 deletions spyder_vim/tests/test_vim.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,39 +609,42 @@ def test_h_command(vim_bot):
def test_H_command(vim_bot):
"""Test H command (Cursor moves to the top of the screen)."""
main, editor_stack, editor, vim, qtbot = vim_bot
editor.resize(400, 800)
editor.stdkey_backspace()
cmd_line = vim.get_focus_widget()
qtbot.keyClicks(cmd_line, 'VGy')
qtbot.keyClicks(cmd_line, '10pG')
qtbot.keyClicks(cmd_line, 'ggVGy')
qtbot.keyClicks(cmd_line, '100pG')
first_position = editor.cursorForPosition(QPoint(0,0)).position()
qtbot.keyClicks(cmd_line, 'H')
position = editor.textCursor().position()
first_position = editor.cursorForPosition(QPoint(0,0)).position()
assert first_position == position


def test_L_command(vim_bot):
"""Test L command (Cursor moves to the bottom of the screen)."""
main, editor_stack, editor, vim, qtbot = vim_bot
editor.resize(400, 800)
editor.stdkey_backspace()
cmd_line = vim.get_focus_widget()
qtbot.keyClicks(cmd_line, 'VGy')
qtbot.keyClicks(cmd_line, '10pg')
qtbot.keyClicks(cmd_line, 'ggVGy')
qtbot.keyClicks(cmd_line, '100pgg')
first_position = editor.cursorForPosition(QPoint(0, editor.viewport().height())).position()
qtbot.keyClicks(cmd_line, 'L')
position = editor.textCursor().position()
first_position = editor.cursorForPosition(QPoint(0, editor.viewport().height())).position()
assert first_position == position


def test_M_command(vim_bot):
"""Test M command (Cursor moves to the middle of the screen)."""
main, editor_stack, editor, vim, qtbot = vim_bot
editor.resize(400, 800)
editor.stdkey_backspace()
cmd_line = vim.get_focus_widget()
qtbot.keyClicks(cmd_line, 'VGy')
qtbot.keyClicks(cmd_line, '10pg')
qtbot.keyClicks(cmd_line, 'ggVGy')
qtbot.keyClicks(cmd_line, '100p')
first_position = editor.cursorForPosition(QPoint(0, int(editor.viewport().height()*0.5))).position()
qtbot.keyClicks(cmd_line, 'M')
position = editor.textCursor().position()
first_position = editor.cursorForPosition(QPoint(0, int(editor.viewport().height()*0.5))).position()
assert first_position == position


Expand Down
1 change: 0 additions & 1 deletion spyder_vim/vim_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ def M(self, repeat=1):
editor = self._widget.editor()
position = editor.cursorForPosition(QPoint(0, int((editor.viewport().height())*0.5))).position()
self._set_cursor(position, mode=QTextCursor.MoveAnchor)
self.k()

# %% Insertion
def i(self, leftover=None, repeat=1):
Expand Down

0 comments on commit 72a89d6

Please sign in to comment.