Search in sources :

Example 61 with Box

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

the class ImagePanelLayoutTest method getScalleTransformWhenDimensionsAreNotAutoAndScalingIsOff.

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

Example 62 with Box

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

the class ImagePanelLayoutTest method hasConstrainedProportionsWhenWidthIsNotAuto.

@Test
public void hasConstrainedProportionsWhenWidthIsNotAuto() throws Exception {
    panel.setFilename(TestUtil.DATA_DIR + "/star.gif");
    parent.style.setWidth("100");
    parent.childConsumableBounds = new Box(0, 0, 100, 200);
    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)

Example 63 with Box

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

the class ImagePanelLayoutTest method sizeRemainsWhenStaticAndNotScaled.

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

Example 64 with Box

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

the class ImagePanelLayoutTest method getScaleTransformWhenDimensionsAreNotAuto.

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

Example 65 with Box

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

the class PropPanelTest method rectanglesAreCached.

@Test
public void rectanglesAreCached() throws Exception {
    Box rectangle = panel.getBounds();
    Box insideMargins = panel.getMarginedBounds();
    Box insideBorders = panel.getBorderedBounds();
    Box insidePadding = panel.getPaddedBounds();
    assertSame(rectangle, panel.getBounds());
    assertSame(insideMargins, panel.getMarginedBounds());
    assertSame(insideBorders, panel.getBorderedBounds());
    assertSame(insidePadding, panel.getPaddedBounds());
    panel.setSize(123, 456);
    assertNotSame(rectangle, panel.getBounds());
    assertNotSame(insideMargins, panel.getMarginedBounds());
    assertNotSame(insideBorders, panel.getBorderedBounds());
    assertNotSame(insidePadding, panel.getPaddedBounds());
}
Also used : 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