use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class ImageTest method testRender.
/**
* Test the render.
*/
@Test
void testRender() {
final Graphic g = Graphics.createImageBuffer(100, 100).createGraphic();
final Image image = new ImageImpl(Graphics.createImageBuffer(64, 32));
image.render(g);
g.dispose();
}
use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class SpriteAnimatedTest method testRender.
/**
* Test render.
*/
@Test
void testRender() {
final Graphic g = Graphics.createImageBuffer(100, 100).createGraphic();
try {
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.render(g);
sprite.setFrame(1);
sprite.setMirror(Mirror.HORIZONTAL);
sprite.render(g);
sprite.setMirror(Mirror.VERTICAL);
sprite.render(g);
} finally {
g.dispose();
}
}
use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class CursorTest method testRenderNoSurface.
/**
* Test render no surface
*/
@Test
void testRenderNoSurface() {
final Graphic g = Graphics.createGraphic();
final Cursor cursor = new Cursor(services);
cursor.setVisible(false);
cursor.render(g);
cursor.setVisible(true);
assertThrowsNpe(() -> cursor.render(g));
}
use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class CursorTest method testRender.
/**
* Test render
*/
@Test
void testRender() {
final Cursor cursor = new Cursor(services);
cursor.addImage(0, Medias.create("cursor.png"));
cursor.load();
final Graphic g = Graphics.createGraphic();
cursor.render(g);
}
use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class TextGameTest method testSize.
/**
* Test size.
*/
@Test
void testSize() {
final Graphic g = new GraphicMock();
final TextGame text = new TextGame(Constant.FONT_DIALOG, 8, TextStyle.NORMAL);
assertEquals(8, text.getSize());
assertEquals(0, text.getWidth());
assertEquals(0, text.getHeight());
assertEquals(0, text.getStringWidth(g, "text"));
assertEquals(0, text.getStringHeight(g, "text"));
g.dispose();
}
Aggregations