use of com.b3dgs.lionengine.graphic.SpriteAnimated in project lionengine by b3dgs.
the class SpriteAnimatedTest method testMirrorNull.
/**
* Test mirror <code>null</code>.
*/
@Test(expected = LionEngineException.class)
public void testMirrorNull() {
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.setMirror(null);
}
use of com.b3dgs.lionengine.graphic.SpriteAnimated in project lionengine by b3dgs.
the class SpriteAnimatedTest method testUpdateNoLoopNoReverse.
/**
* Test update without loop nor reverse.
*/
@Test
public void testUpdateNoLoopNoReverse() {
final Animation animation = new Animation(Animation.DEFAULT_NAME, 1, 2, 1.0, false, false);
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.play(animation);
Assert.assertEquals(AnimState.PLAYING, sprite.getAnimState());
Assert.assertEquals(1, sprite.getFrame());
Assert.assertEquals(1, sprite.getFrameAnim());
sprite.update(1.0);
Assert.assertEquals(AnimState.PLAYING, sprite.getAnimState());
Assert.assertEquals(2, sprite.getFrame());
Assert.assertEquals(2, sprite.getFrameAnim());
sprite.update(1.0);
Assert.assertEquals(AnimState.FINISHED, sprite.getAnimState());
Assert.assertEquals(2, sprite.getFrame());
Assert.assertEquals(2, sprite.getFrameAnim());
sprite.update(1.0);
Assert.assertEquals(AnimState.FINISHED, sprite.getAnimState());
Assert.assertEquals(2, sprite.getFrame());
Assert.assertEquals(2, sprite.getFrameAnim());
}
use of com.b3dgs.lionengine.graphic.SpriteAnimated in project lionengine by b3dgs.
the class SpriteAnimatedTest method testConstructorMedia.
/**
* Test constructor with media.
*/
@Test
public void testConstructorMedia() {
final SpriteAnimated sprite = new SpriteAnimatedImpl(media, 16, 8);
Assert.assertFalse(sprite.isLoaded());
Assert.assertNull(sprite.getSurface());
Assert.assertEquals(64, sprite.getWidth());
Assert.assertEquals(32, sprite.getHeight());
Assert.assertEquals(4, sprite.getTileWidth());
Assert.assertEquals(4, sprite.getTileHeight());
Assert.assertEquals(16, sprite.getFramesHorizontal());
Assert.assertEquals(8, sprite.getFramesVertical());
}
Aggregations