use of com.b3dgs.lionengine.graphic.Image in project lionengine by b3dgs.
the class ImageTest method testLoadMediaAlready.
/**
* Test load with media already loaded.
*/
@Test(expected = LionEngineException.class)
public void testLoadMediaAlready() {
final Image image = new ImageImpl(media);
image.load();
image.load();
}
use of com.b3dgs.lionengine.graphic.Image 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.Image in project lionengine by b3dgs.
the class ImageTest method testConstructorMedia.
/**
* Test constructor with media.
*/
@Test
public void testConstructorMedia() {
final Image image = new ImageImpl(media);
Assert.assertFalse(image.isLoaded());
Assert.assertNull(image.getSurface());
Assert.assertEquals(64, image.getWidth());
Assert.assertEquals(32, image.getHeight());
}
use of com.b3dgs.lionengine.graphic.Image in project lionengine by b3dgs.
the class ImageTest method testLoadMedia.
/**
* Test load with media.
*/
@Test
public void testLoadMedia() {
final Image image = new ImageImpl(media);
image.load();
Assert.assertNotNull(image.getSurface());
image.prepare();
image.dispose();
}
Aggregations