use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testConstructorMedia.
/**
* Test constructor with media.
*/
@Test
public void testConstructorMedia() {
final Sprite sprite = new SpriteImpl(media);
Assert.assertFalse(sprite.isLoaded());
Assert.assertNull(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 testEquals.
/**
* Test equals.
*/
@Test
public void testEquals() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final Sprite sprite = new SpriteImpl(surface);
final Sprite spriteMedia = new SpriteImpl(media);
spriteMedia.load();
Assert.assertEquals(sprite, sprite);
Assert.assertEquals(sprite, new SpriteImpl(surface));
Assert.assertEquals(spriteMedia, spriteMedia);
Assert.assertNotEquals(sprite, null);
Assert.assertNotEquals(sprite, new Object());
Assert.assertNotEquals(sprite, new SpriteImpl(media));
Assert.assertNotEquals(spriteMedia, new SpriteImpl(media));
Assert.assertNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(64, 32)));
Assert.assertNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(32, 32)));
Assert.assertNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(64, 64)));
Assert.assertNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(32, 64)));
}
use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testSetFade.
/**
* Test set fade.
*/
@Test
public void testSetFade() {
final Sprite sprite = new SpriteImpl(Graphics.createImageBuffer(64, 32));
sprite.setFade(128, 128);
sprite.setFade(128, 128);
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 testStretchInvalidWidth.
/**
* Test stretch sprite with invalid width.
*/
@Test(expected = LionEngineException.class)
public void testStretchInvalidWidth() {
final Sprite sprite = new SpriteImpl(Graphics.createImageBuffer(64, 32));
sprite.stretch(0.0, 100.0);
}
use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testFilterBilinear.
/**
* Test filter bilinear.
*/
@Test
public void testFilterBilinear() {
final Sprite sprite = new SpriteImpl(Graphics.createImageBuffer(64, 32));
sprite.filter(new FilterBilinear());
Assert.assertEquals(64, sprite.getWidth());
Assert.assertEquals(32, sprite.getHeight());
}
Aggregations