Search in sources :

Example 6 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method altShiftCmdCharacterDoesNothing.

@Test
public void altShiftCmdCharacterDoesNothing() {
    setupSingleLine("Here are four words").withCaretAt(0, 1);
    processor.processKey(new KeyPressedEvent(ALT + SHIFT + CMD, KeyEvent.KEY_A, 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 7 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method altDownGoesToEndOfLineWithMultipleLines.

@Test
public void altDownGoesToEndOfLineWithMultipleLines() throws Exception {
    setupMultiLine("This is\nMulti lined.").withCaretAt(0, 3);
    processor.processKey(new KeyPressedEvent(ALT, KeyEvent.KEY_DOWN, 0), model);
    assertEquals(TextLocation.at(0, 7), model.getCaretLocation());
}
Also used : KeyPressedEvent(limelight.ui.events.panel.KeyPressedEvent) Test(org.junit.Test)

Example 8 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method shiftCmdUpArrowSelectsToStartOfTextWithMultipleLines.

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

Example 9 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method shiftCmdDownArrowSelectsToEndOfTextMultipleLines.

@Test
public void shiftCmdDownArrowSelectsToEndOfTextMultipleLines() {
    setupMultiLine("Here are\nfour words").withCaretAt(0, 1);
    processor.processKey(new KeyPressedEvent(SHIFT + CMD, KeyEvent.KEY_DOWN, 0), model);
    assertEquals(model.getEndLocation(), 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 10 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method goToTheEndOfPreviousLineEvenIfItEndsWithNewline.

@Test
public void goToTheEndOfPreviousLineEvenIfItEndsWithNewline() throws Exception {
    setupMultiLine("Some more text\nand some more");
    model.setCaretLocation(model.getEndLocation());
    processor.processKey(new KeyPressedEvent(NO_MODIFIERS, KeyEvent.KEY_UP, 0), model);
    assertEquals(TextLocation.at(0, 13), model.getCaretLocation());
    assertEquals(TextLocation.origin, model.getSelectionLocation());
    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