Search in sources :

Example 21 with SpriteAnimated

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();
}
Also used : SpriteAnimated(com.b3dgs.lionengine.graphic.SpriteAnimated) Test(org.junit.Test)

Example 22 with SpriteAnimated

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());
}
Also used : SpriteAnimated(com.b3dgs.lionengine.graphic.SpriteAnimated) Test(org.junit.Test)

Example 23 with SpriteAnimated

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);
}
Also used : SpriteAnimated(com.b3dgs.lionengine.graphic.SpriteAnimated) Test(org.junit.Test)

Example 24 with SpriteAnimated

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));
}
Also used : ImageBuffer(com.b3dgs.lionengine.graphic.ImageBuffer) SpriteAnimated(com.b3dgs.lionengine.graphic.SpriteAnimated) Test(org.junit.Test)

Example 25 with SpriteAnimated

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);
}
Also used : SpriteAnimated(com.b3dgs.lionengine.graphic.SpriteAnimated) Test(org.junit.Test)

Aggregations

SpriteAnimated (com.b3dgs.lionengine.graphic.SpriteAnimated)33 Test (org.junit.Test)33 Animation (com.b3dgs.lionengine.Animation)6 ImageBuffer (com.b3dgs.lionengine.graphic.ImageBuffer)3 Media (com.b3dgs.lionengine.Media)1 FilterBilinear (com.b3dgs.lionengine.core.filter.FilterBilinear)1 Graphic (com.b3dgs.lionengine.graphic.Graphic)1