Search in sources :

Example 6 with SpriteFont

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

the class SpriteFontTest method testSetAlphaHigh.

/**
 * Test set alpha too high.
 */
@Test(expected = LionEngineException.class)
public void testSetAlphaHigh() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    sprite.setAlpha(256);
}
Also used : SpriteFont(com.b3dgs.lionengine.graphic.SpriteFont) Test(org.junit.Test)

Example 7 with SpriteFont

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

the class SpriteFontTest method testSetOriginNull.

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

Example 8 with SpriteFont

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

the class SpriteFontTest method testLoadMediaAlready.

/**
 * Test load with media already loaded.
 */
@Test(expected = LionEngineException.class)
public void testLoadMediaAlready() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    sprite.load();
    sprite.load();
}
Also used : SpriteFont(com.b3dgs.lionengine.graphic.SpriteFont) Test(org.junit.Test)

Example 9 with SpriteFont

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

the class SpriteFontTest method testSetAlphaLow.

/**
 * Test set alpha too low.
 */
@Test(expected = LionEngineException.class)
public void testSetAlphaLow() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    sprite.setAlpha(-1);
}
Also used : SpriteFont(com.b3dgs.lionengine.graphic.SpriteFont) Test(org.junit.Test)

Example 10 with SpriteFont

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

the class SpriteFontTest method testSetAlpha.

/**
 * Test set alpha.
 */
@Test
public void testSetAlpha() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    sprite.load();
    for (int alpha = 0; alpha < 256; alpha++) {
        sprite.setAlpha(alpha);
        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