use of com.b3dgs.lionengine.graphic.SpriteAnimated in project lionengine by b3dgs.
the class SpriteAnimatedTest method testFilterBilinear.
/**
* Test filter bilinear.
*/
@Test
public void testFilterBilinear() {
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.filter(new FilterBilinear());
Assert.assertEquals(64, sprite.getWidth());
Assert.assertEquals(32, sprite.getHeight());
}
use of com.b3dgs.lionengine.graphic.SpriteAnimated in project lionengine by b3dgs.
the class SpriteAnimatedTest method testSetSpeed.
/**
* Test set speed.
*/
@Test
public void testSetSpeed() {
final Animation animation = new Animation(Animation.DEFAULT_NAME, 1, 3, 1.0, false, false);
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.play(animation);
sprite.setAnimSpeed(2.0);
sprite.update(1.0);
Assert.assertEquals(AnimState.PLAYING, sprite.getAnimState());
Assert.assertEquals(3, sprite.getFrame());
Assert.assertEquals(3, sprite.getFrameAnim());
}
use of com.b3dgs.lionengine.graphic.SpriteAnimated in project lionengine by b3dgs.
the class SpriteAnimatedTest method testSetSpeedNegative.
/**
* Test invalid speed setter.
*/
@Test(expected = LionEngineException.class)
public void testSetSpeedNegative() {
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.setAnimSpeed(-1.0);
}
use of com.b3dgs.lionengine.graphic.SpriteAnimated in project lionengine by b3dgs.
the class SpriteAnimatedTest method testSetAlphaLow.
/**
* Test set alpha too low.
*/
@Test(expected = LionEngineException.class)
public void testSetAlphaLow() {
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.setAlpha(-1);
}
use of com.b3dgs.lionengine.graphic.SpriteAnimated in project lionengine by b3dgs.
the class SpriteAnimatedTest method testMirror.
/**
* Test mirror.
*/
@Test
public void testMirror() {
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
Assert.assertEquals(Mirror.NONE, sprite.getMirror());
sprite.setMirror(Mirror.HORIZONTAL);
Assert.assertEquals(Mirror.HORIZONTAL, sprite.getMirror());
}
Aggregations