Search in sources :

Example 1 with Image

use of com.b3dgs.lionengine.graphic.Image in project lionengine by b3dgs.

the class ImageTest method testSetOriginNull.

/**
 * Test origin <code>null</code>.
 */
@Test(expected = LionEngineException.class)
public void testSetOriginNull() {
    final Image image = new ImageImpl(Graphics.createImageBuffer(64, 32));
    image.setOrigin(null);
}
Also used : Image(com.b3dgs.lionengine.graphic.Image) Test(org.junit.Test)

Example 2 with Image

use of com.b3dgs.lionengine.graphic.Image in project lionengine by b3dgs.

the class ImageTest method testRender.

/**
 * Test the render.
 */
@Test
public void testRender() {
    final Graphic g = Graphics.createImageBuffer(100, 100).createGraphic();
    try {
        final Image image = new ImageImpl(Graphics.createImageBuffer(64, 32));
        image.render(g);
    } finally {
        g.dispose();
    }
}
Also used : Graphic(com.b3dgs.lionengine.graphic.Graphic) Image(com.b3dgs.lionengine.graphic.Image) Test(org.junit.Test)

Example 3 with Image

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

Example 4 with Image

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

Example 5 with Image

use of com.b3dgs.lionengine.graphic.Image in project lionengine by b3dgs.

the class ImageTest method testLoadSurface.

/**
 * Test load with surface.
 */
@Test(expected = LionEngineException.class)
public void testLoadSurface() {
    final Image image = new ImageImpl(Graphics.createImageBuffer(64, 32));
    image.load();
}
Also used : Image(com.b3dgs.lionengine.graphic.Image) Test(org.junit.Test)

Aggregations

Image (com.b3dgs.lionengine.graphic.Image)9 Test (org.junit.Test)9 ImageBuffer (com.b3dgs.lionengine.graphic.ImageBuffer)3 Graphic (com.b3dgs.lionengine.graphic.Graphic)1