use of limelight.ui.MockGraphics in project limelight by slagyr.
the class NinePatchTest method itDrawsAnImageOfTheSameSize.
@Test
public void itDrawsAnImageOfTheSameSize() throws Exception {
NinePatch patch = NinePatch.load(image);
MockGraphics graphics = new MockGraphics();
patch.draw(graphics, 0, 0, 15, 41);
assertEquals(9, graphics.drawnImages.size());
// top left
checkDrawnImage(graphics.drawnImages.get(0), new Rectangle(1, 1, 3, 11), new Rectangle(0, 0, 3, 11));
// top middle
checkDrawnImage(graphics.drawnImages.get(1), new Rectangle(4, 1, 5, 11), new Rectangle(3, 0, 5, 11));
// top right
checkDrawnImage(graphics.drawnImages.get(2), new Rectangle(9, 1, 7, 11), new Rectangle(8, 0, 7, 11));
// middle left
checkDrawnImage(graphics.drawnImages.get(3), new Rectangle(1, 12, 3, 13), new Rectangle(0, 11, 3, 13));
// middle middle
checkDrawnImage(graphics.drawnImages.get(4), new Rectangle(4, 12, 5, 13), new Rectangle(3, 11, 5, 13));
// middle right
checkDrawnImage(graphics.drawnImages.get(5), new Rectangle(9, 12, 7, 13), new Rectangle(8, 11, 7, 13));
// bottom left
checkDrawnImage(graphics.drawnImages.get(6), new Rectangle(1, 25, 3, 17), new Rectangle(0, 24, 3, 17));
// bottom middle
checkDrawnImage(graphics.drawnImages.get(7), new Rectangle(4, 25, 5, 17), new Rectangle(3, 24, 5, 17));
// bottom right
checkDrawnImage(graphics.drawnImages.get(8), new Rectangle(9, 25, 7, 17), new Rectangle(8, 24, 7, 17));
}
use of limelight.ui.MockGraphics in project limelight by slagyr.
the class NinePatchTest method itDrawsAnImageMinimalSize.
@Test
public void itDrawsAnImageMinimalSize() throws Exception {
NinePatch patch = NinePatch.load(image);
MockGraphics graphics = new MockGraphics();
patch.draw(graphics, 0, 0, 10, 28);
assertEquals(4, graphics.drawnImages.size());
// top left
checkDrawnImage(graphics.drawnImages.get(0), new Rectangle(1, 1, 3, 11), new Rectangle(0, 0, 3, 11));
// top right
checkDrawnImage(graphics.drawnImages.get(1), new Rectangle(9, 1, 7, 11), new Rectangle(3, 0, 7, 11));
// bottom left
checkDrawnImage(graphics.drawnImages.get(2), new Rectangle(1, 25, 3, 17), new Rectangle(0, 11, 3, 17));
// bottom right
checkDrawnImage(graphics.drawnImages.get(3), new Rectangle(9, 25, 7, 17), new Rectangle(3, 11, 7, 17));
}
use of limelight.ui.MockGraphics in project limelight by slagyr.
the class BackgroundPainterTest method setUp.
public void setUp() throws Exception {
panel = new MockProp();
style = panel.getStyle();
painter = BackgroundPainter.instance;
graphics = new MockGraphics();
}
use of limelight.ui.MockGraphics in project limelight by slagyr.
the class DefaultPainterTest method shouldPaint.
@Test
public void shouldPaint() throws Exception {
MockPainter mockBackgroundPainter = new MockPainter();
BackgroundPainter.instance = mockBackgroundPainter;
MockPainter mockBorderPainter = new MockPainter();
BorderPainter.instance = mockBorderPainter;
MockProp panel = new MockProp();
MockGraphics graphics = new MockGraphics();
DefaultPainter.instance.paint(graphics, panel);
assertEquals(true, mockBackgroundPainter.painted);
assertEquals(true, mockBorderPainter.painted);
}
Aggregations