use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class SpriteTiledTest method testConstructorSurface.
/**
* Test constructor with surface.
*/
@Test
void testConstructorSurface() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final SpriteTiled sprite = new SpriteTiledImpl(surface, 16, 8);
assertTrue(sprite.isLoaded());
assertEquals(surface, sprite.getSurface());
assertEquals(64, sprite.getWidth());
assertEquals(32, sprite.getHeight());
assertEquals(16, sprite.getTileWidth());
assertEquals(8, sprite.getTileHeight());
assertEquals(4, sprite.getTilesHorizontal());
assertEquals(4, sprite.getTilesVertical());
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class SpriteAnimatedTest method testConstructorSurface.
/**
* Test constructor with surface.
*/
@Test
void testConstructorSurface() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final SpriteAnimated sprite = new SpriteAnimatedImpl(surface, 16, 8);
assertTrue(sprite.isLoaded());
assertEquals(surface, sprite.getSurface());
assertEquals(64, sprite.getWidth());
assertEquals(32, sprite.getHeight());
assertEquals(4, sprite.getTileWidth());
assertEquals(4, sprite.getTileHeight());
assertEquals(16, sprite.getFramesHorizontal());
assertEquals(8, sprite.getFramesVertical());
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class SpriteTest method testConstructorSurface.
/**
* Test constructor with surface.
*/
@Test
void testConstructorSurface() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final Sprite sprite = new SpriteImpl(surface);
assertTrue(sprite.isLoaded());
assertEquals(surface, sprite.getSurface());
assertEquals(64, sprite.getWidth());
assertEquals(32, sprite.getHeight());
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class SpriteTest method testHashCode.
/**
* Test hash code.
*/
@Test
void testHashCode() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final Sprite sprite = new SpriteImpl(surface);
final Media media = Medias.create("image.png");
final Sprite spriteMedia = new SpriteImpl(media);
spriteMedia.load();
assertHashEquals(sprite, new SpriteImpl(surface));
assertHashNotEquals(sprite, new Object());
assertHashNotEquals(spriteMedia, new SpriteImpl(media));
assertHashNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(64, 32)));
assertHashNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(32, 32)));
assertHashNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(64, 64)));
assertHashNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(32, 64)));
sprite.dispose();
spriteMedia.dispose();
surface.dispose();
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class ImageTest method testHashCode.
/**
* Test hash code.
*/
@Test
void testHashCode() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final Image image = new ImageImpl(surface);
final Image imageMedia = new ImageImpl(media);
imageMedia.load();
assertHashEquals(image, new ImageImpl(surface));
assertHashNotEquals(image, new Object());
assertHashNotEquals(imageMedia, new ImageImpl(media));
assertHashNotEquals(image, new ImageImpl(Graphics.createImageBuffer(64, 32)));
assertHashNotEquals(image, new ImageImpl(Graphics.createImageBuffer(32, 32)));
assertHashNotEquals(image, new ImageImpl(Graphics.createImageBuffer(64, 64)));
assertHashNotEquals(image, new ImageImpl(Graphics.createImageBuffer(32, 64)));
image.dispose();
imageMedia.dispose();
surface.dispose();
}
Aggregations