Search in sources :

Example 1 with SpriteFont

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

the class SpriteFontTest method testLoadMedia.

/**
 * Test load with media.
 */
@Test
public void testLoadMedia() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    sprite.load();
    Assert.assertNotNull(sprite.getSurface());
    sprite.prepare();
    sprite.dispose();
}
Also used : SpriteFont(com.b3dgs.lionengine.graphic.SpriteFont) Test(org.junit.Test)

Example 2 with SpriteFont

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

the class SpriteFontTest method testConstructorMedia.

/**
 * Test constructor with media.
 */
@Test
public void testConstructorMedia() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    Assert.assertFalse(sprite.isLoaded());
    Assert.assertNull(sprite.getSurface());
    Assert.assertEquals(64, sprite.getWidth());
    Assert.assertEquals(32, sprite.getHeight());
}
Also used : SpriteFont(com.b3dgs.lionengine.graphic.SpriteFont) Test(org.junit.Test)

Example 3 with SpriteFont

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

the class SpriteFontTest method testFilterBilinear.

/**
 * Test filter bilinear.
 */
@Test
public void testFilterBilinear() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    sprite.load();
    sprite.filter(new FilterBilinear());
    Assert.assertEquals(64, sprite.getWidth());
    Assert.assertEquals(32, sprite.getHeight());
}
Also used : SpriteFont(com.b3dgs.lionengine.graphic.SpriteFont) FilterBilinear(com.b3dgs.lionengine.core.filter.FilterBilinear) Test(org.junit.Test)

Example 4 with SpriteFont

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

the class SpriteFontTest method testRotate.

/**
 * Test rotate sprite.
 */
@Test
public void testRotate() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    sprite.load();
    for (int angle = -720; angle < 720; angle++) {
        sprite.rotate(angle);
        Assert.assertTrue(angle + Constant.SPACE + sprite.getWidth(), sprite.getWidth() >= 64);
        Assert.assertTrue(angle + Constant.SPACE + sprite.getHeight(), sprite.getHeight() >= 32);
    }
}
Also used : SpriteFont(com.b3dgs.lionengine.graphic.SpriteFont) Test(org.junit.Test)

Example 5 with SpriteFont

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

the class SpriteFontTest method testFilterNull.

/**
 * Test filter <code>null</code>.
 */
@Test(expected = LionEngineException.class)
public void testFilterNull() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    sprite.filter(null);
}
Also used : SpriteFont(com.b3dgs.lionengine.graphic.SpriteFont) Test(org.junit.Test)

Aggregations

SpriteFont (com.b3dgs.lionengine.graphic.SpriteFont)22 Test (org.junit.Test)22 Graphic (com.b3dgs.lionengine.graphic.Graphic)2 FilterBilinear (com.b3dgs.lionengine.core.filter.FilterBilinear)1