Search in sources :

Example 11 with MockEventAction

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

the class StageMouseListenerTest method draggingInvokesEnteredAndExited.

@Test
public void draggingInvokesEnteredAndExited() throws Exception {
    MockPanel child2Panel = new MockPanel();
    parent.add(child2Panel);
    child2Panel.setLocation(1, 1);
    child2Panel.setSize(100, 100);
    assertNull(listener.hooveredPanel);
    MockEventAction parentDragAction = new MockEventAction();
    parent.getEventHandler().add(MouseDraggedEvent.class, parentDragAction);
    listener.mousePressed(event(0, 0));
    listener.mouseDragged(event(0, 0));
    assertSame(parent, listener.hooveredPanel);
    checkEvent(parentDragAction, MouseDraggedEvent.class, 0, 0);
    parentDragAction.reset();
    MockEventAction child2EnteredAction = new MockEventAction();
    child2Panel.getEventHandler().add(MouseEnteredEvent.class, child2EnteredAction);
    listener.mouseDragged(event(50, 50));
    assertSame(child2Panel, listener.hooveredPanel);
    checkEvent(parentDragAction, MouseDraggedEvent.class, 50, 50);
    checkEvent(child2EnteredAction, MouseEnteredEvent.class, 50, 50);
    MockEventAction child2ExitedAction = new MockEventAction();
    child2Panel.getEventHandler().add(MouseExitedEvent.class, child2ExitedAction);
    MockEventAction childEnteredAction = new MockEventAction();
    child.getEventHandler().add(MouseEnteredEvent.class, childEnteredAction);
    listener.mouseDragged(event(500, 500));
    assertSame(child, listener.hooveredPanel);
    checkEvent(child2ExitedAction, MouseExitedEvent.class, 500, 500);
    checkEvent(childEnteredAction, MouseEnteredEvent.class, 500, 500);
}
Also used : MockPanel(limelight.ui.MockPanel) MockEventAction(limelight.ui.model.inputs.MockEventAction) Test(org.junit.Test)

Example 12 with MockEventAction

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

the class ProductionEventTest method setUp.

@Before
public void setUp() throws Exception {
    production = new FakeProduction();
    event = new TestableProductionEvent();
    action = new MockEventAction();
}
Also used : FakeProduction(limelight.model.FakeProduction) MockEventAction(limelight.ui.model.inputs.MockEventAction) Before(org.junit.Before)

Example 13 with MockEventAction

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

the class EventHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    handler = new EventHandler();
    action = new MockEventAction();
}
Also used : MockEventAction(limelight.ui.model.inputs.MockEventAction) Before(org.junit.Before)

Example 14 with MockEventAction

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

the class StageTest method settingTheSceneOnAnOpenedStage.

@Test
public void settingTheSceneOnAnOpenedStage() throws Exception {
    stage.open();
    FakeScene scene = new FakeScene();
    MockEventAction action = new MockEventAction();
    scene.getEventHandler().add(SceneOpenedEvent.class, action);
    stage.setScene(scene);
    assertEquals(stage, scene.getStage());
    assertEquals(true, action.invoked);
}
Also used : MockEventAction(limelight.ui.model.inputs.MockEventAction) Test(org.junit.Test)

Example 15 with MockEventAction

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

the class StageTest method openingAStageWithAScene.

@Test
public void openingAStageWithAScene() throws Exception {
    FakeScene scene = new FakeScene();
    MockEventAction action = new MockEventAction();
    scene.getEventHandler().add(SceneOpenedEvent.class, action);
    stage.setScene(scene);
    assertEquals(false, action.invoked);
    stage.open();
    assertEquals(true, action.invoked);
}
Also used : 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