Package limelight.ui.events.panel

Examples of limelight.ui.events.panel.KeyPressedEvent


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

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

    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 altShiftRightArrowSelectsToTheNextWord()
  {
    setupSingleLine("Here are four words").withCaretAt(0, 1);

    processor.processKey(new KeyPressedEvent(ALT + SHIFT, KeyEvent.KEY_RIGHT, 0), model);

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

  {
    setupSingleLine("Here are four words").withCaretAt(0, 1);

    model.setCaretLocation(TextLocation.at(0, 9));

    processor.processKey(new KeyPressedEvent(ALT + SHIFT, KeyEvent.KEY_LEFT, 0), model);

    assertEquals(TextLocation.at(0, 5), model.getCaretLocation());
    assertEquals(TextLocation.at(0, 9), model.getSelectionLocation());
    assertEquals(true, model.isSelectionActivated());
  }
View Full Code Here

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

    processor.processKey(new KeyPressedEvent(ALT + SHIFT, KeyEvent.KEY_RIGHT, 0), model);

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

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

    processor.processKey(new KeyPressedEvent(ALT + SHIFT, KeyEvent.KEY_LEFT, 0), model);

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

  @Test
  public void cmdASelectsAll()
  {
    setupSingleLine("Bob");

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

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

  public void cmdVPastesAtCursor()
  {
    setupSingleLine("Bob");
    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(" Dole"), model);

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

    assertEquals(model.getEndLocation(), model.getCaretLocation());
    assertEquals("Bob Dole", model.getText());
  }
View Full Code Here

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

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

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

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

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

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

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

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

    assertEquals(TextLocation.origin, model.getCaretLocation());
    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.