Package limelight.ui.events.panel

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

//- 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 java.awt.*;

import static junit.framework.Assert.assertEquals;

public class MouseWheelEventTest
{
  private Panel panel;
  private MouseWheelEvent event;

  @Before
  public void setUp() throws Exception
  {
    panel = new MockPanel();
    event = new MouseWheelEvent(123, new Point(1, 2), 0, MouseWheelEvent.UNIT_SCROLL, 3, 4);
  }

  @Test
  public void canGetAttributes() throws Exception
  {
    assertEquals(123, event.getModifiers());
    assertEquals(new Point(1, 2), event.getAbsoluteLocation());
    assertEquals(0, event.getClickCount());
    assertEquals(MouseWheelEvent.UNIT_SCROLL, event.getScrollType());
    assertEquals(3, event.getScrollAmount());
    assertEquals(4, event.getWheelRotation());
  }

  @Test
  public void isVerticalAndIsHorizontal() throws Exception
  {
    event.setModifiers(0);

    assertEquals(true, event.isVertical());
    assertEquals(false, event.isHorizontal());

    event.setModifiers(ModifiableEvent.SHIFT_MASK);

    assertEquals(false, event.isVertical());
    assertEquals(true, event.isHorizontal());
  }

  @Test
  public void isInheritable() throws Exception
  {
    assertEquals(true, event.isInheritable());
  }
}
TOP

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

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.