use of net.sf.latexdraw.models.interfaces.shape.IText in project latexdraw by arnobl.
the class TestIText method testConstructorsOK3.
@Test
public void testConstructorsOK3() {
IText txt = ShapeFactory.INST.createText(ShapeFactory.INST.createPoint(), "");
assertNotNull(txt.getText());
assertFalse(txt.getText().isEmpty());
}
use of net.sf.latexdraw.models.interfaces.shape.IText in project latexdraw by arnobl.
the class PSTLatexdrawListener method addParsedText.
private void addParsedText(final PSTContext ctx) {
if (!ctx.textParsed.isEmpty()) {
final String txt = ctx.textParsed.stream().collect(Collectors.joining(" "));
final IText text = ShapeFactory.INST.createText(ShapeFactory.INST.createPoint(), txt);
setShapeParameters(text, ctx);
text.setLineColour(ctx.textColor);
text.setTextPosition(TextPosition.getTextPosition(ctx.textPosition));
shapes.peek().addShape(text);
}
}
use of net.sf.latexdraw.models.interfaces.shape.IText in project latexdraw by arnobl.
the class TestParsingRPut method testRPutCoordStarSignedIntText.
@Test
public void testRPutCoordStarSignedIntText() {
parser("\\rput{*-++-90}(1,2){coucou}");
final IText txt = getShapeAt(0);
assertEquals("coucou", txt.getText());
assertEquals(IShape.PPC, txt.getPosition().getX(), 0.001);
assertEquals(-2d * IShape.PPC, txt.getPosition().getY(), 0.001);
assertEquals(Math.toRadians(-90d), txt.getRotationAngle(), 0.001);
}
use of net.sf.latexdraw.models.interfaces.shape.IText in project latexdraw by arnobl.
the class TestParsingRPut method testRefPointBr.
@Test
public void testRefPointBr() {
parser("\\rput[Br](10,20){coucou}");
final IText txt = getShapeAt(0);
assertEquals(TextPosition.BASE_RIGHT, txt.getTextPosition());
assertEquals(10d * IShape.PPC, txt.getPosition().getX(), 0.001);
assertEquals(-20d * IShape.PPC, txt.getPosition().getY(), 0.001);
}
use of net.sf.latexdraw.models.interfaces.shape.IText in project latexdraw by arnobl.
the class TestParsingRPut method testDoubleRputRotation.
@Test
public void testDoubleRputRotation() {
parser("\\rput{10}(0,0){\\rput{80}(0,0){coucou}}");
final IText txt = getShapeAt(0);
assertEquals(Math.toRadians(-90), txt.getRotationAngle(), 0.001);
}
Aggregations