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);
}
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;
}
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());
}
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());
}
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' ");
}
Aggregations