Fix forward_unbound_keys test

This commit is contained in:
Florian Bruhin 2018-02-26 20:02:43 +01:00
parent 1444634abb
commit f1b20f6dc4
2 changed files with 8 additions and 5 deletions

View File

@ -263,6 +263,10 @@ class KeyInfo:
def text(self): def text(self):
"""Get the text which would be displayed when pressing this key.""" """Get the text which would be displayed when pressing this key."""
text = QKeySequence(self.key).toString() text = QKeySequence(self.key).toString()
if len(text) > 1:
# Special key?
return ''
if not self.modifiers & Qt.ShiftModifier: if not self.modifiers & Qt.ShiftModifier:
text = text.lower() text = text.lower()
return text return text

View File

@ -33,14 +33,13 @@ Feature: Keyboard input
Scenario: Forwarding special keys Scenario: Forwarding special keys
When I open data/keyinput/log.html When I open data/keyinput/log.html
And I set input.forward_unbound_keys to auto And I set input.forward_unbound_keys to auto
And I press the key "x" And I press the keys ",<F1>"
And I press the key "<F1>"
# <F1> # <F1>
Then the javascript message "key press: 112" should be logged Then the javascript message "key press: 112" should be logged
And the javascript message "key release: 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 press: 188" should not be logged
And the javascript message "key release: 88" should not be logged And the javascript message "key release: 188" should not be logged
Scenario: Forwarding no keys Scenario: Forwarding no keys
When I open data/keyinput/log.html When I open data/keyinput/log.html