2015-11-25 17:20:53 +01:00
|
|
|
Feature: Keyboard input
|
|
|
|
|
|
|
|
Tests for :bind and :unbind, :clear-keychain and other keyboard input
|
|
|
|
related things.
|
|
|
|
|
|
|
|
# :bind
|
|
|
|
|
|
|
|
Scenario: Binding a keychain
|
2016-05-10 23:46:02 +02:00
|
|
|
When I run :bind test01 message-info test01
|
|
|
|
And I press the keys "test01"
|
|
|
|
Then the message "test01" should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
Scenario: Binding an invalid command
|
2016-05-10 23:46:02 +02:00
|
|
|
When I run :bind test02 abcd
|
2015-11-26 17:50:39 +01:00
|
|
|
Then the error "Invalid command 'abcd'!" should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
Scenario: Binding with invalid mode.
|
2016-05-10 23:46:02 +02:00
|
|
|
When I run :bind --mode abcd test03 message-info test03
|
2015-11-26 17:50:39 +01:00
|
|
|
Then the error "Invalid mode abcd!" should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
Scenario: Double-binding a key
|
2016-05-10 23:46:02 +02:00
|
|
|
When I run :bind test04 message-info test04
|
|
|
|
And I run :bind test04 message-info test04-2
|
|
|
|
And I press the keys "test04"
|
|
|
|
Then the error "Duplicate keychain test04 - use --force to override!" should be shown
|
|
|
|
And the message "test04" should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
Scenario: Double-binding with --force
|
2016-05-10 23:46:02 +02:00
|
|
|
When I run :bind test05 message-info test05
|
|
|
|
And I run :bind --force test05 message-info test05-2
|
|
|
|
And I press the keys "test05"
|
|
|
|
Then the message "test05-2" should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
2016-05-03 04:54:47 +02:00
|
|
|
Scenario: Printing an unbound key
|
2016-05-10 23:46:02 +02:00
|
|
|
When I run :bind test06
|
2016-05-10 23:47:16 +02:00
|
|
|
Then the message "test06 is unbound in normal mode" should be shown
|
2016-05-03 04:54:47 +02:00
|
|
|
|
|
|
|
Scenario: Printing a bound key
|
2016-05-10 23:46:02 +02:00
|
|
|
When I run :bind test07 message-info foo
|
|
|
|
And I run :bind test07
|
|
|
|
Then the message "test07 is bound to 'message-info foo' in normal mode" should be shown
|
2016-05-03 04:54:47 +02:00
|
|
|
|
|
|
|
Scenario: Printing a bound key in a given mode
|
2016-05-10 23:46:02 +02:00
|
|
|
When I run :bind --mode=caret test08 message-info bar
|
|
|
|
And I run :bind --mode=caret test08
|
|
|
|
Then the message "test08 is bound to 'message-info bar' in caret mode" should be shown
|
2016-05-03 04:54:47 +02:00
|
|
|
|
2016-06-04 05:04:44 +02:00
|
|
|
Scenario: Binding special keys with differing case (issue 1544)
|
|
|
|
When I run :bind <ctrl-test21> message-info test01
|
|
|
|
And I run :bind <Ctrl-Test21> message-info test01
|
|
|
|
Then the error "Duplicate keychain <ctrl-test21> - use --force to override!" should be shown
|
|
|
|
|
|
|
|
Scenario: Print a special binding with differing case (issue 1544)
|
|
|
|
When I run :bind <Ctrl-Test22> message-info foo
|
|
|
|
And I run :bind <ctrl-test22>
|
|
|
|
Then the message "<ctrl-test22> is bound to 'message-info foo' in normal mode" should be shown
|
|
|
|
|
|
|
|
Scenario: Overriding a special binding with differing case (issue 816)
|
|
|
|
When I run :bind <ctrl-test23> message-info foo
|
|
|
|
And I run :bind --force <Ctrl-Test23> message-info bar
|
|
|
|
And I run :bind <ctrl-test23>
|
|
|
|
Then the message "<ctrl-test23> is bound to 'message-info bar' in normal mode" should be shown
|
|
|
|
|
2015-11-25 17:20:53 +01:00
|
|
|
# :unbind
|
|
|
|
|
|
|
|
Scenario: Binding and unbinding a keychain
|
2016-05-10 23:46:02 +02:00
|
|
|
When I run :bind test09 message-error test09
|
|
|
|
And I run :unbind test09
|
|
|
|
And I press the keys "test09"
|
|
|
|
Then "test09" should not be logged
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
Scenario: Unbinding with invalid mode.
|
2016-05-10 23:46:02 +02:00
|
|
|
When I run :unbind test10 abcd
|
2015-11-26 17:50:39 +01:00
|
|
|
Then the error "Invalid mode abcd!" should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
Scenario: Unbinding with invalid keychain.
|
2016-05-10 23:46:02 +02:00
|
|
|
When I run :unbind test11
|
|
|
|
Then the error "Can't find binding 'test11' in section 'normal'!" should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
Scenario: Unbinding a built-in binding
|
|
|
|
When I run :unbind o
|
|
|
|
And I press the key "o"
|
2016-07-27 10:27:53 +02:00
|
|
|
Then "Giving up with 'o', no matches" should be logged
|
2015-11-25 17:20:53 +01:00
|
|
|
# maybe check it's unbound in the config?
|
|
|
|
|
2016-06-04 05:04:44 +02:00
|
|
|
Scenario: Binding and unbinding a special keychain with differing case (issue 1544)
|
|
|
|
When I run :bind <ctrl-test24> message-error test09
|
|
|
|
And I run :unbind <Ctrl-Test24>
|
|
|
|
When I run :bind <ctrl-test24>
|
|
|
|
Then the message "<ctrl-test24> is unbound in normal mode" should be shown
|
|
|
|
|
2015-11-25 17:20:53 +01:00
|
|
|
# :clear-keychain
|
|
|
|
|
|
|
|
Scenario: Clearing the keychain
|
2016-05-10 23:46:02 +02:00
|
|
|
When I run :bind foo message-error test12
|
|
|
|
And I run :bind bar message-info test12-2
|
2015-11-25 17:20:53 +01:00
|
|
|
And I press the keys "fo"
|
|
|
|
And I run :clear-keychain
|
|
|
|
And I press the keys "bar"
|
2016-05-10 23:46:02 +02:00
|
|
|
Then the message "test12-2" should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
# input -> forward-unbound-keys
|
|
|
|
|
|
|
|
Scenario: Forwarding all keys
|
|
|
|
When I open data/keyinput/log.html
|
2015-11-29 18:37:11 +01:00
|
|
|
And I set general -> log-javascript-console to info
|
2015-11-25 17:20:53 +01:00
|
|
|
And I set input -> forward-unbound-keys to all
|
2015-11-25 17:52:00 +01:00
|
|
|
And I press the key "q"
|
2015-11-25 17:20:53 +01:00
|
|
|
And I press the key "<F1>"
|
2015-11-25 17:52:00 +01:00
|
|
|
# q
|
2015-11-25 17:55:33 +01:00
|
|
|
Then the javascript message "key press: 81" should be logged
|
|
|
|
And the javascript message "key release: 81" should be logged
|
2015-11-25 17:20:53 +01:00
|
|
|
# <F1>
|
|
|
|
And the javascript message "key press: 112" should be logged
|
|
|
|
And the javascript message "key release: 112" should be logged
|
|
|
|
|
|
|
|
Scenario: Forwarding special keys
|
|
|
|
When I open data/keyinput/log.html
|
2015-11-29 18:37:11 +01:00
|
|
|
And I set general -> log-javascript-console to info
|
2015-11-25 17:20:53 +01:00
|
|
|
And I set input -> forward-unbound-keys to auto
|
|
|
|
And I press the key "x"
|
|
|
|
And I press the key "<F1>"
|
|
|
|
# <F1>
|
|
|
|
Then the javascript message "key press: 112" should be logged
|
|
|
|
And the javascript message "key release: 112" should be logged
|
|
|
|
# x
|
|
|
|
And the javascript message "key press: 88" should not be logged
|
|
|
|
And the javascript message "key release: 88" should not be logged
|
|
|
|
|
|
|
|
Scenario: Forwarding no keys
|
|
|
|
When I open data/keyinput/log.html
|
2015-11-29 18:37:11 +01:00
|
|
|
And I set general -> log-javascript-console to info
|
2015-11-25 17:20:53 +01:00
|
|
|
And I set input -> forward-unbound-keys to none
|
|
|
|
And I press the key "<F1>"
|
|
|
|
# <F1>
|
|
|
|
Then the javascript message "key press: 112" should not be logged
|
|
|
|
And the javascript message "key release: 112" should not be logged
|
|
|
|
|
|
|
|
# :fake-key
|
|
|
|
|
|
|
|
Scenario: :fake-key with an unparsable key
|
|
|
|
When I run :fake-key <blub>
|
2015-11-26 17:50:39 +01:00
|
|
|
Then the error "Could not parse 'blub': Got unknown key." should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
Scenario: :fake-key sending key to the website
|
2015-11-29 18:37:11 +01:00
|
|
|
When I set general -> log-javascript-console to info
|
2015-11-25 17:20:53 +01:00
|
|
|
And I open data/keyinput/log.html
|
|
|
|
And I run :fake-key x
|
|
|
|
Then the javascript message "key press: 88" should be logged
|
|
|
|
And the javascript message "key release: 88" should be logged
|
|
|
|
|
2016-02-16 20:36:23 +01:00
|
|
|
@no_xvfb @posix
|
2015-11-25 17:20:53 +01:00
|
|
|
Scenario: :fake-key sending key to the website with other window focused
|
|
|
|
When I open data/keyinput/log.html
|
|
|
|
And I set general -> developer-extras to true
|
|
|
|
And I run :inspector
|
|
|
|
And I wait for "Focus object changed: <PyQt5.QtWebKitWidgets.QWebView object at *>" in the log
|
|
|
|
And I run :fake-key x
|
|
|
|
And I run :inspector
|
2016-06-13 10:49:58 +02:00
|
|
|
And I wait for "Focus object changed: <qutebrowser.browser.webkit.webview.WebView *>" in the log
|
2015-11-26 17:50:39 +01:00
|
|
|
Then the error "No focused webview!" should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
Scenario: :fake-key sending special key to the website
|
2015-11-29 18:37:11 +01:00
|
|
|
When I set general -> log-javascript-console to info
|
2015-11-25 17:20:53 +01:00
|
|
|
And I open data/keyinput/log.html
|
|
|
|
And I run :fake-key <Escape>
|
|
|
|
Then the javascript message "key press: 27" should be logged
|
|
|
|
And the javascript message "key release: 27" should be logged
|
|
|
|
|
|
|
|
Scenario: :fake-key sending keychain to the website
|
2015-11-29 18:37:11 +01:00
|
|
|
When I set general -> log-javascript-console to info
|
2015-11-25 17:20:53 +01:00
|
|
|
And I open data/keyinput/log.html
|
|
|
|
And I run :fake-key xy
|
|
|
|
Then the javascript message "key press: 88" should be logged
|
|
|
|
And the javascript message "key release: 88" should be logged
|
|
|
|
And the javascript message "key press: 89" should be logged
|
|
|
|
And the javascript message "key release: 89" should be logged
|
|
|
|
|
|
|
|
Scenario: :fake-key sending keypress to qutebrowser
|
|
|
|
When I run :fake-key -g x
|
|
|
|
And I wait for "got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>" in the log
|
|
|
|
Then no crash should happen
|