Search in sources :

Example 81 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method shiftCmdUpArrowSelectsToStartOfText.

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

Example 82 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method rightArrow.

@Test
public void rightArrow() {
    setupSingleLine("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(false, model.isSelectionActivated());
}
Also used : KeyPressedEvent(limelight.ui.events.panel.KeyPressedEvent) Test(org.junit.Test)

Example 83 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method rightArrowWithSelection.

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

Example 84 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method leftArrowWithMultipleLines.

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

Example 85 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method delete.

@Test
public void delete() {
    setupSingleLine("Here are four words").withCaretAt(0, 1);
    processor.processKey(new KeyPressedEvent(NO_MODIFIERS, KeyEvent.KEY_DELETE, 0), model);
    assertEquals(TextLocation.at(0, 1), model.getCaretLocation());
    assertEquals("Hre are four words", model.getText());
    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