use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class SpriteTiledTest method testConstructorSurface.
/**
* Test constructor with surface.
*/
@Test
public void testConstructorSurface() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final SpriteTiled sprite = new SpriteTiledImpl(surface, 16, 8);
Assert.assertTrue(sprite.isLoaded());
Assert.assertEquals(surface, sprite.getSurface());
Assert.assertEquals(64, sprite.getWidth());
Assert.assertEquals(32, sprite.getHeight());
Assert.assertEquals(16, sprite.getTileWidth());
Assert.assertEquals(8, sprite.getTileHeight());
Assert.assertEquals(4, sprite.getTilesHorizontal());
Assert.assertEquals(4, sprite.getTilesVertical());
}
use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class SpriteTiledTest method testSetTileInvalid.
/**
* Set set tile with invalid value.
*/
@Test(expected = LionEngineException.class)
public void testSetTileInvalid() {
final SpriteTiled sprite = new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.setTile(-1);
}
use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class SpriteTiledTest method testFilterNull.
/**
* Test filter.
*/
@Test(expected = LionEngineException.class)
public void testFilterNull() {
final SpriteTiled sprite = new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.filter(null);
}
use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class SpriteTiledTest method testSetTransparency.
/**
* Test set transparency.
*/
@Test
public void testSetTransparency() {
final SpriteTiled sprite = new SpriteTiledImpl(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.SpriteTiled in project lionengine by b3dgs.
the class SpriteTiledTest method testHashCode.
/**
* Test hash code.
*/
@Test
public void testHashCode() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final int sprite = new SpriteTiledImpl(surface, 16, 8).hashCode();
final SpriteTiled spriteMedia = new SpriteTiledImpl(media, 16, 8);
spriteMedia.load();
Assert.assertEquals(sprite, new SpriteTiledImpl(surface, 16, 8).hashCode());
Assert.assertNotEquals(sprite, new Object().hashCode());
Assert.assertNotEquals(spriteMedia.hashCode(), new SpriteTiledImpl(media, 16, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 16, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(32, 32), 16, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(64, 64), 16, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(32, 64), 16, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 8, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 16, 16).hashCode());
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(32, 32), 8, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteTiledImpl(Graphics.createImageBuffer(64, 64), 16, 16).hashCode());
}
Aggregations