Search in sources :

Example 31 with Box

use of limelight.util.Box in project limelight by slagyr.

the class ParentPanelTest method shouldRactanglesAreCached.

@Test
public void shouldRactanglesAreCached() throws Exception {
    Box rectangle = panel.getBounds();
    assertSame(rectangle, panel.getBounds());
    panel.setSize(123, 456);
    assertNotSame(rectangle, panel.getBounds());
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 32 with Box

use of limelight.util.Box in project limelight by slagyr.

the class ParentPanelTest method shouldClearingCacheIsRecursive.

@Test
public void shouldClearingCacheIsRecursive() throws Exception {
    panel.setLocation(20, 21);
    Box parentBounds = panel.getAbsoluteBounds();
    MockPanel child = new MockPanel();
    panel.add(child);
    child.setLocation(10, 11);
    Box childBounds = child.getAbsoluteBounds();
    panel.setLocation(30, 31);
    assertNotSame(parentBounds, panel.getAbsoluteBounds());
    assertNotSame(childBounds, child.getAbsoluteBounds());
}
Also used : MockPanel(limelight.ui.MockPanel) Box(limelight.util.Box) Test(org.junit.Test)

Example 33 with Box

use of limelight.util.Box in project limelight by slagyr.

the class MockGraphics method clipRect.

public void clipRect(int x, int y, int width, int height) {
    clippedRectangle = new Box(x, y, width, height);
    clip = clippedRectangle;
}
Also used : Box(limelight.util.Box)

Example 34 with Box

use of limelight.util.Box in project limelight by slagyr.

the class MockGraphics method create.

public Graphics create(int x, int y, int width, int height) {
    MockGraphics createdGraphics = new MockGraphics();
    subGraphics.add(createdGraphics);
    createdGraphics.clip = new Box(x, y, width, height);
    return createdGraphics;
}
Also used : Box(limelight.util.Box)

Example 35 with Box

use of limelight.util.Box in project limelight by slagyr.

the class ImagePanelLayoutTest method hasConstrainedProportionsWhenHeightIsNotAuto.

@Test
public void hasConstrainedProportionsWhenHeightIsNotAuto() throws Exception {
    panel.setFilename(TestUtil.DATA_DIR + "/star.gif");
    parent.style.setHeight("100");
    parent.childConsumableBounds = new Box(0, 0, 200, 100);
    Layouts.on(parent, parent.getDefaultLayout());
    AffineTransform tranform = panel.getTransform();
    assertEquals(0.5, tranform.getScaleX(), 0.001);
    assertEquals(0.5, tranform.getScaleY(), 0.001);
}
Also used : AffineTransform(java.awt.geom.AffineTransform) Box(limelight.util.Box) Test(org.junit.Test)

Aggregations

Box (limelight.util.Box)80 Test (org.junit.Test)31 MockGraphics (limelight.ui.MockGraphics)11 Before (org.junit.Before)6 AffineTransform (java.awt.geom.AffineTransform)5 Style (limelight.styles.Style)3 TextLocation (limelight.ui.text.TextLocation)3 TypedLayout (limelight.ui.text.TypedLayout)3 BufferedImage (java.awt.image.BufferedImage)2 Panel (limelight.ui.Panel)2 TextLayout (java.awt.font.TextLayout)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 LimelightException (limelight.LimelightException)1 FlatStyle (limelight.styles.FlatStyle)1 StringValue (limelight.styles.abstrstyling.StringValue)1 AutoDimensionValue (limelight.styles.values.AutoDimensionValue)1 GreedyDimensionValue (limelight.styles.values.GreedyDimensionValue)1 BufferedImagePool (limelight.ui.BufferedImagePool)1 MockPanel (limelight.ui.MockPanel)1