Search in sources :

Example 6 with MockPanel

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

the class PanelBaseTest method createFamilyTree.

private void createFamilyTree() {
    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());
}
Also used : MockPanel(limelight.ui.MockPanel)

Example 7 with MockPanel

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

the class ParentPanelTest method shouldRemoveAll.

@Test
public void shouldRemoveAll() throws Exception {
    MockPanel panel1 = new MockPanel();
    MockPanel panel2 = new MockPanel();
    panel.add(panel1);
    panel.add(panel2);
    panel.removeAll();
    assertEquals(false, panel.hasChildren());
    assertEquals(0, panel.getChildren().size());
}
Also used : MockPanel(limelight.ui.MockPanel) Test(org.junit.Test)

Example 8 with MockPanel

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

the class ParentPanelTest method removeRequiresUpdate.

@Test
public void removeRequiresUpdate() throws Exception {
    Panel child = new MockPanel();
    panel.add(child);
    resetFamilyLayouts();
    panel.remove(child);
    assertEquals(true, panel.needsLayout());
}
Also used : Panel(limelight.ui.Panel) MockPanel(limelight.ui.MockPanel) MockPanel(limelight.ui.MockPanel) Test(org.junit.Test)

Example 9 with MockPanel

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

the class ParentPanelTest method shouldGetOwnerOfPoint.

@Test
public void shouldGetOwnerOfPoint() throws Exception {
    Panel panel1 = new MockPanel();
    Panel panel2 = new MockPanel();
    panel1.setLocation(0, 0);
    panel1.setSize(100, 100);
    panel2.setLocation(100, 100);
    panel2.setSize(100, 100);
    panel.add(panel1);
    panel.add(panel2);
    assertSame(panel1, panel.getOwnerOfPoint(new Point(0, 0)));
    assertSame(panel2, panel.getOwnerOfPoint(new Point(100, 100)));
    assertSame(panel1, panel.getOwnerOfPoint(new Point(50, 50)));
    assertSame(panel2, panel.getOwnerOfPoint(new Point(150, 150)));
    assertSame(panel, panel.getOwnerOfPoint(new Point(150, 50)));
    assertSame(panel, panel.getOwnerOfPoint(new Point(50, 150)));
}
Also used : Panel(limelight.ui.Panel) MockPanel(limelight.ui.MockPanel) MockPanel(limelight.ui.MockPanel) Test(org.junit.Test)

Example 10 with MockPanel

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

the class ParentPanelTest method shouldAncestorsWithAutoDimensionsRequireLayoutWhenChildrenRemoved.

@Test
public void shouldAncestorsWithAutoDimensionsRequireLayoutWhenChildrenRemoved() throws Exception {
    createFamilyTree();
    MockPanel newPanel = new MockPanel();
    grandChild.add(newPanel);
    resetFamilyLayouts();
    grandChild.remove(newPanel);
    assertEquals(true, grandChild.needsLayout());
    assertEquals(true, child.needsLayout());
    assertEquals(true, parent.needsLayout());
}
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