use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testMirror.
/**
* Test the mirror.
*/
@Test
public void testMirror() {
final Sprite sprite = new SpriteImpl(Graphics.createImageBuffer(64, 32));
Assert.assertEquals(Mirror.NONE, sprite.getMirror());
sprite.setMirror(Mirror.HORIZONTAL);
Assert.assertEquals(Mirror.HORIZONTAL, sprite.getMirror());
}
use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testConstructorSurface.
/**
* Test constructor with surface.
*/
@Test
public void testConstructorSurface() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final Sprite sprite = new SpriteImpl(surface);
Assert.assertTrue(sprite.isLoaded());
Assert.assertEquals(surface, sprite.getSurface());
Assert.assertEquals(64, sprite.getWidth());
Assert.assertEquals(32, sprite.getHeight());
}
use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testSetTransparency.
/**
* Test set transparency.
*/
@Test
public void testSetTransparency() {
final Sprite sprite = new SpriteImpl(Graphics.createImageBuffer(64, 32));
sprite.setTransparency(ColorRgba.BLACK);
Assert.assertEquals(64, sprite.getWidth());
Assert.assertEquals(32, sprite.getHeight());
}
use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testSetOriginNull.
/**
* Test origin <code>null</code>.
*/
@Test(expected = LionEngineException.class)
public void testSetOriginNull() {
final Sprite sprite = new SpriteImpl(Graphics.createImageBuffer(64, 32));
sprite.setOrigin(null);
}
use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testRotate.
/**
* Test rotate sprite.
*/
@Test
public void testRotate() {
final Sprite sprite = new SpriteImpl(Graphics.createImageBuffer(64, 32));
for (int angle = -720; angle < 720; angle++) {
sprite.rotate(angle);
Assert.assertTrue(angle + Constant.SPACE + sprite.getWidth(), sprite.getWidth() >= 64);
Assert.assertTrue(angle + Constant.SPACE + sprite.getHeight(), sprite.getHeight() >= 32);
}
}
Aggregations