Package limelight.ui.events.panel

Source Code of limelight.ui.events.panel.KeyEventTest$TestableKeyEvent

//- Copyright © 2008-2011 8th Light, Inc. All Rights Reserved.
//- Limelight and all included source files are distributed under terms of the MIT License.

package limelight.ui.events.panel;

import limelight.ui.MockPanel;
import limelight.ui.Panel;
import org.junit.Before;
import org.junit.Test;

import static junit.framework.Assert.assertEquals;

public class KeyEventTest
{
  private Panel panel;
  private KeyEvent event;

  private static class TestableKeyEvent extends KeyEvent
  {
    public TestableKeyEvent(Panel panel, int modifiers, int keyCode, int location)
    {
      super(modifiers, keyCode, location);
    }
  }

  @Before
  public void setUp() throws Exception
  {
    panel = new MockPanel();
    event = new TestableKeyEvent(panel, 123, KeyEvent.KEY_ENTER, KeyEvent.LOCATION_LEFT);
  }

  @Test
  public void canGetKeyCodeAndLocation() throws Exception
  {
    assertEquals(KeyEvent.KEY_ENTER, event.getKeyCode());
    assertEquals(KeyEvent.LOCATION_LEFT, event.getKeyLocation());
  }
}
TOP

Related Classes of limelight.ui.events.panel.KeyEventTest$TestableKeyEvent

TOP
Copyright © 2018 www.massapi.com. 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.