Package limelight.ui.events.panel

Examples of limelight.ui.events.panel.KeyPressedEvent


  @Test
  public void cmdLeftArrowGoesToStartOfLineWithMultipleLines()
  {
    setupMultiLine("Here are\nfour words").withCaretAt(1, 5);

    processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_LEFT, 0), model);

    assertEquals(TextLocation.at(1, 0), model.getCaretLocation());
    assertEquals(false, model.isSelectionActivated());
  }
View Full Code Here


  @Test
  public void cmdUpArrowGoesToStartOfText()
  {
    setupSingleLine("Here are four words").withCaretAt(0, 5);

    processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_UP, 0), model);

    assertEquals(TextLocation.origin, model.getCaretLocation());
    assertEquals(false, model.isSelectionActivated());
  }
View Full Code Here

  @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());
  }
View Full Code Here

  @Test
  public void cmdUpArrowGoesToStartOfTextWithMultipleLines()
  {
    setupMultiLine("Here are\nfour words").withCaretAt(1, 5);

    processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_UP, 0), model);

    assertEquals(TextLocation.origin, model.getCaretLocation());
    assertEquals(false, model.isSelectionActivated());
  }
View Full Code Here

  @Test
  public void cmdDownArrowGoesToEndOfTextWithMultipleLines()
  {
    setupMultiLine("Here are\nfour words").withCaretAt(1, 3);

    processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_DOWN, 0), model);

    assertEquals(model.getEndLocation(), model.getCaretLocation());
    assertEquals(false, model.isSelectionActivated());
  }
View Full Code Here

  @Test
  public void cmdASelectsAllWithSelection()
  {
    setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);

    processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_A, 0), model);

    assertEquals(model.getEndLocation(), model.getCaretLocation());
    assertEquals(TextLocation.origin, model.getSelectionLocation());
    assertEquals(true, model.isSelectionActivated());
  }
View Full Code Here

  public void cmdVPastesAtCursorWithSelection()
  {
    setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);
    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection("oot"), model);

    processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_V, 0), model);

    assertEquals("Hoot are four words", model.getText());
    assertEquals(TextLocation.at(0, 4), model.getCaretLocation());
    assertEquals(TextLocation.at(0, 1), model.getSelectionLocation());
    assertEquals(false, model.isSelectionActivated());
View Full Code Here

  @Test
  public void cmdCCopiesSelectedTextWithSelection()
  {
    setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);

    processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_C, 0), model);

    assertEquals("Here are four words", model.getText());
    assertEquals(TextLocation.at(0, 1), model.getCaretLocation());
    assertEquals(TextLocation.at(0, 4), model.getSelectionLocation());
    assertEquals(true, model.isSelectionActivated());
View Full Code Here

  @Test
  public void cmdXCutsSelectedTextWithSelection()
  {
    setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);

    processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_X, 0), model);

    assertEquals("H are four words", model.getText());
    assertEquals(TextLocation.at(0, 1), model.getCaretLocation());
    assertEquals(TextLocation.at(0, 1), model.getSelectionLocation());
    assertEquals(false, model.isSelectionActivated());
View Full Code Here

  @Test
  public void cmdRightArrowJumpsToRightEdgeAndEndsSelection()
  {
    setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);

    processor.processKey(new KeyPressedEvent(CMD, KeyEvent.KEY_RIGHT, 0), model);

    assertEquals(model.getEndLocation(), model.getCaretLocation());
    assertEquals(TextLocation.at(0, 4), model.getSelectionLocation());
    assertEquals(false, model.isSelectionActivated());
  }
View Full Code Here

TOP

Related Classes of limelight.ui.events.panel.KeyPressedEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.