Search in sources :

Example 16 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method altCmdCharacterAndDoNothingWithSelection.

@Test
public void altCmdCharacterAndDoNothingWithSelection() {
    setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);
    processor.processKey(new KeyPressedEvent(ALT + CMD, KeyEvent.KEY_A, 0), model);
    assertEquals(TextLocation.at(0, 1), 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)

Example 17 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method clearDeletesSelection.

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

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

the class TextInputKeyProcessorTest method altUpGoesToBeginningOfLineWithMultipleLines.

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

Example 19 with KeyPressedEvent

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

the class TextInputKeyProcessorTest method leftArrowWithSelection.

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

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

the class TextInputKeyProcessorTest method shiftCmdUpArrowSelectsToStartOfTextWithMultipleLinesWithSelectionOn.

@Test
public void shiftCmdUpArrowSelectsToStartOfTextWithMultipleLinesWithSelectionOn() {
    setupMultiLine("Here are\nfour words").withCaretAt(1, 4).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