From 077982f08a2d1b6b09e7fc3ef1f20e9f9f8984dd Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Mon, 10 Feb 2014 22:08:29 +0900 Subject: [PATCH] Add a very lazy test for keyutil.parseKeyCharacterMap(). --- lib/util/keyutil.js | 3 +- test/fixt/Virtual.kcm | 601 +++++ test/fixt/Virtual.kcm.json | 4232 ++++++++++++++++++++++++++++++++++++ test/util/keyutil.js | 27 + 4 files changed, 4862 insertions(+), 1 deletion(-) create mode 100644 test/fixt/Virtual.kcm create mode 100644 test/fixt/Virtual.kcm.json create mode 100644 test/util/keyutil.js diff --git a/lib/util/keyutil.js b/lib/util/keyutil.js index e580cbe4..29b9b05d 100644 --- a/lib/util/keyutil.js +++ b/lib/util/keyutil.js @@ -7,7 +7,8 @@ module.exports.parseKeyCharacterMap = function(stream) { var resolver = Promise.defer() , state = 'type_t' , keymap = { - keys: [] + type: null + , keys: [] } , lastKey , lastRule diff --git a/test/fixt/Virtual.kcm b/test/fixt/Virtual.kcm new file mode 100644 index 00000000..d90b7907 --- /dev/null +++ b/test/fixt/Virtual.kcm @@ -0,0 +1,601 @@ +# Copyright (C) 2010 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Key character map for a built-in generic virtual keyboard primarily used +# for instrumentation and testing purposes. +# + +type FULL + +### Basic QWERTY keys ### + +key A { + label: 'A' + base: 'a' + shift, capslock: 'A' +} + +key B { + label: 'B' + base: 'b' + shift, capslock: 'B' +} + +key C { + label: 'C' + base: 'c' + shift, capslock: 'C' + alt: '\u00e7' + shift+alt: '\u00c7' +} + +key D { + label: 'D' + base: 'd' + shift, capslock: 'D' +} + +key E { + label: 'E' + base: 'e' + shift, capslock: 'E' + alt: '\u0301' +} + +key F { + label: 'F' + base: 'f' + shift, capslock: 'F' +} + +key G { + label: 'G' + base: 'g' + shift, capslock: 'G' +} + +key H { + label: 'H' + base: 'h' + shift, capslock: 'H' +} + +key I { + label: 'I' + base: 'i' + shift, capslock: 'I' + alt: '\u0302' +} + +key J { + label: 'J' + base: 'j' + shift, capslock: 'J' +} + +key K { + label: 'K' + base: 'k' + shift, capslock: 'K' +} + +key L { + label: 'L' + base: 'l' + shift, capslock: 'L' +} + +key M { + label: 'M' + base: 'm' + shift, capslock: 'M' +} + +key N { + label: 'N' + base: 'n' + shift, capslock: 'N' + alt: '\u0303' +} + +key O { + label: 'O' + base: 'o' + shift, capslock: 'O' +} + +key P { + label: 'P' + base: 'p' + shift, capslock: 'P' +} + +key Q { + label: 'Q' + base: 'q' + shift, capslock: 'Q' +} + +key R { + label: 'R' + base: 'r' + shift, capslock: 'R' +} + +key S { + label: 'S' + base: 's' + shift, capslock: 'S' + alt: '\u00df' +} + +key T { + label: 'T' + base: 't' + shift, capslock: 'T' +} + +key U { + label: 'U' + base: 'u' + shift, capslock: 'U' + alt: '\u0308' +} + +key V { + label: 'V' + base: 'v' + shift, capslock: 'V' +} + +key W { + label: 'W' + base: 'w' + shift, capslock: 'W' +} + +key X { + label: 'X' + base: 'x' + shift, capslock: 'X' +} + +key Y { + label: 'Y' + base: 'y' + shift, capslock: 'Y' +} + +key Z { + label: 'Z' + base: 'z' + shift, capslock: 'Z' +} + +key 0 { + label: '0' + base: '0' + shift: ')' +} + +key 1 { + label: '1' + base: '1' + shift: '!' +} + +key 2 { + label: '2' + base: '2' + shift: '@' +} + +key 3 { + label: '3' + base: '3' + shift: '#' +} + +key 4 { + label: '4' + base: '4' + shift: '$' +} + +key 5 { + label: '5' + base: '5' + shift: '%' +} + +key 6 { + label: '6' + base: '6' + shift: '^' + alt+shift: '\u0302' +} + +key 7 { + label: '7' + base: '7' + shift: '&' +} + +key 8 { + label: '8' + base: '8' + shift: '*' +} + +key 9 { + label: '9' + base: '9' + shift: '(' +} + +key SPACE { + label: ' ' + base: ' ' + alt, meta: fallback SEARCH + ctrl: fallback LANGUAGE_SWITCH +} + +key ENTER { + label: '\n' + base: '\n' +} + +key TAB { + label: '\t' + base: '\t' +} + +key COMMA { + label: ',' + base: ',' + shift: '<' +} + +key PERIOD { + label: '.' + base: '.' + shift: '>' +} + +key SLASH { + label: '/' + base: '/' + shift: '?' +} + +key GRAVE { + label: '`' + base: '`' + shift: '~' + alt: '\u0300' + alt+shift: '\u0303' +} + +key MINUS { + label: '-' + base: '-' + shift: '_' +} + +key EQUALS { + label: '=' + base: '=' + shift: '+' +} + +key LEFT_BRACKET { + label: '[' + base: '[' + shift: '{' +} + +key RIGHT_BRACKET { + label: ']' + base: ']' + shift: '}' +} + +key BACKSLASH { + label: '\\' + base: '\\' + shift: '|' +} + +key SEMICOLON { + label: ';' + base: ';' + shift: ':' +} + +key APOSTROPHE { + label: '\'' + base: '\'' + shift: '"' +} + +### Numeric keypad ### + +key NUMPAD_0 { + label: '0' + base: fallback INSERT + numlock: '0' +} + +key NUMPAD_1 { + label: '1' + base: fallback MOVE_END + numlock: '1' +} + +key NUMPAD_2 { + label: '2' + base: fallback DPAD_DOWN + numlock: '2' +} + +key NUMPAD_3 { + label: '3' + base: fallback PAGE_DOWN + numlock: '3' +} + +key NUMPAD_4 { + label: '4' + base: fallback DPAD_LEFT + numlock: '4' +} + +key NUMPAD_5 { + label: '5' + base: fallback DPAD_CENTER + numlock: '5' +} + +key NUMPAD_6 { + label: '6' + base: fallback DPAD_RIGHT + numlock: '6' +} + +key NUMPAD_7 { + label: '7' + base: fallback MOVE_HOME + numlock: '7' +} + +key NUMPAD_8 { + label: '8' + base: fallback DPAD_UP + numlock: '8' +} + +key NUMPAD_9 { + label: '9' + base: fallback PAGE_UP + numlock: '9' +} + +key NUMPAD_LEFT_PAREN { + label: '(' + base: '(' +} + +key NUMPAD_RIGHT_PAREN { + label: ')' + base: ')' +} + +key NUMPAD_DIVIDE { + label: '/' + base: '/' +} + +key NUMPAD_MULTIPLY { + label: '*' + base: '*' +} + +key NUMPAD_SUBTRACT { + label: '-' + base: '-' +} + +key NUMPAD_ADD { + label: '+' + base: '+' +} + +key NUMPAD_DOT { + label: '.' + base: fallback FORWARD_DEL + numlock: '.' +} + +key NUMPAD_COMMA { + label: ',' + base: ',' +} + +key NUMPAD_EQUALS { + label: '=' + base: '=' +} + +key NUMPAD_ENTER { + label: '\n' + base: '\n' fallback ENTER + ctrl, alt, meta: none fallback ENTER +} + +### Special keys on phones ### + +key AT { + label: '@' + base: '@' +} + +key STAR { + label: '*' + base: '*' +} + +key POUND { + label: '#' + base: '#' +} + +key PLUS { + label: '+' + base: '+' +} + +### Non-printing keys ### + +key ESCAPE { + base: fallback BACK + alt, meta: fallback HOME + ctrl: fallback MENU +} + +### Gamepad buttons ### + +key BUTTON_A { + base: fallback BACK +} + +key BUTTON_B { + base: fallback BACK +} + +key BUTTON_C { + base: fallback BACK +} + +key BUTTON_X { + base: fallback DPAD_CENTER +} + +key BUTTON_Y { + base: fallback DPAD_CENTER +} + +key BUTTON_Z { + base: fallback DPAD_CENTER +} + +key BUTTON_L1 { + base: none +} + +key BUTTON_R1 { + base: none +} + +key BUTTON_L2 { + base: none +} + +key BUTTON_R2 { + base: none +} + +key BUTTON_THUMBL { + base: fallback DPAD_CENTER +} + +key BUTTON_THUMBR { + base: fallback DPAD_CENTER +} + +key BUTTON_START { + base: fallback HOME +} + +key BUTTON_SELECT { + base: fallback MENU +} + +key BUTTON_MODE { + base: fallback MENU +} + +key BUTTON_1 { + base: fallback DPAD_CENTER +} + +key BUTTON_2 { + base: fallback DPAD_CENTER +} + +key BUTTON_3 { + base: fallback DPAD_CENTER +} + +key BUTTON_4 { + base: fallback DPAD_CENTER +} + +key BUTTON_5 { + base: fallback DPAD_CENTER +} + +key BUTTON_6 { + base: fallback DPAD_CENTER +} + +key BUTTON_7 { + base: fallback DPAD_CENTER +} + +key BUTTON_8 { + base: fallback DPAD_CENTER +} + +key BUTTON_9 { + base: fallback DPAD_CENTER +} + +key BUTTON_10 { + base: fallback DPAD_CENTER +} + +key BUTTON_11 { + base: fallback DPAD_CENTER +} + +key BUTTON_12 { + base: fallback DPAD_CENTER +} + +key BUTTON_13 { + base: fallback DPAD_CENTER +} + +key BUTTON_14 { + base: fallback DPAD_CENTER +} + +key BUTTON_15 { + base: fallback DPAD_CENTER +} + +key BUTTON_16 { + base: fallback DPAD_CENTER +} diff --git a/test/fixt/Virtual.kcm.json b/test/fixt/Virtual.kcm.json new file mode 100644 index 00000000..aaec4819 --- /dev/null +++ b/test/fixt/Virtual.kcm.json @@ -0,0 +1,4232 @@ +{ + "type": "FULL", + "keys": [ + { + "key": "A", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "A" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "a" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "A" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "A" + } + ] + } + ] + }, + { + "key": "B", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "B" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "b" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "B" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "B" + } + ] + } + ] + }, + { + "key": "C", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "C" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "c" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "C" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "C" + } + ] + }, + { + "modifiers": [ + { + "type": "alt" + } + ], + "behaviors": [ + { + "type": "literal", + "value": 231 + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + }, + { + "type": "alt" + } + ], + "behaviors": [ + { + "type": "literal", + "value": 199 + } + ] + } + ] + }, + { + "key": "D", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "D" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "d" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "D" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "D" + } + ] + } + ] + }, + { + "key": "E", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "E" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "e" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "E" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "E" + } + ] + }, + { + "modifiers": [ + { + "type": "alt" + } + ], + "behaviors": [ + { + "type": "literal", + "value": 769 + } + ] + } + ] + }, + { + "key": "F", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "F" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "f" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "F" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "F" + } + ] + } + ] + }, + { + "key": "G", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "G" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "g" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "G" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "G" + } + ] + } + ] + }, + { + "key": "H", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "H" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "h" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "H" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "H" + } + ] + } + ] + }, + { + "key": "I", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "I" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "i" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "I" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "I" + } + ] + }, + { + "modifiers": [ + { + "type": "alt" + } + ], + "behaviors": [ + { + "type": "literal", + "value": 770 + } + ] + } + ] + }, + { + "key": "J", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "J" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "j" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "J" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "J" + } + ] + } + ] + }, + { + "key": "K", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "K" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "k" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "K" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "K" + } + ] + } + ] + }, + { + "key": "L", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "L" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "l" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "L" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "L" + } + ] + } + ] + }, + { + "key": "M", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "M" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "m" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "M" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "M" + } + ] + } + ] + }, + { + "key": "N", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "N" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "n" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "N" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "N" + } + ] + }, + { + "modifiers": [ + { + "type": "alt" + } + ], + "behaviors": [ + { + "type": "literal", + "value": 771 + } + ] + } + ] + }, + { + "key": "O", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "O" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "o" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "O" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "O" + } + ] + } + ] + }, + { + "key": "P", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "P" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "p" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "P" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "P" + } + ] + } + ] + }, + { + "key": "Q", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "Q" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "q" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "Q" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "Q" + } + ] + } + ] + }, + { + "key": "R", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "R" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "r" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "R" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "R" + } + ] + } + ] + }, + { + "key": "S", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "S" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "s" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "S" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "S" + } + ] + }, + { + "modifiers": [ + { + "type": "alt" + } + ], + "behaviors": [ + { + "type": "literal", + "value": 223 + } + ] + } + ] + }, + { + "key": "T", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "T" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "t" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "T" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "T" + } + ] + } + ] + }, + { + "key": "U", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "U" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "u" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "U" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "U" + } + ] + }, + { + "modifiers": [ + { + "type": "alt" + } + ], + "behaviors": [ + { + "type": "literal", + "value": 776 + } + ] + } + ] + }, + { + "key": "V", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "V" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "v" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "V" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "V" + } + ] + } + ] + }, + { + "key": "W", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "W" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "w" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "W" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "W" + } + ] + } + ] + }, + { + "key": "X", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "X" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "x" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "X" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "X" + } + ] + } + ] + }, + { + "key": "Y", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "Y" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "y" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "Y" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "Y" + } + ] + } + ] + }, + { + "key": "Z", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "Z" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "z" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "Z" + } + ] + }, + { + "modifiers": [ + { + "type": "capslock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "Z" + } + ] + } + ] + }, + { + "key": "0", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "0" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "0" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": ")" + } + ] + } + ] + }, + { + "key": "1", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "1" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "1" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "!" + } + ] + } + ] + }, + { + "key": "2", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "2" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "2" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "@" + } + ] + } + ] + }, + { + "key": "3", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "3" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "3" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "#" + } + ] + } + ] + }, + { + "key": "4", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "4" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "4" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "$" + } + ] + } + ] + }, + { + "key": "5", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "5" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "5" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "%" + } + ] + } + ] + }, + { + "key": "6", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "6" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "6" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "^" + } + ] + }, + { + "modifiers": [ + { + "type": "alt" + }, + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": 770 + } + ] + } + ] + }, + { + "key": "7", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "7" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "7" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "&" + } + ] + } + ] + }, + { + "key": "8", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "8" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "8" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "*" + } + ] + } + ] + }, + { + "key": "9", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "9" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "9" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "(" + } + ] + } + ] + }, + { + "key": "SPACE", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": " " + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": " " + } + ] + }, + { + "modifiers": [ + { + "type": "alt" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "SEARCH" + } + ] + }, + { + "modifiers": [ + { + "type": "meta" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "SEARCH" + } + ] + }, + { + "modifiers": [ + { + "type": "ctrl" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "LANGUAGE_SWITCH" + } + ] + } + ] + }, + { + "key": "ENTER", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "\n" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "\n" + } + ] + } + ] + }, + { + "key": "TAB", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "\t" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "\t" + } + ] + } + ] + }, + { + "key": "COMMA", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "," + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "," + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "<" + } + ] + } + ] + }, + { + "key": "PERIOD", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "." + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "." + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": ">" + } + ] + } + ] + }, + { + "key": "SLASH", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "/" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "/" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "?" + } + ] + } + ] + }, + { + "key": "GRAVE", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "`" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "`" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "~" + } + ] + }, + { + "modifiers": [ + { + "type": "alt" + } + ], + "behaviors": [ + { + "type": "literal", + "value": 768 + } + ] + }, + { + "modifiers": [ + { + "type": "alt" + }, + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": 771 + } + ] + } + ] + }, + { + "key": "MINUS", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "-" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "-" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "_" + } + ] + } + ] + }, + { + "key": "EQUALS", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "=" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "=" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "+" + } + ] + } + ] + }, + { + "key": "LEFT_BRACKET", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "[" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "[" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "{" + } + ] + } + ] + }, + { + "key": "RIGHT_BRACKET", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "]" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "]" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "}" + } + ] + } + ] + }, + { + "key": "BACKSLASH", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "\\" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "\\" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "|" + } + ] + } + ] + }, + { + "key": "SEMICOLON", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": ";" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": ";" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": ":" + } + ] + } + ] + }, + { + "key": "APOSTROPHE", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "'" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "'" + } + ] + }, + { + "modifiers": [ + { + "type": "shift" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "\"" + } + ] + } + ] + }, + { + "key": "NUMPAD_0", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "0" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "INSERT" + } + ] + }, + { + "modifiers": [ + { + "type": "numlock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "0" + } + ] + } + ] + }, + { + "key": "NUMPAD_1", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "1" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "MOVE_END" + } + ] + }, + { + "modifiers": [ + { + "type": "numlock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "1" + } + ] + } + ] + }, + { + "key": "NUMPAD_2", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "2" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_DOWN" + } + ] + }, + { + "modifiers": [ + { + "type": "numlock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "2" + } + ] + } + ] + }, + { + "key": "NUMPAD_3", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "3" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "PAGE_DOWN" + } + ] + }, + { + "modifiers": [ + { + "type": "numlock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "3" + } + ] + } + ] + }, + { + "key": "NUMPAD_4", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "4" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_LEFT" + } + ] + }, + { + "modifiers": [ + { + "type": "numlock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "4" + } + ] + } + ] + }, + { + "key": "NUMPAD_5", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "5" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + }, + { + "modifiers": [ + { + "type": "numlock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "5" + } + ] + } + ] + }, + { + "key": "NUMPAD_6", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "6" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_RIGHT" + } + ] + }, + { + "modifiers": [ + { + "type": "numlock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "6" + } + ] + } + ] + }, + { + "key": "NUMPAD_7", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "7" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "MOVE_HOME" + } + ] + }, + { + "modifiers": [ + { + "type": "numlock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "7" + } + ] + } + ] + }, + { + "key": "NUMPAD_8", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "8" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_UP" + } + ] + }, + { + "modifiers": [ + { + "type": "numlock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "8" + } + ] + } + ] + }, + { + "key": "NUMPAD_9", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "9" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "PAGE_UP" + } + ] + }, + { + "modifiers": [ + { + "type": "numlock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "9" + } + ] + } + ] + }, + { + "key": "NUMPAD_LEFT_PAREN", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "(" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "(" + } + ] + } + ] + }, + { + "key": "NUMPAD_RIGHT_PAREN", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": ")" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": ")" + } + ] + } + ] + }, + { + "key": "NUMPAD_DIVIDE", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "/" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "/" + } + ] + } + ] + }, + { + "key": "NUMPAD_MULTIPLY", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "*" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "*" + } + ] + } + ] + }, + { + "key": "NUMPAD_SUBTRACT", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "-" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "-" + } + ] + } + ] + }, + { + "key": "NUMPAD_ADD", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "+" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "+" + } + ] + } + ] + }, + { + "key": "NUMPAD_DOT", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "." + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "FORWARD_DEL" + } + ] + }, + { + "modifiers": [ + { + "type": "numlock" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "." + } + ] + } + ] + }, + { + "key": "NUMPAD_COMMA", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "," + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "," + } + ] + } + ] + }, + { + "key": "NUMPAD_EQUALS", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "=" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "=" + } + ] + } + ] + }, + { + "key": "NUMPAD_ENTER", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "\n" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "\n" + }, + { + "type": "fallback", + "key": "ENTER" + } + ] + }, + { + "modifiers": [ + { + "type": "ctrl" + } + ], + "behaviors": [ + { + "type": "none" + }, + { + "type": "fallback", + "key": "ENTER" + } + ] + }, + { + "modifiers": [ + { + "type": "alt" + } + ], + "behaviors": [ + { + "type": "none" + }, + { + "type": "fallback", + "key": "ENTER" + } + ] + }, + { + "modifiers": [ + { + "type": "meta" + } + ], + "behaviors": [ + { + "type": "none" + }, + { + "type": "fallback", + "key": "ENTER" + } + ] + } + ] + }, + { + "key": "AT", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "@" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "@" + } + ] + } + ] + }, + { + "key": "STAR", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "*" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "*" + } + ] + } + ] + }, + { + "key": "POUND", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "#" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "#" + } + ] + } + ] + }, + { + "key": "PLUS", + "rules": [ + { + "modifiers": [ + { + "type": "label" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "+" + } + ] + }, + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "literal", + "value": "+" + } + ] + } + ] + }, + { + "key": "ESCAPE", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "BACK" + } + ] + }, + { + "modifiers": [ + { + "type": "alt" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "HOME" + } + ] + }, + { + "modifiers": [ + { + "type": "meta" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "HOME" + } + ] + }, + { + "modifiers": [ + { + "type": "ctrl" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "MENU" + } + ] + } + ] + }, + { + "key": "BUTTON_A", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "BACK" + } + ] + } + ] + }, + { + "key": "BUTTON_B", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "BACK" + } + ] + } + ] + }, + { + "key": "BUTTON_C", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "BACK" + } + ] + } + ] + }, + { + "key": "BUTTON_X", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_Y", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_Z", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_L1", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "none" + } + ] + } + ] + }, + { + "key": "BUTTON_R1", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "none" + } + ] + } + ] + }, + { + "key": "BUTTON_L2", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "none" + } + ] + } + ] + }, + { + "key": "BUTTON_R2", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "none" + } + ] + } + ] + }, + { + "key": "BUTTON_THUMBL", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_THUMBR", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_START", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "HOME" + } + ] + } + ] + }, + { + "key": "BUTTON_SELECT", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "MENU" + } + ] + } + ] + }, + { + "key": "BUTTON_MODE", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "MENU" + } + ] + } + ] + }, + { + "key": "BUTTON_1", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_2", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_3", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_4", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_5", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_6", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_7", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_8", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_9", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_10", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_11", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_12", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_13", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_14", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_15", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + }, + { + "key": "BUTTON_16", + "rules": [ + { + "modifiers": [ + { + "type": "base" + } + ], + "behaviors": [ + { + "type": "fallback", + "key": "DPAD_CENTER" + } + ] + } + ] + } + ] +} diff --git a/test/util/keyutil.js b/test/util/keyutil.js new file mode 100644 index 00000000..8f58fced --- /dev/null +++ b/test/util/keyutil.js @@ -0,0 +1,27 @@ +var path = require('path') +var fs = require('fs') + +var chai = require('chai') +var expect = chai.expect + +var keyutil = require('../../lib/util/keyutil') + +describe('keyutil', function() { + + describe('parseKeyCharacterMap', function() { + + it('should be able to parse Virtual.kcm', function(done) { + var expected = require('../fixt/Virtual.kcm.json') + , source = path.join(__dirname, '..', 'fixt', 'Virtual.kcm') + + keyutil.parseKeyCharacterMap(fs.createReadStream(source)) + .then(function(keymap) { + expect(keymap).to.eql(expected) + done() + }) + .catch(done) + }) + + }) + +})