diff options
author | Florian Bruhin <me@the-compiler.org> | 2018-09-15 20:39:35 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2018-09-15 20:39:35 +0200 |
commit | abff44def642316b223a46d54f9de78d7c9679f1 (patch) | |
tree | bbe043a4aebe3983c30971cb6d274a94cfa1c14c /tests/unit/browser/test_caret.py | |
parent | e47bf7a1377d48107107f63f061daf587b378490 (diff) | |
download | qutebrowser-abff44def642316b223a46d54f9de78d7c9679f1.tar.gz qutebrowser-abff44def642316b223a46d54f9de78d7c9679f1.zip |
Get rid of end-of-doc-workaround in caret browsing
In Qt < 5.10 (and also sometimes on Windows), we get extra spaces or newlines
when moving to the end of the document. However, this only happens *sometimes*,
and manual testing confirms that with the current workaround, we actually lose
the last char in the selection.
I'm not sure what's happening there, but instead of making things worse with
the workaround, let's just be a bit less strict with the checking there and
accept both variants... This seems like some Chromium bug we can't do much
about.
Diffstat (limited to 'tests/unit/browser/test_caret.py')
-rw-r--r-- | tests/unit/browser/test_caret.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/unit/browser/test_caret.py b/tests/unit/browser/test_caret.py index ee134c63e..1c3c7f794 100644 --- a/tests/unit/browser/test_caret.py +++ b/tests/unit/browser/test_caret.py @@ -47,7 +47,7 @@ class Selection: self._caret = caret self._callback_checker = utils.CallbackChecker(qtbot) - def check(self, expected): + def check(self, expected, *, strip=False): """Check whether we got the expected selection. Since (especially on Windows) the selection is empty if we're too @@ -60,13 +60,15 @@ class Selection: selection = blocker.args[0] if selection: + if strip: + selection = selection.strip() assert selection == expected return self._qtbot.wait(50) - def check_multiline(self, expected): - self.check(textwrap.dedent(expected).strip()) + def check_multiline(self, expected, *, strip=False): + self.check(textwrap.dedent(expected).strip(), strip=strip) def toggle(self): with self._qtbot.wait_signal(self._caret.selection_toggled): @@ -89,7 +91,7 @@ class TestDocument: four five six vier fünf sechs - """) + """, strip=True) def test_moving_to_end_and_start(self, caret, selection): caret.move_to_end_of_document() @@ -108,7 +110,7 @@ class TestDocument: four five six vier fünf sechs - """) + """, strip=True) class TestBlock: |