-
-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add button_keypress_vs_press test
This test ensures that button key press events take precedence over pressing focused buttons with keyboard.
- Loading branch information
Showing
5 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[ | ||
{ "type": "KeyDown", "key_code": 13 }, | ||
{ "type": "TextControl", "code": "Enter" }, | ||
{ "type": "KeyUp", "key_code": 13 }, | ||
{ "type": "KeyDown", "key_code": 32 }, | ||
{ "type": "TextInput", "codepoint": " " }, | ||
{ "type": "KeyUp", "key_code": 32 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "TextInput", "codepoint": "\t" }, | ||
{ "type": "KeyUp", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 13 }, | ||
{ "type": "TextControl", "code": "Enter" }, | ||
{ "type": "KeyUp", "key_code": 13 }, | ||
{ "type": "KeyDown", "key_code": 32 }, | ||
{ "type": "TextInput", "codepoint": " " }, | ||
{ "type": "KeyUp", "key_code": 32 } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
button.onKeyDown: 13 | ||
Enter pressed | ||
keyPress 2 enter | ||
button.onKeyUp: 13 | ||
button.onKeyDown: 32 | ||
Space pressed | ||
press 1 | ||
button.onPress: 32 | ||
release 1 | ||
button.onRelease: 32 | ||
button.onKeyUp: 32 | ||
button.onKeyDown: 9 | ||
Tab pressed | ||
button2.onKeyUp: 9 | ||
button2.onKeyDown: 13 | ||
Enter pressed | ||
keyPress 2 enter | ||
button2.onKeyUp: 13 | ||
button2.onKeyDown: 32 | ||
Space pressed | ||
press 2 | ||
button2.onPress: 32 | ||
release 2 | ||
button2.onRelease: 32 | ||
button2.onKeyUp: 32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var listener = new Object(); | ||
listener.onKeyDown = function() { | ||
if (Key.getCode() == 32) { | ||
trace("Space pressed"); | ||
} | ||
if (Key.getCode() == 13) { | ||
trace("Enter pressed"); | ||
} | ||
if (Key.getCode() == 9) { | ||
trace("Tab pressed"); | ||
} | ||
}; | ||
Key.addListener(listener); | ||
|
||
button.onKeyDown = function () { trace("button.onKeyDown: " + Key.getCode()); } | ||
button.onKeyUp = function () { trace("button.onKeyUp: " + Key.getCode()); } | ||
button.onPress = function () { trace("button.onPress: " + Key.getCode()); } | ||
button.onRelease = function () { trace("button.onRelease: " + Key.getCode()); } | ||
|
||
button2.onKeyDown = function () { trace("button2.onKeyDown: " + Key.getCode()); } | ||
button2.onKeyUp = function () { trace("button2.onKeyUp: " + Key.getCode()); } | ||
button2.onPress = function () { trace("button2.onPress: " + Key.getCode()); } | ||
button2.onRelease = function () { trace("button2.onRelease: " + Key.getCode()); } | ||
|
||
Selection.setFocus(button); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
num_ticks = 1 |