Search in sources :

Example 76 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method downArrowDoesNothingWhenAtBottom.

@Test
public void downArrowDoesNothingWhenAtBottom() {
    setupMultiLine("This is\nMulti lined.").withCaretAt(1, 3);
    processor.processKey(new KeyPressedEvent(NO_MODIFIERS, KeyEvent.KEY_DOWN, 0), model);
    assertEquals(TextLocation.at(1, 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 77 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method deleteDeletesSelection.

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

Example 78 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method downArrowMovesDownALine.

@Test
public void downArrowMovesDownALine() {
    setupMultiLine("This is\nMulti lined.").withCaretAt(1, 3);
    processor.processKey(new KeyPressedEvent(NO_MODIFIERS, KeyEvent.KEY_DOWN, 0), model);
    assertEquals(TextLocation.at(1, 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 79 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method downArrowWithMultipleLinesAndSelection.

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

Example 80 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method downArrowWithSelection.

@Test
public void downArrowWithSelection() {
    setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);
    processor.processKey(new KeyPressedEvent(NO_MODIFIERS, 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