From 2ffb1604d36d442223819e69f2522664c251d2ce Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Wed, 21 Feb 2018 10:01:27 -0500 Subject: [PATCH 1/4] Convert search to blue selection when entering caret mode --- qutebrowser/browser/webengine/webenginetab.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 4595f7a6e..2c87acdc3 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -218,6 +218,13 @@ class WebEngineCaret(browsertab.AbstractCaret): if mode != usertypes.KeyMode.caret: return + # Clear search, replace with blue selection + if self._tab.search.search_displayed: + # We are currently in search mode. + # convert the search to a blue selection so we can operate on it + # https://bugreports.qt.io/browse/QTBUG-60673 + self._tab.search.clear() + self._tab.run_js_async( javascript.assemble('caret', 'setPlatform', sys.platform)) self._js_call('setInitialCursor') From c16c625febe19933063a6ab6b17e99e3fe8343c3 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Wed, 21 Feb 2018 22:15:26 -0500 Subject: [PATCH 2/4] Add basic tests for searching and caret mode --- tests/end2end/features/caret.feature | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/end2end/features/caret.feature b/tests/end2end/features/caret.feature index a3ff325f4..8be03dec2 100644 --- a/tests/end2end/features/caret.feature +++ b/tests/end2end/features/caret.feature @@ -320,3 +320,25 @@ Feature: Caret mode And the following tabs should be open: - data/caret.html - data/hello.txt (active) + + # Search + caret mode + + Scenario: yanking a searched line + When I run :leave-mode + And I run :search fiv + And I wait for "search found fiv" in the log + And I run :enter-mode caret + And I run :move-to-end-of-line + And I run :yank selection + Then the clipboard should contain "five six" + + Scenario: yanking a searched line with multiple matches + When I run :leave-mode + And I run :search w + And I wait for "search found w" in the log + And I run :search-next + And I wait for "next_result found w" in the log + And I run :enter-mode caret + And I run :move-to-end-of-line + And I run :yank selection + Then the clipboard should contain "wei drei" From cb8d62866c08271e9fa66275d9da368b3f97f357 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Thu, 22 Feb 2018 18:33:46 -0500 Subject: [PATCH 3/4] Blacklist qt versions 5.8.0 through 5.9.4 for caret tests --- tests/end2end/features/caret.feature | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/end2end/features/caret.feature b/tests/end2end/features/caret.feature index 8be03dec2..e9cf54c8d 100644 --- a/tests/end2end/features/caret.feature +++ b/tests/end2end/features/caret.feature @@ -323,6 +323,8 @@ Feature: Caret mode # Search + caret mode + # https://bugreports.qt.io/browse/QTBUG-60673 + @qt!=5.8.0 @qt!=5.9.0 @qt!=5.9.1 @qt!=5.9.2 @qt!=5.9.3 @qt!=5.9.4 Scenario: yanking a searched line When I run :leave-mode And I run :search fiv @@ -332,6 +334,7 @@ Feature: Caret mode And I run :yank selection Then the clipboard should contain "five six" + @qt!=5.8.0 @qt!=5.9.0 @qt!=5.9.1 @qt!=5.9.2 @qt!=5.9.3 @qt!=5.9.4 Scenario: yanking a searched line with multiple matches When I run :leave-mode And I run :search w From 76bf35cbdd9fa2cea125a4d763da7bbe6ee5a2bd Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Sun, 25 Feb 2018 19:00:15 -0500 Subject: [PATCH 4/4] Add qtbug60673 markers to relevant tests --- pytest.ini | 1 + qutebrowser/browser/webengine/webenginetab.py | 1 - tests/conftest.py | 5 +++++ tests/end2end/features/caret.feature | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pytest.ini b/pytest.ini index 89571aebc..d6226c03b 100644 --- a/pytest.ini +++ b/pytest.ini @@ -27,6 +27,7 @@ markers = no_invalid_lines: Don't fail on unparseable lines in end2end tests issue2478: Tests which are broken on Windows with QtWebEngine, https://github.com/qutebrowser/qutebrowser/issues/2478 issue3572: Tests which are broken with QtWebEngine and Qt 5.10, https://github.com/qutebrowser/qutebrowser/issues/3572 + qtbug60673: Tests which are broken if the conversion from orange selection to real selection is flakey fake_os: Fake utils.is_* to a fake operating system unicode_locale: Tests which need an unicode locale to work qt_log_level_fail = WARNING diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 2c87acdc3..072d5276a 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -218,7 +218,6 @@ class WebEngineCaret(browsertab.AbstractCaret): if mode != usertypes.KeyMode.caret: return - # Clear search, replace with blue selection if self._tab.search.search_displayed: # We are currently in search mode. # convert the search to a blue selection so we can operate on it diff --git a/tests/conftest.py b/tests/conftest.py index d9d5fc034..ba9e4ab9c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -68,6 +68,11 @@ def _apply_platform_markers(config, item): qtutils.version_check('5.10', compiled=False, exact=True) and config.webengine and 'TRAVIS' in os.environ, "Broken with QtWebEngine with Qt 5.10 on Travis"), + ('qtbug60673', + qtutils.version_check('5.8') and + not qtutils.version_check('5.10') and + config.webengine, + "Broken on webengine due to qtbug60673"), ('unicode_locale', sys.getfilesystemencoding() == 'ascii', "Skipped because of ASCII locale"), ] diff --git a/tests/end2end/features/caret.feature b/tests/end2end/features/caret.feature index e9cf54c8d..803016539 100644 --- a/tests/end2end/features/caret.feature +++ b/tests/end2end/features/caret.feature @@ -324,7 +324,7 @@ Feature: Caret mode # Search + caret mode # https://bugreports.qt.io/browse/QTBUG-60673 - @qt!=5.8.0 @qt!=5.9.0 @qt!=5.9.1 @qt!=5.9.2 @qt!=5.9.3 @qt!=5.9.4 + @qtbug60673 Scenario: yanking a searched line When I run :leave-mode And I run :search fiv @@ -334,7 +334,7 @@ Feature: Caret mode And I run :yank selection Then the clipboard should contain "five six" - @qt!=5.8.0 @qt!=5.9.0 @qt!=5.9.1 @qt!=5.9.2 @qt!=5.9.3 @qt!=5.9.4 + @qtbug60673 Scenario: yanking a searched line with multiple matches When I run :leave-mode And I run :search w