Search in sources :

Example 51 with Box

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

the class ScrollBarPainterTest method shouldBuildDecreaseBoxForVertical.

@Test
public void shouldBuildDecreaseBoxForVertical() throws Exception {
    setUpVertically();
    scrollBar.setSize(15, 100);
    Box increasing = painter.getDecreasingBox(scrollBar);
    assertEquals(new Box(0, 67, 15, 16), increasing);
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 52 with Box

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

the class ScrollBarPainterTest method buildsTrackBoxVertically.

@Test
public void buildsTrackBoxVertically() throws Exception {
    setUpVertically();
    scrollBar.setSize(15, 100);
    Box track = painter.getTrackBox(scrollBar);
    assertEquals(new Box(0, 5, 15, 62), track);
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 53 with Box

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

the class ScrollBarPainterTest method shouldBuildDecreaseBoxForHorizontal.

@Test
public void shouldBuildDecreaseBoxForHorizontal() throws Exception {
    setUpHorizontally();
    scrollBar.setSize(100, 15);
    Box increasing = painter.getDecreasingBox(scrollBar);
    assertEquals(new Box(67, 0, 17, 15), increasing);
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 54 with Box

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

the class TextPanelCaretPainterTest method setUp.

@Before
public void setUp() {
    assumeTrue(TestUtil.notHeadless());
    container = new limelight.ui.model.text.MockTextContainer();
    container.bounds = new Box(0, 0, 150, 20);
    model = new MockTextModel(container);
    model.setText("Some Text");
    model.setCaretLocation(TextLocation.at(0, 4));
    graphics = new MockGraphics();
    container.cursorOn = true;
    painter = TextPanelCaretPainter.instance;
}
Also used : MockGraphics(limelight.ui.MockGraphics) Box(limelight.util.Box) MockTextModel(limelight.ui.model.inputs.MockTextModel) Before(org.junit.Before)

Example 55 with Box

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

the class TextPanelSelectionPainterTest method willFillMultipleBoxesForMultiLinedSelectedText.

@Test
public void willFillMultipleBoxesForMultiLinedSelectedText() {
    container = new limelight.ui.model.text.MockTextContainer();
    container.bounds = new Box(0, 0, 150, 30);
    model = new limelight.ui.model.text.MultiLineTextModel(container);
    model.setTypedLayoutFactory(MockTypedLayoutFactory.instance);
    model.setText("This is some\nMulti lined text");
    model.startSelection(TextLocation.at(0, 2));
    model.setCaretLocation(TextLocation.at(1, 5));
    painter.paint(graphics, model);
    assertEquals(new Box(20, 0, 130, 10), graphics.filledShapes.get(0).shape);
    assertEquals(new Box(0, 11, 50, 10), graphics.filledShapes.get(1).shape);
}
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