Search in sources :

Example 21 with MockGraphics

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));
}
Also used : MockGraphics(limelight.ui.MockGraphics) Test(org.junit.Test)

Example 22 with MockGraphics

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));
}
Also used : MockGraphics(limelight.ui.MockGraphics) Test(org.junit.Test)

Example 23 with MockGraphics

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();
}
Also used : MockGraphics(limelight.ui.MockGraphics) MockProp(limelight.ui.model.MockProp)

Example 24 with 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);
}
Also used : MockGraphics(limelight.ui.MockGraphics) MockProp(limelight.ui.model.MockProp) Test(org.junit.Test)

Aggregations

MockGraphics (limelight.ui.MockGraphics)24 Box (limelight.util.Box)11 Test (org.junit.Test)6 Before (org.junit.Before)5 FakePropProxy (limelight.model.api.FakePropProxy)3 MockProp (limelight.ui.model.MockProp)3 PropPanel (limelight.ui.model.PropPanel)3 FakeScene (limelight.ui.model.FakeScene)2 MockStage (limelight.ui.model.MockStage)2 ScrollBarPanel (limelight.ui.model.inputs.ScrollBarPanel)2 Pen (limelight.ui.Pen)1 MockDrawable (limelight.ui.model.MockDrawable)1 MockTextModel (limelight.ui.model.inputs.MockTextModel)1 TextBoxPanel (limelight.ui.model.inputs.TextBoxPanel)1