Search in sources :

Example 21 with SpriteFont

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

the class SpriteFontTest method testHashCode.

/**
 * Test hash code.
 */
@Test
public void testHashCode() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    sprite.load();
    final int code = sprite.hashCode();
    Assert.assertNotEquals(code, new SpriteFontImpl(media, font, 6, 7).hashCode());
    Assert.assertNotEquals(code, new Object().hashCode());
    Assert.assertNotEquals(code, new SpriteFontImpl(media, Medias.create("fontdata2.xml"), 1, 7).hashCode());
    Assert.assertNotEquals(code, new SpriteFontImpl(media, font, 1, 7).hashCode());
    Assert.assertNotEquals(code, new SpriteFontImpl(media, font, 6, 1).hashCode());
    Assert.assertNotEquals(code, new SpriteFontImpl(media, font, 1, 1).hashCode());
}
Also used : SpriteFont(com.b3dgs.lionengine.graphic.SpriteFont) Test(org.junit.Test)

Example 22 with SpriteFont

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

the class SpriteFontTest method testSetFade.

/**
 * Test set fade.
 */
@Test
public void testSetFade() {
    final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
    sprite.load();
    sprite.setFade(128, 128);
    sprite.setFade(128, 128);
    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