use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class GraphicsTest method testResize.
/**
* Test resize.
*/
@Test
public void testResize() {
final ImageBuffer resized = Graphics.resize(image, 1, 2);
Assert.assertNotEquals(image, resized);
Assert.assertEquals(1, resized.getWidth());
Assert.assertEquals(2, resized.getHeight());
resized.dispose();
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class GraphicsTest method testGetRasterBuffer.
/**
* Test save image.
*/
@Test
public void testGetRasterBuffer() {
final ImageBuffer raster = Graphics.getRasterBuffer(image, 0, 0, 0, 255, 255, 255, 5);
Assert.assertNotEquals(image, raster);
Assert.assertEquals(image.getWidth(), raster.getWidth());
Assert.assertEquals(image.getHeight(), raster.getHeight());
raster.dispose();
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class SpriteAnimatedTest method testHashCode.
/**
* Test hash code.
*/
@Test
public void testHashCode() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final int sprite = new SpriteAnimatedImpl(surface, 16, 8).hashCode();
final SpriteAnimated spriteMedia = new SpriteAnimatedImpl(media, 16, 8);
spriteMedia.load();
Assert.assertEquals(sprite, new SpriteAnimatedImpl(surface, 16, 8).hashCode());
Assert.assertNotEquals(sprite, new Object().hashCode());
Assert.assertNotEquals(spriteMedia.hashCode(), new SpriteAnimatedImpl(media, 16, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(32, 32), 16, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 64), 16, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(32, 64), 16, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 8, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 16).hashCode());
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(32, 32), 8, 8).hashCode());
Assert.assertNotEquals(sprite, new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 64), 16, 16).hashCode());
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class SpriteTest method testEquals.
/**
* Test equals.
*/
@Test
public void testEquals() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final Sprite sprite = new SpriteImpl(surface);
final Sprite spriteMedia = new SpriteImpl(media);
spriteMedia.load();
Assert.assertEquals(sprite, sprite);
Assert.assertEquals(sprite, new SpriteImpl(surface));
Assert.assertEquals(spriteMedia, spriteMedia);
Assert.assertNotEquals(sprite, null);
Assert.assertNotEquals(sprite, new Object());
Assert.assertNotEquals(sprite, new SpriteImpl(media));
Assert.assertNotEquals(spriteMedia, new SpriteImpl(media));
Assert.assertNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(64, 32)));
Assert.assertNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(32, 32)));
Assert.assertNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(64, 64)));
Assert.assertNotEquals(sprite, new SpriteImpl(Graphics.createImageBuffer(32, 64)));
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class SpriteTest method testConstructorSurface.
/**
* Test constructor with surface.
*/
@Test
public void testConstructorSurface() {
final ImageBuffer surface = Graphics.createImageBuffer(64, 32);
final Sprite sprite = new SpriteImpl(surface);
Assert.assertTrue(sprite.isLoaded());
Assert.assertEquals(surface, sprite.getSurface());
Assert.assertEquals(64, sprite.getWidth());
Assert.assertEquals(32, sprite.getHeight());
}
Aggregations