Search in sources :

Example 21 with MockPanel

use of limelight.ui.MockPanel in project limelight by slagyr.

the class MouseEventTest method locationIsRelativeToChangedPanel.

@Test
public void locationIsRelativeToChangedPanel() throws Exception {
    panel.setLocation(23, 56);
    assertEquals(100, event.getLocation().x);
    assertEquals(400, event.getLocation().y);
    MockPanel recipient = new MockPanel();
    recipient.setLocation(100, 400);
    event.setRecipient(recipient);
    assertEquals(23, event.getLocation().x);
    assertEquals(56, event.getLocation().y);
}
Also used : MockPanel(limelight.ui.MockPanel) Test(org.junit.Test)

Example 22 with MockPanel

use of limelight.ui.MockPanel in project limelight by slagyr.

the class MouseExitedEventTest method setUp.

@Before
public void setUp() throws Exception {
    panel = new MockPanel();
    event = new MouseExitedEvent(0, new Point(0, 0), 0);
}
Also used : MockPanel(limelight.ui.MockPanel) Before(org.junit.Before)

Example 23 with MockPanel

use of limelight.ui.MockPanel in project limelight by slagyr.

the class ParentPanelTest method shouldSterilization.

@Test
public void shouldSterilization() throws Exception {
    panel.sterilize();
    try {
        panel.add(new MockPanel());
        fail("Should have thrown an exception");
    } catch (SterilePanelException e) {
        assertEquals("The panel for prop 'TestableParentPanel' has been sterilized. Child components may not be added.", e.getMessage());
    }
    assertEquals(0, panel.getChildren().size());
    assertEquals(true, panel.isSterilized());
}
Also used : MockPanel(limelight.ui.MockPanel) Test(org.junit.Test)

Example 24 with MockPanel

use of limelight.ui.MockPanel in project limelight by slagyr.

the class ParentPanelTest method createFamilyTree.

private void createFamilyTree() {
    root = new FakeScene();
    parent = new MockParentPanel();
    root.add(parent);
    child = new MockParentPanel();
    parent.add(child);
    grandChild = new MockParentPanel();
    child.add(grandChild);
    sibling = new MockPanel();
    parent.add(sibling);
    root.setStage(new MockStage());
}
Also used : MockPanel(limelight.ui.MockPanel)

Example 25 with MockPanel

use of limelight.ui.MockPanel in project limelight by slagyr.

the class ParentPanelTest method shouldGetOwnerOfPointWithOverlappingFloaters.

@Test
public void shouldGetOwnerOfPointWithOverlappingFloaters() throws Exception {
    MockPanel child1 = new MockPanel();
    child1.setLocation(0, 0);
    child1.setSize(100, 100);
    MockPanel floater1 = new MockPanel();
    floater1.floater = true;
    floater1.setLocation(10, 10);
    floater1.setSize(50, 50);
    MockPanel floater2 = new MockPanel();
    floater2.floater = true;
    floater2.setLocation(40, 40);
    floater2.setSize(50, 50);
    panel.add(child1);
    panel.add(floater1);
    panel.add(floater2);
    assertSame(child1, panel.getOwnerOfPoint(new Point(0, 0)));
    assertSame(floater2, panel.getOwnerOfPoint(new Point(50, 50)));
    assertSame(floater1, panel.getOwnerOfPoint(new Point(20, 20)));
    assertSame(floater2, panel.getOwnerOfPoint(new Point(80, 80)));
}
Also used : MockPanel(limelight.ui.MockPanel) Test(org.junit.Test)

Aggregations

MockPanel (limelight.ui.MockPanel)40 Test (org.junit.Test)26 Panel (limelight.ui.Panel)12 Before (org.junit.Before)10 MockEventAction (limelight.ui.model.inputs.MockEventAction)4 java.util (java.util)2 MockAnimation (limelight.background.MockAnimation)2 java.awt (java.awt)1 Point (java.awt.Point)1 Box (limelight.util.Box)1