Search in sources :

Example 26 with MockPanel

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

the class ParentPanelTest method shouldAncestorsWithAutoDimensionsRequireLayoutWhenAllChildrenRemoved.

@Test
public void shouldAncestorsWithAutoDimensionsRequireLayoutWhenAllChildrenRemoved() throws Exception {
    createFamilyTree();
    MockPanel newPanel = new MockPanel();
    grandChild.add(newPanel);
    resetFamilyLayouts();
    grandChild.removeAll();
    assertEquals(true, grandChild.needsLayout());
    assertEquals(true, child.needsLayout());
    assertEquals(true, parent.needsLayout());
}
Also used : MockPanel(limelight.ui.MockPanel) Test(org.junit.Test)

Example 27 with MockPanel

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

the class ParentPanelTest method shouldGetOwnerOfPointWithNestedPanels.

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

Example 28 with MockPanel

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

the class ParentPanelTest method shouldGetChildrenReturnsACopiedList.

@Test
public void shouldGetChildrenReturnsACopiedList() throws Exception {
    Panel child = new MockPanel();
    panel.add(child);
    java.util.List<Panel> children = panel.getChildren();
    panel.remove(child);
    java.util.List<Panel> children2 = panel.getChildren();
    assertNotSame(children, children2);
    assertEquals(1, children.size());
    assertEquals(0, children2.size());
}
Also used : Panel(limelight.ui.Panel) MockPanel(limelight.ui.MockPanel) java.util(java.util) MockPanel(limelight.ui.MockPanel) Test(org.junit.Test)

Example 29 with MockPanel

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

the class ParentPanelTest method shouldAddingChildrenAtIndex.

@Test
public void shouldAddingChildrenAtIndex() throws Exception {
    Panel childA = new MockPanel();
    Panel childB = new MockPanel();
    Panel childC = new MockPanel();
    panel.add(0, childA);
    panel.add(0, childB);
    panel.add(1, childC);
    assertSame(childA, panel.getChildren().get(2));
    assertSame(childB, panel.getChildren().get(0));
    assertSame(childC, panel.getChildren().get(1));
    assertSame(panel, childA.getParent());
    assertSame(panel, childB.getParent());
    assertSame(panel, childC.getParent());
}
Also used : Panel(limelight.ui.Panel) MockPanel(limelight.ui.MockPanel) MockPanel(limelight.ui.MockPanel) Test(org.junit.Test)

Example 30 with MockPanel

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

the class ParentPanelTest method shouldGetOwnerOfPointWithAFloater.

@Test
public void shouldGetOwnerOfPointWithAFloater() throws Exception {
    MockPanel child1 = new MockPanel();
    child1.setLocation(0, 0);
    child1.setSize(100, 100);
    MockPanel floater = new MockPanel();
    floater.floater = true;
    floater.setLocation(25, 25);
    floater.setSize(50, 50);
    panel.add(child1);
    panel.add(floater);
    assertSame(child1, panel.getOwnerOfPoint(new Point(0, 0)));
    assertSame(floater, panel.getOwnerOfPoint(new Point(50, 50)));
}
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