use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.
the class TextInputKeyProcessorTest method altUpArrowMovesToStartOfLineWithSelection.
@Test
public void altUpArrowMovesToStartOfLineWithSelection() {
setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);
processor.processKey(new KeyPressedEvent(ALT, KeyEvent.KEY_UP, 0), model);
assertEquals(TextLocation.origin, model.getCaretLocation());
assertEquals(false, model.isSelectionActivated());
}
use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.
the class TextInputKeyProcessorTest method shiftCmdLeftArrowSelectsToTheLeftEdge.
@Test
public void shiftCmdLeftArrowSelectsToTheLeftEdge() {
setupSingleLine("Here are four words").withCaretAt(0, 1);
processor.processKey(new KeyPressedEvent(SHIFT + CMD, KeyEvent.KEY_LEFT, 0), model);
assertEquals(TextLocation.origin, model.getCaretLocation());
assertEquals(TextLocation.at(0, 1), model.getSelectionLocation());
assertEquals(true, model.isSelectionActivated());
}
use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.
the class TextInputKeyProcessorTest method altDownArrowMovesToEndOfLine.
@Test
public void altDownArrowMovesToEndOfLine() {
setupSingleLine("Here are four words").withCaretAt(0, 9).andSelectionAt(0, 4);
processor.processKey(new KeyPressedEvent(ALT, KeyEvent.KEY_DOWN, 0), model);
assertEquals(model.getEndLocation(), model.getCaretLocation());
assertEquals(false, model.isSelectionActivated());
}
use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.
the class TextInputKeyProcessorTest method upArrowWithMiltipleLinesAndSelection.
@Test
public void upArrowWithMiltipleLinesAndSelection() {
setupMultiLine("This is\nMulti lined.").withCaretAt(1, 3).andSelectionAt(0, 4);
processor.processKey(new KeyPressedEvent(NO_MODIFIERS, KeyEvent.KEY_UP, 0), model);
assertEquals(TextLocation.at(0, 3), model.getCaretLocation());
assertEquals(TextLocation.at(0, 4), model.getSelectionLocation());
assertEquals(false, model.isSelectionActivated());
}
use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.
the class TextInputKeyProcessorTest method cmdVPastesAtCursor.
@Test
public void cmdVPastesAtCursor() {
setupSingleLine("Bob");
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(" Dole"), model);
processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_V, 0), model);
assertEquals(model.getEndLocation(), model.getCaretLocation());
assertEquals("Bob Dole", model.getText());
}
Aggregations