use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.
the class TextInputKeyProcessorTest method altShiftLeftArrowSelectsToEndOfPreviousWordWithSelection.
@Test
public void altShiftLeftArrowSelectsToEndOfPreviousWordWithSelection() {
setupSingleLine("Here are four words").withCaretAt(0, 9).andSelectionAt(0, 4);
processor.processKey(new KeyPressedEvent(ALT + SHIFT, KeyEvent.KEY_LEFT, 0), model);
assertEquals(TextLocation.at(0, 5), model.getCaretLocation());
assertEquals(TextLocation.at(0, 4), model.getSelectionLocation());
assertEquals(true, model.isSelectionActivated());
}
use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.
the class TextInputKeyProcessorTest method shiftCmdRightArrowSelectsToTheRightEdgeWithSelectionOn.
@Test
public void shiftCmdRightArrowSelectsToTheRightEdgeWithSelectionOn() {
setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);
processor.processKey(new KeyPressedEvent(SHIFT + CMD, KeyEvent.KEY_RIGHT, 0), model);
assertEquals(model.getEndLocation(), model.getCaretLocation());
assertEquals(TextLocation.at(0, 4), model.getSelectionLocation());
assertEquals(true, model.isSelectionActivated());
}
use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.
the class StageKeyListenerTest method focuedPanelReceivesPressKeyEvents.
@Test
public void focuedPanelReceivesPressKeyEvents() throws Exception {
panel.getEventHandler().add(KeyPressedEvent.class, action);
listener.focusOn(panel);
final KeyEvent pressedEvent = new KeyEvent(component, 1, 2, 3, KeyEvent.VK_A, 'b');
listener.keyPressed(pressedEvent);
KeyPressedEvent keyEvent = (KeyPressedEvent) action.event;
assertSame(panel, keyEvent.getSource());
assertEquals(limelight.ui.events.panel.KeyEvent.KEY_A, keyEvent.getKeyCode());
}
use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.
the class TextInputKeyProcessorTest method altCmdCharacterDoesNothing.
@Test
public void altCmdCharacterDoesNothing() {
setupSingleLine("Here are four words").withCaretAt(0, 1);
processor.processKey(new KeyPressedEvent(ALT + CMD, KeyEvent.KEY_A, 0), model);
assertEquals(TextLocation.at(0, 1), model.getCaretLocation());
assertEquals(false, model.isSelectionActivated());
}
use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.
the class TextInputKeyProcessorTest method cmdDownArrowJumpsToTheEndWithSelection.
@Test
public void cmdDownArrowJumpsToTheEndWithSelection() {
setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);
processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_DOWN, 0), model);
assertEquals(model.getEndLocation(), model.getCaretLocation());
assertEquals(TextLocation.at(0, 4), model.getSelectionLocation());
assertEquals(false, model.isSelectionActivated());
}
Aggregations