Search in sources :

Example 41 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method rightArrowWithMultipleLines.

@Test
public void rightArrowWithMultipleLines() {
    setupMultiLine("Here are four words").withCaretAt(0, 1);
    processor.processKey(new KeyPressedEvent(NO_MODIFIERS, KeyEvent.KEY_RIGHT, 0), model);
    assertEquals(TextLocation.at(0, 2), model.getCaretLocation());
    assertEquals(TextLocation.origin, model.getSelectionLocation());
    assertEquals(false, model.isSelectionActivated());
}
Also used : KeyPressedEvent(limelight.ui.events.panel.KeyPressedEvent) Test(org.junit.Test)

Example 42 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method downArrowMovesDownALineToTheLastCharacterIfTheFirstLineRunsPastTheSecond.

@Test
public void downArrowMovesDownALineToTheLastCharacterIfTheFirstLineRunsPastTheSecond() {
    setupMultiLine("This is a longer\nMulti lined.").withCaretAt(0, 15);
    processor.processKey(new KeyPressedEvent(NO_MODIFIERS, KeyEvent.KEY_DOWN, 0), model);
    assertEquals(model.getEndLocation(), model.getCaretLocation());
    assertEquals(TextLocation.origin, model.getSelectionLocation());
    assertEquals(false, model.isSelectionActivated());
}
Also used : KeyPressedEvent(limelight.ui.events.panel.KeyPressedEvent) Test(org.junit.Test)

Example 43 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method altRightArrowMovesToStartOfNextWordWithSelection.

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

Example 44 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method upArrowDoesNothingWhenAllTheWayUp.

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

Example 45 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method cmdDownArrowGoesToEndOfText.

@Test
public void cmdDownArrowGoesToEndOfText() {
    setupSingleLine("Here are four words").withCaretAt(0, 1);
    processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_DOWN, 0), model);
    assertEquals(model.getEndLocation(), model.getCaretLocation());
    assertEquals(false, 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