[922] | 1 | package de.ugoe.cs.quest.keyboardmaps; |
---|
[456] | 2 | |
---|
| 3 | import static org.junit.Assert.*; |
---|
| 4 | |
---|
| 5 | import java.util.Locale; |
---|
[725] | 6 | import java.util.logging.Level; |
---|
[456] | 7 | |
---|
| 8 | import org.junit.Before; |
---|
| 9 | import org.junit.Test; |
---|
| 10 | |
---|
[922] | 11 | import de.ugoe.cs.autoquest.keyboardmaps.KeyboardMap; |
---|
| 12 | import de.ugoe.cs.autoquest.keyboardmaps.KeyboardMapFactory; |
---|
| 13 | import de.ugoe.cs.autoquest.keyboardmaps.VirtualKey; |
---|
[725] | 14 | import de.ugoe.cs.util.console.TextConsole; |
---|
| 15 | |
---|
[456] | 16 | /** |
---|
| 17 | * TODO comment |
---|
| 18 | * |
---|
| 19 | * @version $Revision: $ $Date: 11.07.2012$ |
---|
| 20 | * @author 2012, last modified by $Author: patrick$ |
---|
| 21 | */ |
---|
[558] | 22 | public class KeyboardMapTest { |
---|
[456] | 23 | |
---|
[558] | 24 | /** |
---|
| 25 | * |
---|
| 26 | */ |
---|
| 27 | @Before |
---|
| 28 | public void setUp() { |
---|
[725] | 29 | new TextConsole(Level.FINEST); |
---|
[558] | 30 | } |
---|
[456] | 31 | |
---|
[558] | 32 | /** |
---|
| 33 | * TODO: comment |
---|
| 34 | * |
---|
| 35 | */ |
---|
| 36 | @Test |
---|
| 37 | public void testInitialization() { |
---|
| 38 | KeyboardMap map = KeyboardMapFactory.createKeyboardMap(Locale.ENGLISH); |
---|
| 39 | assertNotNull(map); |
---|
| 40 | |
---|
| 41 | map = KeyboardMapFactory.createKeyboardMap(Locale.FRENCH); |
---|
| 42 | assertNotNull(map); |
---|
| 43 | |
---|
| 44 | map = KeyboardMapFactory.createKeyboardMap(Locale.GERMAN); |
---|
| 45 | assertNotNull(map); |
---|
| 46 | |
---|
| 47 | map = KeyboardMapFactory.createKeyboardMap(Locale.ITALIAN); |
---|
| 48 | assertNotNull(map); |
---|
| 49 | |
---|
| 50 | map = KeyboardMapFactory.createKeyboardMap(Locale.JAPANESE); |
---|
| 51 | assertNotNull(map); |
---|
| 52 | |
---|
| 53 | map = KeyboardMapFactory.createKeyboardMap(Locale.KOREAN); |
---|
| 54 | assertNotNull(map); |
---|
| 55 | |
---|
| 56 | try { |
---|
| 57 | map = KeyboardMapFactory.createKeyboardMap(Locale.CHINESE); |
---|
| 58 | fail("expected exception did not occur"); |
---|
| 59 | } |
---|
| 60 | catch (IllegalArgumentException e) { |
---|
| 61 | // was expected and is ignored |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | try { |
---|
| 65 | map = KeyboardMapFactory.createKeyboardMap(Locale.SIMPLIFIED_CHINESE); |
---|
| 66 | fail("expected exception did not occur"); |
---|
| 67 | } |
---|
| 68 | catch (IllegalArgumentException e) { |
---|
| 69 | // was expected and is ignored |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | try { |
---|
| 73 | map = KeyboardMapFactory.createKeyboardMap(Locale.TRADITIONAL_CHINESE); |
---|
| 74 | fail("expected exception did not occur"); |
---|
| 75 | } |
---|
| 76 | catch (IllegalArgumentException e) { |
---|
| 77 | // was expected and is ignored |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | map = KeyboardMapFactory.createKeyboardMap(Locale.FRANCE); |
---|
| 81 | assertNotNull(map); |
---|
| 82 | |
---|
| 83 | map = KeyboardMapFactory.createKeyboardMap(Locale.GERMANY); |
---|
| 84 | assertNotNull(map); |
---|
| 85 | |
---|
| 86 | map = KeyboardMapFactory.createKeyboardMap(Locale.ITALY); |
---|
| 87 | assertNotNull(map); |
---|
| 88 | |
---|
| 89 | map = KeyboardMapFactory.createKeyboardMap(Locale.JAPAN); |
---|
| 90 | assertNotNull(map); |
---|
| 91 | |
---|
| 92 | map = KeyboardMapFactory.createKeyboardMap(Locale.KOREA); |
---|
| 93 | assertNotNull(map); |
---|
| 94 | |
---|
| 95 | try { |
---|
| 96 | map = KeyboardMapFactory.createKeyboardMap(Locale.CHINA); |
---|
| 97 | fail("expected exception did not occur"); |
---|
| 98 | } |
---|
| 99 | catch (IllegalArgumentException e) { |
---|
| 100 | // was expected and is ignored |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | try { |
---|
| 104 | map = KeyboardMapFactory.createKeyboardMap(Locale.PRC); |
---|
| 105 | fail("expected exception did not occur"); |
---|
| 106 | } |
---|
| 107 | catch (IllegalArgumentException e) { |
---|
| 108 | // was expected and is ignored |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | try { |
---|
| 112 | map = KeyboardMapFactory.createKeyboardMap(Locale.TAIWAN); |
---|
| 113 | fail("expected exception did not occur"); |
---|
| 114 | } |
---|
| 115 | catch (IllegalArgumentException e) { |
---|
| 116 | // was expected and is ignored |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | map = KeyboardMapFactory.createKeyboardMap(Locale.UK); |
---|
| 120 | assertNotNull(map); |
---|
| 121 | |
---|
| 122 | map = KeyboardMapFactory.createKeyboardMap(Locale.US); |
---|
| 123 | assertNotNull(map); |
---|
| 124 | |
---|
| 125 | map = KeyboardMapFactory.createKeyboardMap(Locale.CANADA); |
---|
| 126 | assertNotNull(map); |
---|
| 127 | |
---|
| 128 | map = KeyboardMapFactory.createKeyboardMap(Locale.CANADA_FRENCH); |
---|
| 129 | assertNotNull(map); |
---|
| 130 | |
---|
| 131 | map = KeyboardMapFactory.createKeyboardMap(Locale.GERMAN); |
---|
| 132 | assertNotNull(map); |
---|
| 133 | |
---|
[456] | 134 | } |
---|
| 135 | |
---|
[558] | 136 | /** |
---|
| 137 | * TODO: comment |
---|
| 138 | * |
---|
| 139 | */ |
---|
| 140 | @Test |
---|
| 141 | public void testGermanKeyboardMap() { |
---|
| 142 | KeyboardMap map = KeyboardMapFactory.createKeyboardMap(Locale.GERMAN); |
---|
| 143 | assertNotNull(map); |
---|
[456] | 144 | |
---|
[558] | 145 | assertCombinations(map, VirtualKey.DIGIT_1, '1', '!', '¹', '¡', true); |
---|
| 146 | assertCombinations(map, VirtualKey.EXCLAMATION_MARK, '1', '!', '¹', '¡', true); |
---|
| 147 | assertCombinations(map, VirtualKey.INVERTED_EXCLAMATION_MARK, '1', '!', '¹', '¡', true); |
---|
[456] | 148 | |
---|
[558] | 149 | assertCombinations(map, VirtualKey.DIGIT_2, '2', '"', '²', '⅛', true); |
---|
| 150 | assertCombinations(map, VirtualKey.QUOTEDBL, '2', '"', '²', '⅛', true); |
---|
[456] | 151 | |
---|
[558] | 152 | assertCombinations(map, VirtualKey.DIGIT_3, '3', '§', '³', '£', true); |
---|
[456] | 153 | |
---|
[558] | 154 | assertCombinations(map, VirtualKey.DIGIT_4, '4', '$', '¼', '¤', true); |
---|
| 155 | assertCombinations(map, VirtualKey.DOLLAR, '4', '$', '¼', '¤', true); |
---|
[456] | 156 | |
---|
[558] | 157 | assertCombinations(map, VirtualKey.DIGIT_5, '5', '%', '½', '⅜', true); |
---|
[456] | 158 | |
---|
[558] | 159 | assertCombinations(map, VirtualKey.DIGIT_6, '6', '&', '¾', '⅝', true); |
---|
| 160 | assertCombinations(map, VirtualKey.AMPERSAND, '6', '&', '¾', '⅝', true); |
---|
[456] | 161 | |
---|
[558] | 162 | assertCombinations(map, VirtualKey.DIGIT_7, '7', '/', '{', '⅞', true); |
---|
| 163 | assertCombinations(map, VirtualKey.SLASH, '7', '/', '{', '⅞', true); |
---|
| 164 | assertCombinations(map, VirtualKey.BRACELEFT, '7', '/', '{', '⅞', true); |
---|
[456] | 165 | |
---|
[558] | 166 | assertCombinations(map, VirtualKey.DIGIT_8, '8', '(', '[', '™', true); |
---|
| 167 | assertCombinations(map, VirtualKey.LEFT_PARENTHESIS, '8', '(', '[', '™', true); |
---|
| 168 | assertCombinations(map, VirtualKey.OPEN_BRACKET, '8', '(', '[', '™', true); |
---|
[456] | 169 | |
---|
[558] | 170 | assertCombinations(map, VirtualKey.DIGIT_9, '9', ')', ']', '±', true); |
---|
| 171 | assertCombinations(map, VirtualKey.RIGHT_PARENTHESIS, '9', ')', ']', '±', true); |
---|
| 172 | assertCombinations(map, VirtualKey.CLOSE_BRACKET, '9', ')', ']', '±', true); |
---|
[456] | 173 | |
---|
[558] | 174 | assertCombinations(map, VirtualKey.DIGIT_0, '0', '=', '}', 0, true); |
---|
| 175 | assertCombinations(map, VirtualKey.EQUALS, '0', '=', '}', 0, true); |
---|
| 176 | assertCombinations(map, VirtualKey.BRACERIGHT, '0', '=', '}', 0, true); |
---|
[456] | 177 | |
---|
[558] | 178 | assertCombinations(map, VirtualKey.BACK_SLASH, 'ß', '?', '\\', '¿', true); |
---|
[456] | 179 | |
---|
[558] | 180 | assertCombinations(map, VirtualKey.LETTER_Q, 'q', 'Q', '@', 'Ω', true); |
---|
| 181 | assertCombinations(map, VirtualKey.AT, 'q', 'Q', '@', 'Ω', true); |
---|
[456] | 182 | |
---|
[558] | 183 | assertCombinations(map, VirtualKey.LETTER_W, 'w', 'W', 0, 0, true); |
---|
[456] | 184 | |
---|
[558] | 185 | assertCombinations(map, VirtualKey.LETTER_E, 'e', 'E', '€', 0, true); |
---|
| 186 | assertCombinations(map, VirtualKey.EURO_SIGN, 'e', 'E', '€', 0, true); |
---|
[456] | 187 | |
---|
[558] | 188 | assertCombinations(map, VirtualKey.LETTER_R, 'r', 'R', 0, '®', true); |
---|
[456] | 189 | |
---|
[558] | 190 | assertCombinations(map, VirtualKey.LETTER_T, 't', 'T', 'ŧ', 'Ŧ', true); |
---|
[456] | 191 | |
---|
[558] | 192 | assertCombinations(map, VirtualKey.LETTER_Z, 'z', 'Z', '←', '¥', true); |
---|
[456] | 193 | |
---|
[558] | 194 | assertCombinations(map, VirtualKey.LETTER_U, 'u', 'U', '↓', '↑', true); |
---|
[456] | 195 | |
---|
[558] | 196 | assertCombinations(map, VirtualKey.LETTER_I, 'i', 'I', '→', 'ı', true); |
---|
[456] | 197 | |
---|
[558] | 198 | assertCombinations(map, VirtualKey.LETTER_O, 'o', 'O', 'ø', 'Ø', true); |
---|
[456] | 199 | |
---|
[558] | 200 | assertCombinations(map, VirtualKey.LETTER_P, 'p', 'P', 'þ', 'Þ', true); |
---|
[456] | 201 | |
---|
[558] | 202 | assertCombinations(map, VirtualKey.LETTER_A, 'a', 'A', 'æ', 'Æ', true); |
---|
[456] | 203 | |
---|
[558] | 204 | assertCombinations(map, VirtualKey.LETTER_S, 's', 'S', 0, 0, true); |
---|
[456] | 205 | |
---|
[558] | 206 | assertCombinations(map, VirtualKey.LETTER_D, 'd', 'D', 'ð', 'Ð', true); |
---|
[456] | 207 | |
---|
[558] | 208 | assertCombinations(map, VirtualKey.LETTER_F, 'f', 'F', 'đ', 'ª', true); |
---|
[456] | 209 | |
---|
[558] | 210 | assertCombinations(map, VirtualKey.LETTER_G, 'g', 'G', 'ŋ', 'Ŋ', true); |
---|
[456] | 211 | |
---|
[558] | 212 | assertCombinations(map, VirtualKey.LETTER_H, 'h', 'H', 'ħ', 'Ħ', true); |
---|
[456] | 213 | |
---|
[558] | 214 | assertCombinations(map, VirtualKey.LETTER_J, 'j', 'J', 0, 0, true); |
---|
[456] | 215 | |
---|
[558] | 216 | assertCombinations(map, VirtualKey.LETTER_K, 'k', 'K', 'ĸ', 0, true); |
---|
[456] | 217 | |
---|
[558] | 218 | assertCombinations(map, VirtualKey.LETTER_L, 'l', 'L', 0, 0, true); |
---|
[456] | 219 | |
---|
[558] | 220 | assertCombinations(map, VirtualKey.LETTER_Y, 'y', 'Y', '»', 0, true); |
---|
[456] | 221 | |
---|
[558] | 222 | assertCombinations(map, VirtualKey.LETTER_X, 'x', 'X', '«', 0, true); |
---|
[456] | 223 | |
---|
[558] | 224 | assertCombinations(map, VirtualKey.LETTER_C, 'c', 'C', '¢', '©', true); |
---|
[456] | 225 | |
---|
[558] | 226 | assertCombinations(map, VirtualKey.LETTER_V, 'v', 'V', '„', 0, true); |
---|
[456] | 227 | |
---|
[558] | 228 | assertCombinations(map, VirtualKey.LETTER_B, 'b', 'B', '“', 0, true); |
---|
[456] | 229 | |
---|
[558] | 230 | assertCombinations(map, VirtualKey.LETTER_N, 'n', 'N', 0, 0, true); |
---|
[456] | 231 | |
---|
[558] | 232 | assertCombinations(map, VirtualKey.LETTER_M, 'm', 'M', 'µ', 'º', true); |
---|
[456] | 233 | |
---|
[558] | 234 | assertCombinations(map, VirtualKey.NUMPAD_0, '0', 0, 0, 0, false); |
---|
[456] | 235 | |
---|
[558] | 236 | assertCombinations(map, VirtualKey.NUMPAD_1, '1', 0, 0, 0, false); |
---|
[456] | 237 | |
---|
[558] | 238 | assertCombinations(map, VirtualKey.NUMPAD_2, '2', 0, 0, 0, false); |
---|
[456] | 239 | |
---|
[558] | 240 | assertCombinations(map, VirtualKey.NUMPAD_3, '3', 0, 0, 0, false); |
---|
[456] | 241 | |
---|
[558] | 242 | assertCombinations(map, VirtualKey.NUMPAD_4, '4', 0, 0, 0, false); |
---|
[456] | 243 | |
---|
[558] | 244 | assertCombinations(map, VirtualKey.NUMPAD_5, '5', 0, 0, 0, false); |
---|
[456] | 245 | |
---|
[558] | 246 | assertCombinations(map, VirtualKey.NUMPAD_6, '6', 0, 0, 0, false); |
---|
[456] | 247 | |
---|
[558] | 248 | assertCombinations(map, VirtualKey.NUMPAD_7, '7', 0, 0, 0, false); |
---|
[456] | 249 | |
---|
[558] | 250 | assertCombinations(map, VirtualKey.NUMPAD_8, '8', 0, 0, 0, false); |
---|
[456] | 251 | |
---|
[558] | 252 | assertCombinations(map, VirtualKey.NUMPAD_9, '9', 0, 0, 0, false); |
---|
[456] | 253 | |
---|
[558] | 254 | assertCombinations(map, VirtualKey.SEPARATOR, ',', 0, 0, 0, false); |
---|
| 255 | assertCombinations(map, VirtualKey.DECIMAL, ',', 0, 0, 0, false); |
---|
[456] | 256 | |
---|
[558] | 257 | assertCombinations(map, VirtualKey.CIRCUMFLEX, '^', '°', '¬', 0, true); |
---|
[456] | 258 | |
---|
[558] | 259 | assertCombinations(map, VirtualKey.TAB, '\t', 0, '\t', 0, true); |
---|
[456] | 260 | |
---|
[558] | 261 | assertCombinations(map, VirtualKey.SPACE, ' ', ' ', ' ', ' ', true); |
---|
[456] | 262 | |
---|
[558] | 263 | assertCombinations(map, VirtualKey.COMMA, ',', ';', '·', '×', true); |
---|
| 264 | assertCombinations(map, VirtualKey.SEMICOLON, ',', ';', '·', '×', true); |
---|
| 265 | assertCombinations(map, VirtualKey.MULTIPLY, ',', ';', '·', '×', true); |
---|
[456] | 266 | |
---|
[558] | 267 | assertCombinations(map, VirtualKey.MINUS, '-', '_', 0, 0, true); |
---|
| 268 | assertCombinations(map, VirtualKey.UNDERSCORE, '-', '_', 0, 0, true); |
---|
[456] | 269 | |
---|
[558] | 270 | assertCombinations(map, VirtualKey.PERIOD, '.', ':', '…', '÷', true); |
---|
| 271 | assertCombinations(map, VirtualKey.COLON, '.', ':', '…', '÷', true); |
---|
| 272 | assertCombinations(map, VirtualKey.DIVIDE, '.', ':', '…', '÷', true); |
---|
[456] | 273 | |
---|
[558] | 274 | assertCombinations(map, VirtualKey.PLUS, '+', '*', '~', 0, true); |
---|
| 275 | assertCombinations(map, VirtualKey.ASTERISK, '+', '*', '~', 0, true); |
---|
| 276 | assertCombinations(map, VirtualKey.DEAD_TILDE, '+', '*', '~', 0, true); |
---|
[456] | 277 | |
---|
[558] | 278 | assertCombinations(map, VirtualKey.LESS, '<', '>', '|', '¦', true); |
---|
| 279 | assertCombinations(map, VirtualKey.GREATER, '<', '>', '|', '¦', true); |
---|
[456] | 280 | |
---|
[558] | 281 | assertCombinations(map, VirtualKey.NUMBER_SIGN, '#', '\'', 0, 0, true); |
---|
[456] | 282 | |
---|
[558] | 283 | /* |
---|
| 284 | * DEAD_GRAVE(KeyEvent.VK_DEAD_GRAVE), DEAD_ACUTE(KeyEvent.VK_DEAD_ACUTE), |
---|
| 285 | * DEAD_CIRCUMFLEX(KeyEvent.VK_DEAD_CIRCUMFLEX), DEAD_TILDE(KeyEvent.VK_DEAD_TILDE), |
---|
| 286 | * DEAD_MACRON(KeyEvent.VK_DEAD_MACRON), DEAD_BREVE(KeyEvent.VK_DEAD_BREVE), |
---|
| 287 | * DEAD_ABOVEDOT(KeyEvent.VK_DEAD_ABOVEDOT), DEAD_DIAERESIS(KeyEvent.VK_DEAD_DIAERESIS), |
---|
| 288 | * DEAD_ABOVERING(KeyEvent.VK_DEAD_ABOVERING), |
---|
| 289 | * DEAD_DOUBLEACUTE(KeyEvent.VK_DEAD_DOUBLEACUTE), DEAD_CARON(KeyEvent.VK_DEAD_CARON), |
---|
| 290 | * DEAD_CEDILLA(KeyEvent.VK_DEAD_CEDILLA), DEAD_OGONEK(KeyEvent.VK_DEAD_OGONEK), |
---|
| 291 | * DEAD_IOTA(KeyEvent.VK_DEAD_IOTA), DEAD_VOICED_SOUND(KeyEvent.VK_DEAD_VOICED_SOUND), |
---|
| 292 | * DEAD_SEMIVOICED_SOUND(KeyEvent.VK_DEAD_SEMIVOICED_SOUND), |
---|
| 293 | */ |
---|
| 294 | } |
---|
| 295 | |
---|
| 296 | /** |
---|
[456] | 297 | * |
---|
| 298 | */ |
---|
[558] | 299 | private void assertCombinations(KeyboardMap map, |
---|
| 300 | VirtualKey key, |
---|
| 301 | int normal, |
---|
| 302 | int withShift, |
---|
| 303 | int withAltGr, |
---|
| 304 | int withShiftAndAltGr, |
---|
| 305 | boolean numLockIndependent) |
---|
[456] | 306 | { |
---|
[558] | 307 | if (numLockIndependent) { |
---|
| 308 | if (normal != 0) { |
---|
| 309 | assertCombination("normal", normal, map, key, false, false, false); |
---|
| 310 | } |
---|
| 311 | |
---|
| 312 | if (withShift != 0) { |
---|
| 313 | assertCombination("shift", withShift, map, key, false, true, false); |
---|
| 314 | } |
---|
| 315 | |
---|
| 316 | if (withAltGr != 0) { |
---|
| 317 | assertCombination("altgr", withAltGr, map, key, false, false, true); |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | if (withShiftAndAltGr != 0) { |
---|
| 321 | assertCombination("shift and altgr", withShiftAndAltGr, map, key, false, true, true); |
---|
| 322 | } |
---|
| 323 | } |
---|
| 324 | else { |
---|
| 325 | assertInvalidCombination("normal", normal, map, key, false, false, false); |
---|
| 326 | assertInvalidCombination("shift", withShift, map, key, false, true, false); |
---|
| 327 | assertInvalidCombination("altgr", withAltGr, map, key, false, false, true); |
---|
| 328 | assertInvalidCombination |
---|
| 329 | ("shift and altgr", withShiftAndAltGr, map, key, false, true, true); |
---|
| 330 | } |
---|
| 331 | |
---|
| 332 | if (normal != 0) { |
---|
| 333 | assertCombination("numlock", normal, map, key, true, false, false); |
---|
| 334 | } |
---|
| 335 | |
---|
| 336 | if (withShift != 0) { |
---|
| 337 | assertCombination("numlock and shift", withShift, map, key, true, true, false); |
---|
| 338 | } |
---|
| 339 | |
---|
| 340 | if (withAltGr != 0) { |
---|
| 341 | assertCombination("numlock and altgr", withAltGr, map, key, true, false, true); |
---|
| 342 | } |
---|
| 343 | |
---|
| 344 | if (withShiftAndAltGr != 0) { |
---|
| 345 | assertCombination |
---|
| 346 | ("numlock, shift and altgr", withShiftAndAltGr, map, key, true, true, true); |
---|
| 347 | } |
---|
[456] | 348 | } |
---|
[558] | 349 | |
---|
| 350 | /** |
---|
| 351 | * TODO: comment |
---|
| 352 | * |
---|
| 353 | * @param string |
---|
| 354 | * @param normal |
---|
| 355 | * @param characterFor |
---|
| 356 | */ |
---|
| 357 | private void assertCombination(String type, |
---|
| 358 | int expectedChar, |
---|
| 359 | KeyboardMap map, |
---|
| 360 | VirtualKey key, |
---|
| 361 | boolean numlock, |
---|
| 362 | boolean shift, |
---|
| 363 | boolean altgr) |
---|
[456] | 364 | { |
---|
[558] | 365 | String message = "checked for " + type + ": expected '" + ((char) expectedChar) + "'"; |
---|
[456] | 366 | |
---|
[558] | 367 | char retrievedChar; |
---|
| 368 | try { |
---|
| 369 | retrievedChar = map.getCharacterFor(key, numlock, shift, altgr, false); |
---|
| 370 | } |
---|
| 371 | catch (IllegalArgumentException e) { |
---|
| 372 | fail("no character found. " + message); |
---|
| 373 | return; |
---|
| 374 | } |
---|
| 375 | |
---|
| 376 | message += " but got '" + retrievedChar + "'"; |
---|
| 377 | |
---|
| 378 | assertEquals(message, expectedChar, retrievedChar); |
---|
[456] | 379 | } |
---|
| 380 | |
---|
[558] | 381 | /** |
---|
| 382 | * TODO: comment |
---|
| 383 | * |
---|
| 384 | * @param string |
---|
| 385 | * @param normal |
---|
| 386 | * @param characterFor |
---|
| 387 | */ |
---|
| 388 | private void assertInvalidCombination(String type, |
---|
| 389 | int expectedChar, |
---|
| 390 | KeyboardMap map, |
---|
| 391 | VirtualKey key, |
---|
| 392 | boolean numlock, |
---|
| 393 | boolean shift, |
---|
| 394 | boolean altgr) |
---|
[456] | 395 | { |
---|
[558] | 396 | char retrievedChar; |
---|
| 397 | try { |
---|
| 398 | retrievedChar = map.getCharacterFor(key, numlock, shift, altgr, false); |
---|
| 399 | assertEquals(Character.UNASSIGNED, retrievedChar); |
---|
| 400 | } |
---|
| 401 | catch (IllegalArgumentException e) { |
---|
| 402 | // this is ok and checked for |
---|
| 403 | } |
---|
[456] | 404 | |
---|
| 405 | } |
---|
| 406 | |
---|
| 407 | } |
---|