Search in sources :

Example 11 with Text

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

the class TextAwtTest method testNormal.

/**
 * Test normal.
 */
@Test
public void testNormal() {
    final Text text = Graphics.createText(Constant.FONT_DIALOG, 12, TextStyle.NORMAL);
    text.draw(g, 0, 0, VALUE);
    text.draw(g, 0, 0, Align.CENTER, VALUE);
    text.draw(g, 0, 0, Align.LEFT, VALUE);
    text.draw(g, 0, 0, Align.RIGHT, VALUE);
    text.setAlign(Align.CENTER);
    text.setColor(ColorRgba.BLACK);
    text.setLocation(1, 5);
    text.setText(VALUE);
    Assert.assertEquals(12, text.getSize());
    Assert.assertEquals(1, text.getLocationX());
    Assert.assertEquals(5, text.getLocationY());
    Assert.assertTrue(text.getWidth() == 0);
    Assert.assertTrue(text.getHeight() == 0);
    text.render(g);
    text.render(g);
    Assert.assertTrue(text.getWidth() > 0);
    Assert.assertTrue(text.getHeight() > 0);
}
Also used : Text(com.b3dgs.lionengine.graphic.Text) Test(org.junit.Test)

Aggregations

Text (com.b3dgs.lionengine.graphic.Text)11 Test (org.junit.jupiter.api.Test)7 Test (org.junit.Test)4 Graphic (com.b3dgs.lionengine.graphic.Graphic)2 Align (com.b3dgs.lionengine.Align)1 LionEngineException (com.b3dgs.lionengine.LionEngineException)1