--- old/modules/controls/src/test/java/com/sun/javafx/scene/control/behavior/KeyBindingTest.java 2015-09-03 15:26:27.019766900 -0700 +++ /dev/null 2015-09-03 15:26:28.000000000 -0700 @@ -1,39 +0,0 @@ -package com.sun.javafx.scene.control.behavior; - -import javafx.scene.input.KeyCode; -import javafx.scene.input.KeyEvent; -import org.junit.Test; -import static org.junit.Assert.*; - -public class KeyBindingTest { - - @Test public void getSpecificity() { - final KeyCode code = KeyCode.ENTER; - - // Expected answer: - // 1 pt for matching key code - // 1 pt for matching key event type - // 1 pt for matching no alt - // 1 pt for matching no meta - // 1 pt for matching shift or control - // 0 pt for the other optional value of control/shift - // - // Total = 5. - // - int expect = 5; - - KeyBinding uut = new KeyBinding(code, "ShiftEnter").shift().ctrl(OptionalBoolean.ANY); - - KeyEvent event = new KeyEvent(KeyEvent.KEY_PRESSED, null, - null, code, true, false, false, false); - - assertEquals(expect, uut.getSpecificity(null, event)); // Gets 6 (fx 2.2, fx 8) - - uut = new KeyBinding(code, "CtrlEnter").shift(OptionalBoolean.ANY).ctrl(); - - event = new KeyEvent(KeyEvent.KEY_PRESSED, null, - null, code, false, true, false, false); - - assertEquals(expect, uut.getSpecificity(null, event)); // Gets 2 (fx 2.2, fx 8) - } -} \ No newline at end of file --- /dev/null 2015-09-03 15:26:28.000000000 -0700 +++ new/modules/controls/src/test/java/com/sun/javafx/scene/control/inputmap/KeyBindingTest.java 2015-09-03 15:26:26.235722100 -0700 @@ -0,0 +1,39 @@ +package com.sun.javafx.scene.control.inputmap; + +import javafx.scene.input.KeyCode; +import javafx.scene.input.KeyEvent; +import org.junit.Test; +import static org.junit.Assert.*; + +public class KeyBindingTest { + + @Test public void getSpecificity() { + final KeyCode code = KeyCode.ENTER; + + // Expected answer: + // 1 pt for matching key code + // 1 pt for matching key event type + // 1 pt for matching no alt + // 1 pt for matching no meta + // 1 pt for matching shift or control + // 0 pt for the other optional value of control/shift + // + // Total = 5. + // + int expect = 5; + + KeyBinding uut = new KeyBinding(code).shift().ctrl(KeyBinding.OptionalBoolean.ANY); + + KeyEvent event = new KeyEvent(KeyEvent.KEY_PRESSED, null, + null, code, true, false, false, false); + + assertEquals(expect, uut.getSpecificity(event)); // Gets 6 (fx 2.2, fx 8) + + uut = new KeyBinding(code).shift(KeyBinding.OptionalBoolean.ANY).ctrl(); + + event = new KeyEvent(KeyEvent.KEY_PRESSED, null, + null, code, false, true, false, false); + + assertEquals(expect, uut.getSpecificity(event)); // Gets 2 (fx 2.2, fx 8) + } +} \ No newline at end of file