diff options
author | adam <ibrahimadam193@gmail.com> | 2019-01-20 14:43:27 -0500 |
---|---|---|
committer | adam <ibrahimadam193@gmail.com> | 2019-01-20 14:43:27 -0500 |
commit | 65a22165b6fd863e1f97c6aec91067050fac83e4 (patch) | |
tree | 690fe18fc6c7c5f6f7a476c1535dc9d0fe5569a2 /tests/unit/browser/test_caret.py | |
parent | 35f86f66b99c643de047a04718795d7f218f4132 (diff) | |
download | qutebrowser-65a22165b6fd863e1f97c6aec91067050fac83e4.tar.gz qutebrowser-65a22165b6fd863e1f97c6aec91067050fac83e4.zip |
Move tests from caret.feature to test_caret.py
Also changed one of the tests to be a better test of reversing the
selection. `tests/unit/browser/test_caret.py:TestReverse:test_reverse`
reverses the selection multiple times and tests out motions several
times, making sure that the selection can be reversed more than once (I
had a bug where the selection was reversed only once), and the selection
is updated correctly after several motions.
Changes to be committed:
modified: tests/end2end/features/caret.feature
modified: tests/unit/browser/test_caret.py
Diffstat (limited to 'tests/unit/browser/test_caret.py')
-rw-r--r-- | tests/unit/browser/test_caret.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/unit/browser/test_caret.py b/tests/unit/browser/test_caret.py index b3706ffca..e0401f9a9 100644 --- a/tests/unit/browser/test_caret.py +++ b/tests/unit/browser/test_caret.py @@ -368,3 +368,33 @@ class TestFollowSelected: with qtbot.wait_signal(caret.follow_selected_done): caret.follow_selected() assert web_tab.url().path() == '/data/hello.txt' + + +class TestReverse: + + def test_does_not_change_selection(self, caret, selection): + selection.toggle() + caret.reverse_selection() + selection.check("") + + def test_repetition_of_movement_results_in_empty_selection(self, caret, selection): + selection.toggle() + caret.move_to_end_of_line() + caret.reverse_selection() + caret.move_to_end_of_line() + selection.check("") + + def test_reverse(self, caret, selection): + selection.toggle() + caret.move_to_end_of_word() + caret.reverse_selection() + caret.move_to_next_char() + selection.check("ne") + caret.reverse_selection() + caret.move_to_next_char() + selection.check("ne ") + caret.move_to_end_of_line() + selection.check("ne two three") + caret.reverse_selection() + caret.move_to_start_of_line() + selection.check("one two three") |