Search in sources :

Example 76 with Box

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

the class FittingXOffsetStrategyTest method setUp.

@Before
public void setUp() throws Exception {
    assumeTrue(TestUtil.notHeadless());
    strategy = XOffsetStrategy.FITTING;
    container = new limelight.ui.model.text.MockTextContainer();
    container.bounds = new Box(0, 0, 100, 50);
    model = new limelight.ui.model.text.SingleLineTextModel(container);
    model.setTypedLayoutFactory(MockTypedLayoutFactory.instance);
    model.setText("0123456789012345678901234567890");
}
Also used : Box(limelight.util.Box) Before(org.junit.Before)

Example 77 with Box

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

the class FittingYOffsetStrategyTest method shouldNotGoNutsWhenTextIsBiggetThanHeight.

@Test
public void shouldNotGoNutsWhenTextIsBiggetThanHeight() throws Exception {
    textContainer.bounds = new Box(0, 0, 100, 6);
    model.setText("blah");
    model.setCaretLocation(TextLocation.at(0, 2));
    model.setOffset(0, 0);
    assertEquals(-2, YOffsetStrategy.FITTING.calculateYOffset(model));
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 78 with Box

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

the class BorderPainterTest method testGetLinesFromBorderWithEven.

public void testGetLinesFromBorderWithEven() throws Exception {
    border = new Box(0, 0, 100, 200);
    panel.boxInsideMargins = border;
    style.setBorderWidth("4");
    style.setBorderColor("blue");
    painter.paint(graphics, panel);
    checkLine(graphics.drawnShapes.get(0), 4, Color.blue, 2, 2, 98, 2);
    checkLine(graphics.drawnShapes.get(1), 4, Color.blue, 98, 2, 98, 198);
    checkLine(graphics.drawnShapes.get(2), 4, Color.blue, 98, 198, 2, 198);
    checkLine(graphics.drawnShapes.get(3), 4, Color.blue, 2, 198, 2, 2);
}
Also used : Box(limelight.util.Box)

Example 79 with Box

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

the class BorderPainterTest method testGetLinesFromBorderWithOdd.

public void testGetLinesFromBorderWithOdd() throws Exception {
    border = new Box(0, 0, 100, 200);
    panel.boxInsideMargins = border;
    style.setBorderWidth("5");
    style.setBorderColor("blue");
    painter.paint(graphics, panel);
    checkLine(graphics.drawnShapes.get(0), 5, Color.blue, 2, 2, 97, 2);
    checkLine(graphics.drawnShapes.get(1), 5, Color.blue, 97, 2, 97, 197);
    checkLine(graphics.drawnShapes.get(2), 5, Color.blue, 97, 197, 2, 197);
    checkLine(graphics.drawnShapes.get(3), 5, Color.blue, 2, 197, 2, 2);
}
Also used : Box(limelight.util.Box)

Example 80 with Box

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

the class BorderTest method testGetLinesFromBorderWithOnePixelWidthAllAroundAndSomeMargin.

public void testGetLinesFromBorderWithOnePixelWidthAllAroundAndSomeMargin() throws Exception {
    style.setBorderWidth("1");
    insideMargin = new Box(20, 30, 100, 200);
    border = new Border(style, insideMargin);
    int right = insideMargin.width - 1 + 20;
    int bottom = insideMargin.height - 1 + 30;
    verifyLine(border.getTopLine(), 20, 30, right, 30);
    verifyLine(border.getRightLine(), right, 30, right, bottom);
    verifyLine(border.getBottomLine(), right, bottom, 20, bottom);
    verifyLine(border.getLeftLine(), 20, bottom, 20, 30);
}
Also used : Box(limelight.util.Box)

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