use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class ImageTest method testConstructorSurface.
/**
* Test constructor with surface.
*/
@Test
public void testConstructorSurface() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final Image image = new ImageImpl(surface);
Assert.assertTrue(image.isLoaded());
Assert.assertEquals(surface, image.getSurface());
Assert.assertEquals(64, image.getWidth());
Assert.assertEquals(32, image.getHeight());
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class ImageTest method testEquals.
/**
* Test equals.
*/
@Test
public void testEquals() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final Image image = new ImageImpl(surface);
final Image imageMedia = new ImageImpl(media);
imageMedia.load();
Assert.assertEquals(image, image);
Assert.assertEquals(image, new ImageImpl(surface));
Assert.assertEquals(imageMedia, imageMedia);
Assert.assertNotEquals(image, null);
Assert.assertNotEquals(image, new Object());
Assert.assertNotEquals(image, new ImageImpl(media));
Assert.assertNotEquals(imageMedia, new ImageImpl(media));
Assert.assertNotEquals(image, new ImageImpl(Graphics.createImageBuffer(64, 32)));
Assert.assertNotEquals(image, new ImageImpl(Graphics.createImageBuffer(32, 32)));
Assert.assertNotEquals(image, new ImageImpl(Graphics.createImageBuffer(64, 64)));
Assert.assertNotEquals(image, new ImageImpl(Graphics.createImageBuffer(32, 64)));
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class ImageTest method testHashCode.
/**
* Test hash code.
*/
@Test
public void testHashCode() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final int image = new ImageImpl(surface).hashCode();
final Image imageMedia = new ImageImpl(media);
imageMedia.load();
Assert.assertEquals(image, new ImageImpl(surface).hashCode());
Assert.assertNotEquals(image, new Object().hashCode());
Assert.assertNotEquals(imageMedia.hashCode(), new ImageImpl(media).hashCode());
Assert.assertNotEquals(image, new ImageImpl(Graphics.createImageBuffer(64, 32)).hashCode());
Assert.assertNotEquals(image, new ImageImpl(Graphics.createImageBuffer(32, 32)).hashCode());
Assert.assertNotEquals(image, new ImageImpl(Graphics.createImageBuffer(64, 64)).hashCode());
Assert.assertNotEquals(image, new ImageImpl(Graphics.createImageBuffer(32, 64)).hashCode());
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class SpriteAnimatedTest method testConstructorSurface.
/**
* Test constructor with surface.
*/
@Test
public void testConstructorSurface() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final SpriteAnimated sprite = new SpriteAnimatedImpl(surface, 16, 8);
Assert.assertTrue(sprite.isLoaded());
Assert.assertEquals(surface, sprite.getSurface());
Assert.assertEquals(64, sprite.getWidth());
Assert.assertEquals(32, sprite.getHeight());
Assert.assertEquals(4, sprite.getTileWidth());
Assert.assertEquals(4, sprite.getTileHeight());
Assert.assertEquals(16, sprite.getFramesHorizontal());
Assert.assertEquals(8, sprite.getFramesVertical());
}
use of com.b3dgs.lionengine.graphic.ImageBuffer 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));
}
Aggregations