Examples of MockPanel


Examples of limelight.ui.MockPanel

    root = new FakeScene();
    parent = new MockParentPanel();
    root.add(parent);
    child = new MockParentPanel();
    parent.add(child);
    grandChild = new MockPanel();
    child.add(grandChild);
    sibling = new MockPanel();
    parent.add(sibling);

    root.setStage(new MockStage());
  }
View Full Code Here

Examples of limelight.ui.MockPanel

  @Test
  public void shouldGetClosestCommonAncestorExceptionCase() throws Exception
  {
    createFamilyTree();

    assertEquals(null, parent.getClosestCommonAncestor(new MockPanel()));
  }
View Full Code Here

Examples of limelight.ui.MockPanel

  }

  @Test
  public void overridingLayouts() throws Exception
  {
    Panel panel = new MockPanel();
    final FakeLayout weakLayout = new FakeLayout(false);
    final FakeLayout strongLayout = new FakeLayout(true);

    panel.markAsNeedingLayout(weakLayout);
    panel.markAsNeedingLayout(strongLayout);

    assertSame(strongLayout, panel.resetNeededLayout());
  }
View Full Code Here

Examples of limelight.ui.MockPanel

    FakeScene root = new FakeScene();
    listener = new StageMouseListener(root);

    parent = new MockParentPanel();
    child = new MockPanel();

    root.add(parent);
    parent.add(child);

    Scene scene = new FakeScene();
View Full Code Here

Examples of limelight.ui.MockPanel

  }

  @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);
View Full Code Here

Examples of limelight.ui.MockPanel

  }

  @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);
View Full Code Here

Examples of limelight.ui.MockPanel

  @Test
  public void focusIsLostWhenChangingFocus() throws Exception
  {
    panel.getEventHandler().add(FocusLostEvent.class, action);
    MockPanel panel2 = new MockPanel();
    panel2.getEventHandler().add(FocusGainedEvent.class, action2);

    listener.focusOn(panel);
    listener.focusOn(panel2);

    assertEquals(panel2, listener.getFocusedPanel());
View Full Code Here

Examples of limelight.ui.MockPanel

  }

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

Examples of limelight.ui.MockPanel

  private CharTypedEvent event;

  @Before
  public void setUp() throws Exception
  {
    panel = new MockPanel();
    event = new CharTypedEvent(123, 'a');
  }
View Full Code Here

Examples of limelight.ui.MockPanel

  }

  @Before
  public void setUp() throws Exception
  {
    source = new MockPanel();
    event = new TestableEvent();
    event.setSource(source);
  }
View Full Code Here
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.