Package limelight.ui.events.panel

Source Code of limelight.ui.events.panel.ModifiableEventTest

//- 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 ModifiableEventTest
{
  private Panel panel;
  private ModifiableEvent event;

  private static class TestableModifiableEvent extends ModifiableEvent
  {
    public TestableModifiableEvent(Panel panel, int modifiers)
    {
      super(modifiers);
    }
  }

  @Before
  public void setUp()
  {
    panel = new MockPanel();
    event = new TestableModifiableEvent(panel, 0);
  }

  @Test
  public void allModifiersOff() throws Exception
  {
    assertEquals(false, event.isShiftDown());
    assertEquals(false, event.isControlDown());
    assertEquals(false, event.isCommandDown());
    assertEquals(false, event.isAltDown());
  }

  @Test
  public void allModifiersOn() throws Exception
  {
    int all = ModifiableEvent.SHIFT_MASK | ModifiableEvent.CONTROL_MASK | ModifiableEvent.COMMAND_MASK | ModifiableEvent.ALT_MASK;
    event.setModifiers(all);

    assertEquals(true, event.isShiftDown());
    assertEquals(true, event.isControlDown());
    assertEquals(true, event.isCommandDown());
    assertEquals(true, event.isAltDown());
  }


}
TOP

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

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.