Search in sources :

Example 26 with Box

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

the class ScaleXFillStrategyValueTest method setUp.

public void setUp() throws Exception {
    attribute = new ScaleXFillStrategyValue();
    graphics = new MockGraphics();
    clip = new Box(0, 0, 60, 60);
    graphics.clip = clip;
}
Also used : MockGraphics(limelight.ui.MockGraphics) Box(limelight.util.Box)

Example 27 with Box

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

the class SimpleHorizontalAlignmentValueTest method testStartingX.

public void testStartingX() throws Exception {
    Box area = new Box(0, 0, 100, 100);
    assertEquals(0, left.getX(100, area));
    assertEquals(0, left.getX(1, area));
    assertEquals(0, center.getX(100, area));
    assertEquals(25, center.getX(50, area));
    assertEquals(37, center.getX(25, area));
    assertEquals(49, center.getX(1, area));
    assertEquals(0, right.getX(100, area));
    assertEquals(50, right.getX(50, area));
    assertEquals(99, right.getX(1, area));
}
Also used : Box(limelight.util.Box)

Example 28 with Box

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

the class PaintJobTest method testCreation.

public void testCreation() throws Exception {
    Box clip = new Box(1, 2, 3, 4);
    PaintJob job = new PaintJob(clip, Colors.TRANSPARENT);
    assertSame(clip, job.getClip());
    BufferedImage buffer = job.getBuffer();
    assertEquals(3, buffer.getWidth());
    assertEquals(4, buffer.getHeight());
    Graphics2D graphics = job.getGraphics();
    assertNotNull(graphics);
    assertEquals(Colors.TRANSPARENT, graphics.getBackground());
}
Also used : Box(limelight.util.Box) BufferedImage(java.awt.image.BufferedImage)

Example 29 with Box

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

the class PanelBaseTest method getBounds.

@Test
public void getBounds() throws Exception {
    Box bounds = panel.getBounds();
    assertEquals(panel.getX(), bounds.x);
    assertEquals(panel.getY(), bounds.y);
    assertEquals(panel.getWidth(), bounds.width);
    assertEquals(panel.getHeight(), bounds.height);
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 30 with Box

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

the class ParentPanelTest method shouldAbsoluteBoundsChangesWhenLocationChanges.

@Test
public void shouldAbsoluteBoundsChangesWhenLocationChanges() throws Exception {
    Box bounds = panel.getAbsoluteBounds();
    panel.setLocation(123, 456);
    assertNotSame(bounds, panel.getAbsoluteBounds());
    assertEquals(123, panel.getAbsoluteBounds().x);
    assertEquals(456, panel.getAbsoluteBounds().y);
}
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