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