Search in sources :

Example 61 with KeyPressedEvent

use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.

the class TextInputKeyProcessorTest method altShiftCmdRightArrowDoesNothing.

@Test
public void altShiftCmdRightArrowDoesNothing() {
    setupSingleLine("Here are four words").withCaretAt(0, 1);
    processor.processKey(new KeyPressedEvent(ALT + SHIFT + CMD, KeyEvent.KEY_RIGHT, 0), model);
    assertEquals(TextLocation.at(0, 1), model.getCaretLocation());
    assertEquals(false, model.isSelectionActivated());
}
Also used : KeyPressedEvent(limelight.ui.events.panel.KeyPressedEvent) Test(org.junit.Test)

Example 62 with KeyPressedEvent

use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.

the class TextInputKeyProcessorTest method cmdVPastesAtCursorWithSelection.

@Test
public void cmdVPastesAtCursorWithSelection() {
    setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);
    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection("oot"), model);
    processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_V, 0), model);
    assertEquals("Hoot are four words", model.getText());
    assertEquals(TextLocation.at(0, 4), model.getCaretLocation());
    assertEquals(TextLocation.at(0, 1), model.getSelectionLocation());
    assertEquals(false, model.isSelectionActivated());
}
Also used : KeyPressedEvent(limelight.ui.events.panel.KeyPressedEvent) StringSelection(java.awt.datatransfer.StringSelection) Test(org.junit.Test)

Example 63 with KeyPressedEvent

use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.

the class TextInputKeyProcessorTest method shiftDownArrowMovesDownALineAndBeginsSelectionWithMultipleLines.

@Test
public void shiftDownArrowMovesDownALineAndBeginsSelectionWithMultipleLines() {
    setupMultiLine("This is\nMulti lined.").withCaretAt(0, 3);
    processor.processKey(new KeyPressedEvent(SHIFT, KeyEvent.KEY_DOWN, 0), model);
    assertEquals(TextLocation.at(1, 3), model.getCaretLocation());
    assertEquals(TextLocation.at(0, 3), model.getSelectionLocation());
    assertEquals(true, model.isSelectionActivated());
}
Also used : KeyPressedEvent(limelight.ui.events.panel.KeyPressedEvent) Test(org.junit.Test)

Example 64 with KeyPressedEvent

use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.

the class TextInputKeyProcessorTest method altRightArrowJumpsToTheNextWord.

@Test
public void altRightArrowJumpsToTheNextWord() {
    setupSingleLine("Here are four words").withCaretAt(0, 1);
    processor.processKey(new KeyPressedEvent(ALT, KeyEvent.KEY_RIGHT, 0), model);
    assertEquals(TextLocation.at(0, 5), model.getCaretLocation());
}
Also used : KeyPressedEvent(limelight.ui.events.panel.KeyPressedEvent) Test(org.junit.Test)

Example 65 with KeyPressedEvent

use of limelight.ui.events.panel.KeyPressedEvent in project limelight by slagyr.

the class TextInputKeyProcessorTest method shiftCmdUpArrowSelectsToStartOfTextWithSelectionOn.

@Test
public void shiftCmdUpArrowSelectsToStartOfTextWithSelectionOn() {
    setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);
    processor.processKey(new KeyPressedEvent(SHIFT + CMD, KeyEvent.KEY_UP, 0), model);
    assertEquals(TextLocation.origin, model.getCaretLocation());
    assertEquals(TextLocation.at(0, 4), model.getSelectionLocation());
    assertEquals(true, model.isSelectionActivated());
}
Also used : KeyPressedEvent(limelight.ui.events.panel.KeyPressedEvent) Test(org.junit.Test)

Aggregations

KeyPressedEvent (limelight.ui.events.panel.KeyPressedEvent)86 Test (org.junit.Test)86 StringSelection (java.awt.datatransfer.StringSelection)2 KeyEvent (java.awt.event.KeyEvent)1