diff options
author | Florian Bruhin <git@the-compiler.org> | 2015-11-02 08:07:25 +0100 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2015-11-02 08:07:25 +0100 |
commit | 8884de71d8deffd4eee3b3325f316413a5b258cc (patch) | |
tree | 1e9b4c2a4a58425d7bff17bdefaeadb8c801f13f /tests | |
parent | 362ef3f74e3bbb332d6ebf225b05eb958e972ccb (diff) | |
download | qutebrowser-8884de71d8deffd4eee3b3325f316413a5b258cc.tar.gz qutebrowser-8884de71d8deffd4eee3b3325f316413a5b258cc.zip |
Fix checking for primary selection.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/features/test_features.py | 12 | ||||
-rw-r--r-- | tests/integration/features/yankpaste.feature | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/tests/integration/features/test_features.py b/tests/integration/features/test_features.py index 8a146895a..df93433d0 100644 --- a/tests/integration/features/test_features.py +++ b/tests/integration/features/test_features.py @@ -57,6 +57,12 @@ def reload(qtbot, httpbin, quteproc, command): quteproc.send_cmd(':reload') +@bdd.when("selection is supported") +def selection_supported(qapp): + if not qapp.clipboard().supportsSelection(): + pytest.skip("OS doesn't support primary selection!") + + @bdd.then(bdd.parsers.parse("{path} should be loaded")) def path_should_be_loaded(httpbin, path): requests = httpbin.get_requests() @@ -86,18 +92,14 @@ def expect_error(quteproc, httpbin, category, message): @bdd.then(bdd.parsers.re(r'the (?P<what>primary selection|clipboard) should ' r'contain "(?P<content>.*)"')) def clipboard_contains(qapp, httpbin, what, content): - clipboard = qapp.clipboard() - if what == 'clipboard': mode = QClipboard.Clipboard elif what == 'primary selection': - if not clipboard.supportsSelection(): - pytest.skip("OS doesn't support primary selection!") mode = QClipboard.Selection else: raise AssertionError expected = content.replace('(port)', str(httpbin.port)) - data = clipboard.text(mode=mode) + data = qapp.clipboard().text(mode=mode) assert data == expected diff --git a/tests/integration/features/yankpaste.feature b/tests/integration/features/yankpaste.feature index 195aa4f14..7c79612af 100644 --- a/tests/integration/features/yankpaste.feature +++ b/tests/integration/features/yankpaste.feature @@ -11,7 +11,8 @@ Feature: Yanking and pasting. And the clipboard should contain "http://localhost:(port)/data/yankpaste/test.html" Scenario: Yanking URLs to primary selection - When I run :yank --sel + When selection is supported + And I run :yank --sel Then the message "Yanked URL to primary selection: http://localhost:(port)/data/yankpaste/test.html" should be shown. And the primary selection should contain "http://localhost:(port)/data/yankpaste/test.html" |