use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testLoadMedia.
/**
* Test load with media.
*/
@Test
public void testLoadMedia() {
final Sprite sprite = new SpriteImpl(media);
sprite.load();
Assert.assertNotNull(sprite.getSurface());
sprite.prepare();
sprite.dispose();
}
use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testSetAlphaHigh.
/**
* Test set alpha too high.
*/
@Test(expected = LionEngineException.class)
public void testSetAlphaHigh() {
final Sprite sprite = new SpriteImpl(Graphics.createImageBuffer(64, 32));
sprite.setAlpha(256);
}
use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testHashCode.
/**
* Test hash code.
*/
@Test
public void testHashCode() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final int sprite = new SpriteImpl(surface).hashCode();
final Sprite spriteMedia = new SpriteImpl(media);
spriteMedia.load();
Assert.assertEquals(sprite, new SpriteImpl(surface).hashCode());
Assert.assertNotEquals(sprite, new Object().hashCode());
Assert.assertNotEquals(spriteMedia.hashCode(), new SpriteImpl(media).hashCode());
Assert.assertNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(64, 32)).hashCode());
Assert.assertNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(32, 32)).hashCode());
Assert.assertNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(64, 64)).hashCode());
Assert.assertNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(32, 64)).hashCode());
}
use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testStretchInvalidHeight.
/**
* Test stretch sprite with invalid height.
*/
@Test(expected = LionEngineException.class)
public void testStretchInvalidHeight() {
final Sprite sprite = new SpriteImpl(Graphics.createImageBuffer(64, 32));
sprite.stretch(100, 0.0);
}
use of com.b3dgs.lionengine.graphic.Sprite in project lionengine by b3dgs.
the class SpriteTest method testFilterNull.
/**
* Test filter <code>null</code>.
*/
@Test(expected = LionEngineException.class)
public void testFilterNull() {
final Sprite sprite = new SpriteImpl(Graphics.createImageBuffer(64, 32));
sprite.filter(null);
}
Aggregations