Search in sources :

Example 56 with Box

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

the class TextPanelSelectionPainterTest method willFillABoxAroundSelectedText.

@Test
public void willFillABoxAroundSelectedText() {
    painter.paint(graphics, model);
    assertEquals(new Box(40, 0, 20, 10), graphics.filledShapes.get(0).shape);
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 57 with Box

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

the class TextPanelTextPainterTest method setUp.

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

Example 58 with Box

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

the class MultiLineTextModelTest method shouldGiveCaretShapeWithCenteredText.

@Test
public void shouldGiveCaretShapeWithCenteredText() throws Exception {
    container.getStyle().setHorizontalAlignment("center");
    model.setText("1 line\nand\nanother line\n.");
    model.setCaretLocation(TextLocation.at(0, 0));
    assertEquals(new Box(45, 0, 1, 10), model.getCaretShape());
    model.setCaretLocation(TextLocation.at(1, 0));
    assertEquals(new Box(60, 11, 1, 10), model.getCaretShape());
    model.setCaretLocation(TextLocation.at(2, 0));
    assertEquals(new Box(15, 22, 1, 10), model.getCaretShape());
    model.setCaretLocation(TextLocation.at(3, 0));
    assertEquals(new Box(70, 33, 1, 10), model.getCaretShape());
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 59 with Box

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

the class MultiLineTextModelTest method shouldGetCaretShape.

@Test
public void shouldGetCaretShape() throws Exception {
    model.setText("line 1\n line 2\n line 3");
    model.setCaretLocation(TextLocation.at(0, 3));
    assertEquals(new Box(30, 0, 1, 10), model.getCaretShape());
    model.setCaretLocation(TextLocation.at(1, 3));
    assertEquals(new Box(30, 11, 1, 10), model.getCaretShape());
    model.setCaretLocation(TextLocation.at(2, 3));
    assertEquals(new Box(30, 22, 1, 10), model.getCaretShape());
}
Also used : Box(limelight.util.Box) Test(org.junit.Test)

Example 60 with Box

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

the class TextModelTest 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 SingleLineTextModel(container);
    model.setTypedLayoutFactory(MockTypedLayoutFactory.instance);
    model.setText("Bob Dole likes to hear Bob Dole say 'Bob Dole'  ");
}
Also used : Box(limelight.util.Box) Before(org.junit.Before)

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