use of com.b3dgs.lionengine.graphic.SpriteAnimated in project lionengine by b3dgs.
the class SpriteAnimatedTest method testLoadSurface.
/**
* Test load with surface.
*/
@Test(expected = LionEngineException.class)
public void testLoadSurface() {
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.load();
}
use of com.b3dgs.lionengine.graphic.SpriteAnimated in project lionengine by b3dgs.
the class SpriteAnimatedTest method testSetTransparency.
/**
* Test set transparency.
*/
@Test
public void testSetTransparency() {
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.setTransparency(ColorRgba.BLACK);
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 testStretchInvalidHeight.
/**
* Test stretch sprite with invalid height.
*/
@Test(expected = LionEngineException.class)
public void testStretchInvalidHeight() {
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.stretch(100, 0.0);
}
use of com.b3dgs.lionengine.graphic.SpriteAnimated in project lionengine by b3dgs.
the class SpriteAnimatedTest method testEquals.
/**
* Test equals.
*/
@Test
public void testEquals() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final SpriteAnimated sprite = new SpriteAnimatedImpl(surface, 16, 8);
final SpriteAnimated spriteMedia = new SpriteAnimatedImpl(media, 16, 8);
spriteMedia.load();
Assert.assertEquals(sprite, sprite);
Assert.assertEquals(sprite, new SpriteAnimatedImpl(surface, 16, 8));
Assert.assertEquals(spriteMedia, spriteMedia);
Assert.assertNotEquals(sprite, null);
Assert.assertNotEquals(sprite, new Object());
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(media, 16, 8));
Assert.assertNotEquals(spriteMedia, new SpriteAnimatedImpl(media, 16, 8));
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(surface, 16, 16));
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8));
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(32, 32), 16, 8));
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 64), 16, 8));
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(32, 64), 16, 8));
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 8, 8));
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 16));
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(32, 32), 8, 8));
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 64), 16, 16));
}
use of com.b3dgs.lionengine.graphic.SpriteAnimated in project lionengine by b3dgs.
the class SpriteAnimatedTest method testSetTileInvalid.
/**
* Set set frame with invalid value.
*/
@Test(expected = LionEngineException.class)
public void testSetTileInvalid() {
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.setFrame(-1);
}
Aggregations