use of com.b3dgs.lionengine.graphic.Text in project lionengine by b3dgs.
the class TextHeadlessTest method testBold.
/**
* Test bold.
*/
@Test
void testBold() {
final Text text = Graphics.createText(Constant.FONT_DIALOG, 12, TextStyle.BOLD);
text.draw(g, 0, 0, VALUE);
}
use of com.b3dgs.lionengine.graphic.Text in project lionengine by b3dgs.
the class TextAwtTest method testBold.
/**
* Test bold.
*/
@Test
void testBold() {
final Text text = Graphics.createText(Constant.FONT_DIALOG, 12, TextStyle.BOLD);
text.draw(g, 0, 0, VALUE);
}
use of com.b3dgs.lionengine.graphic.Text in project lionengine by b3dgs.
the class TextAwtTest method testNormal.
/**
* Test normal.
*/
@Test
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.0, 5.0);
text.setText(VALUE);
assertEquals(12, text.getSize());
assertEquals(1, text.getLocationX());
assertEquals(5, text.getLocationY());
assertTrue(text.getWidth() == 0);
assertTrue(text.getHeight() == 0);
text.render(g);
text.render(g);
assertTrue(text.getWidth() > 0);
assertTrue(text.getHeight() > 0);
}
use of com.b3dgs.lionengine.graphic.Text in project lionengine by b3dgs.
the class TextAwtTest method testItalic.
/**
* Test italic.
*/
@Test
void testItalic() {
final Text text = Graphics.createText(Constant.FONT_DIALOG, 12, TextStyle.ITALIC);
text.draw(g, 0, 0, VALUE);
}
use of com.b3dgs.lionengine.graphic.Text in project lionengine by b3dgs.
the class TextAwtTest method testAlignUnknown.
/**
* Test align unknown.
*/
@Test
void testAlignUnknown() {
final Text text = Graphics.createText(Constant.FONT_DIALOG, 12, TextStyle.NORMAL);
final Graphic g = Graphics.createGraphic();
g.setGraphic(ToolsAwt.createImage(1, 1, java.awt.Transparency.OPAQUE).createGraphics());
assertThrows(() -> text.draw(g, 0, 0, Align.values()[3], Constant.EMPTY_STRING), "Unknown enum: FAIL");
}