Search in sources :

Example 16 with SpriteFont

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

the class SpriteFontTest method testDraw.

/**
 * Test draw.
 */
@Test
public void testDraw() {
    final Graphic g = Graphics.createImageBuffer(100, 100).createGraphic();
    try {
        final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
        sprite.load();
        sprite.draw(g, 1, 2, Align.CENTER, "az%");
    } finally {
        g.dispose();
    }
}
Also used : SpriteFont(com.b3dgs.lionengine.graphic.SpriteFont) Graphic(com.b3dgs.lionengine.graphic.Graphic) Test(org.junit.Test)

Example 17 with SpriteFont

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

the class SpriteFontTest method testMirrorNull.

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

Example 18 with SpriteFont

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

the class SpriteFontTest method testMirror.

/**
 * Test mirror.
 */
@Test
public void testMirror() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    Assert.assertEquals(Mirror.NONE, sprite.getMirror());
    sprite.setMirror(Mirror.HORIZONTAL);
    Assert.assertEquals(Mirror.HORIZONTAL, sprite.getMirror());
}
Also used : SpriteFont(com.b3dgs.lionengine.graphic.SpriteFont) Test(org.junit.Test)

Example 19 with SpriteFont

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

the class SpriteFontTest method testEquals.

/**
 * Test equals.
 */
@Test
public void testEquals() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    sprite.load();
    Assert.assertEquals(sprite, sprite);
    Assert.assertNotEquals(sprite, new SpriteFontImpl(media, font, 6, 7));
    Assert.assertNotEquals(sprite, null);
    Assert.assertNotEquals(sprite, new Object());
    Assert.assertNotEquals(sprite, new SpriteFontImpl(media, font, 1, 7));
    Assert.assertNotEquals(sprite, new SpriteFontImpl(media, font, 6, 1));
    Assert.assertNotEquals(sprite, new SpriteFontImpl(media, font, 1, 1));
}
Also used : SpriteFont(com.b3dgs.lionengine.graphic.SpriteFont) Test(org.junit.Test)

Example 20 with SpriteFont

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

the class SpriteFontTest method testSetTransparency.

/**
 * Test set transparency.
 */
@Test
public void testSetTransparency() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    sprite.load();
    sprite.setTransparency(ColorRgba.BLACK);
    Assert.assertEquals(64, sprite.getWidth());
    Assert.assertEquals(32, sprite.getHeight());
}
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