Package limelight.ui.events.panel

Examples of limelight.ui.events.panel.KeyPressedEvent


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


  @Test
  public void downArrowMovesDownALineToTheLastCharacterIfTheFirstLineRunsPastTheSecond()
  {
    setupMultiLine("This is a longer\nMulti lined.").withCaretAt(0, 15);

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

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

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

  @Test
  public void goToTheEndOfNextLineEvenIfItEndsWithNewline() throws Exception
  {
    setupMultiLine("blah\nasdf\nasdf").withCaretAt(0, 4);

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

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

  @Test
  public void backSpaceDeleteSelection()
  {
    setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);
    processor.processKey(new KeyPressedEvent(NO_MODIFIERS, KeyEvent.KEY_BACK_SPACE, 0), model);

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

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

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

  @Test
  public void rightArrowWithSelection()
  {
    setupSingleLine("Here are four words").withCaretAt(0, 1).andSelectionAt(0, 4);
    processor.processKey(new KeyPressedEvent(NO_MODIFIERS, KeyEvent.KEY_RIGHT, 0), model);

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

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

  @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());
  }
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.