use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class SpriteTiledTest method testStretchInvalidWidth.
/**
* Test stretch sprite with invalid width.
*/
@Test(expected = LionEngineException.class)
public void testStretchInvalidWidth() {
final SpriteTiled sprite = new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.stretch(0.0, 100.0);
}
use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class SpriteTiledTest method testSetAlphaLow.
/**
* Test set alpha too low.
*/
@Test(expected = LionEngineException.class)
public void testSetAlphaLow() {
final SpriteTiled sprite = new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.setAlpha(-1);
}
use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class SpriteTiledTest method testSetAlpha.
/**
* Test set alpha.
*/
@Test
public void testSetAlpha() {
final SpriteTiled sprite = new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 16, 8);
for (int alpha = 0; alpha < 256; alpha++) {
sprite.setAlpha(alpha);
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 testLoadMediaAlready.
/**
* Test load with media already loaded.
*/
@Test(expected = LionEngineException.class)
public void testLoadMediaAlready() {
final SpriteTiled sprite = new SpriteTiledImpl(media, 16, 8);
sprite.load();
sprite.load();
}
use of com.b3dgs.lionengine.graphic.SpriteTiled in project lionengine by b3dgs.
the class SpriteTiledTest method testStretch.
/**
* Test stretch sprite.
*/
@Test
public void testStretch() {
final SpriteTiled sprite = new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.stretch(100.0, 100.0);
Assert.assertEquals(64, sprite.getWidth());
Assert.assertEquals(32, sprite.getHeight());
Assert.assertEquals(16, sprite.getTileWidth());
Assert.assertEquals(8, sprite.getTileHeight());
sprite.stretch(200.0, 100.0);
Assert.assertEquals(128, sprite.getWidth());
Assert.assertEquals(32, sprite.getHeight());
Assert.assertEquals(32, sprite.getTileWidth());
Assert.assertEquals(8, sprite.getTileHeight());
sprite.stretch(100.0, 200.0);
Assert.assertEquals(128, sprite.getWidth());
Assert.assertEquals(64, sprite.getHeight());
Assert.assertEquals(32, sprite.getTileWidth());
Assert.assertEquals(16, sprite.getTileHeight());
sprite.stretch(200.0, 200.0);
Assert.assertEquals(256, sprite.getWidth());
Assert.assertEquals(128, sprite.getHeight());
Assert.assertEquals(64, sprite.getTileWidth());
Assert.assertEquals(32, sprite.getTileHeight());
}
Aggregations