Search in sources :

Example 6 with MockEventAction

use of limelight.ui.model.inputs.MockEventAction in project limelight by slagyr.

the class PanelEventTest method dispatching.

@Test
public void dispatching() throws Exception {
    MockPanel recipient = new MockPanel();
    MockEventAction action = new MockEventAction();
    recipient.getEventHandler().add(event.getClass(), action);
    event.dispatch(recipient);
    assertEquals(event, action.event);
    assertEquals(source, event.getSource());
    assertEquals(source, event.getRecipient());
}
Also used : MockPanel(limelight.ui.MockPanel) MockEventAction(limelight.ui.model.inputs.MockEventAction) Test(org.junit.Test)

Example 7 with MockEventAction

use of limelight.ui.model.inputs.MockEventAction in project limelight by slagyr.

the class StageEventTest method dispatching.

@Test
public void dispatching() throws Exception {
    StageEvent event = new TestableStageEvent();
    MockEventAction action = new MockEventAction();
    stage.getEventHandler().add(TestableStageEvent.class, action);
    event.dispatch(stage);
    assertEquals(true, action.invoked);
}
Also used : MockEventAction(limelight.ui.model.inputs.MockEventAction) Test(org.junit.Test)

Example 8 with MockEventAction

use of limelight.ui.model.inputs.MockEventAction in project limelight by slagyr.

the class AlertFrameManagerTest method setUp.

@Before
public void setUp() throws Exception {
    assumeTrue(TestUtil.notHeadless());
    StageFrame.hiddenMode = false;
    context = MockContext.stub();
    manager = new AlertFrameManager(context);
    context.frameManager = manager;
    context.studio = new MockStudio();
    context.environment = "test";
    stage = new MockStage();
    frame = new StageFrame(stage);
    action = new MockEventAction();
}
Also used : MockStudio(limelight.model.api.MockStudio) MockEventAction(limelight.ui.model.inputs.MockEventAction) Before(org.junit.Before)

Example 9 with MockEventAction

use of limelight.ui.model.inputs.MockEventAction in project limelight by slagyr.

the class StageKeyListenerTest method setUp.

@Before
public void setUp() throws Exception {
    root = new FakeScene();
    listener = new StageKeyListener(root);
    panel = new MockParentPanel();
    root.add(panel);
    component = new Panel();
    action = new MockEventAction();
    action2 = new MockEventAction();
}
Also used : TestableInputPanel(limelight.ui.model.inputs.TestableInputPanel) MockPanel(limelight.ui.MockPanel) MockEventAction(limelight.ui.model.inputs.MockEventAction) Before(org.junit.Before)

Example 10 with MockEventAction

use of limelight.ui.model.inputs.MockEventAction in project limelight by slagyr.

the class StageMouseListenerTest method mouseEnteredAndExited.

@Test
public void mouseEnteredAndExited() throws Exception {
    MockPanel child2Panel = new MockPanel();
    parent.add(child2Panel);
    child2Panel.setLocation(1, 1);
    child2Panel.setSize(100, 100);
    assertNull(listener.hooveredPanel);
    MockEventAction moveAction = new MockEventAction();
    parent.getEventHandler().add(MouseEnteredEvent.class, parentAction);
    parent.getEventHandler().add(MouseMovedEvent.class, moveAction);
    listener.mouseMoved(event(0, 0));
    assertSame(parent, listener.hooveredPanel);
    checkEvent(parentAction, MouseEnteredEvent.class, 0, 0);
    checkEvent(moveAction, MouseMovedEvent.class, 0, 0);
    moveAction.reset();
    parentAction.reset();
    MockEventAction child2MoveAction = new MockEventAction();
    child2Panel.getEventHandler().add(MouseEnteredEvent.class, childAction);
    child2Panel.getEventHandler().add(MouseMovedEvent.class, child2MoveAction);
    listener.mouseMoved(event(50, 50));
    assertSame(child2Panel, listener.hooveredPanel);
    assertEquals(false, moveAction.invoked || parentAction.invoked);
    checkEvent(childAction, MouseEnteredEvent.class, 50, 50);
    checkEvent(child2MoveAction, MouseMovedEvent.class, 50, 50);
    child2MoveAction.reset();
    MockEventAction childExitAction = new MockEventAction();
    MockEventAction childMoveAction = new MockEventAction();
    child2Panel.getEventHandler().add(MouseExitedEvent.class, childExitAction);
    child.getEventHandler().add(MouseMovedEvent.class, childMoveAction);
    listener.mouseMoved(event(500, 500));
    assertSame(child, listener.hooveredPanel);
    checkEvent(childExitAction, MouseExitedEvent.class, 500, 500);
    checkEvent(childMoveAction, MouseMovedEvent.class, 500, 500);
}
Also used : MockPanel(limelight.ui.MockPanel) MockEventAction(limelight.ui.model.inputs.MockEventAction) Test(org.junit.Test)

Aggregations

MockEventAction (limelight.ui.model.inputs.MockEventAction)15 Test (org.junit.Test)8 Before (org.junit.Before)7 MockPanel (limelight.ui.MockPanel)5 java.awt (java.awt)1 FakeProduction (limelight.model.FakeProduction)1 MockStudio (limelight.model.api.MockStudio)1 TestablePanelBase (limelight.ui.model.TestablePanelBase)1 TestableParentPanel (limelight.ui.model.TestableParentPanel)1 TestableInputPanel (limelight.ui.model.inputs.TestableInputPanel)1