Search in sources :

Example 31 with IText

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());
}
Also used : IText(net.sf.latexdraw.models.interfaces.shape.IText) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 32 with IText

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);
    }
}
Also used : IText(net.sf.latexdraw.models.interfaces.shape.IText)

Example 33 with IText

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);
}
Also used : IText(net.sf.latexdraw.models.interfaces.shape.IText) Test(org.junit.Test)

Example 34 with IText

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);
}
Also used : IText(net.sf.latexdraw.models.interfaces.shape.IText) Test(org.junit.Test)

Example 35 with IText

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);
}
Also used : IText(net.sf.latexdraw.models.interfaces.shape.IText) Test(org.junit.Test)

Aggregations

IText (net.sf.latexdraw.models.interfaces.shape.IText)72 Test (org.junit.Test)65 HelperTest (net.sf.latexdraw.HelperTest)6 Platform (javafx.application.Platform)3 URL (java.net.URL)2 Collections (java.util.Collections)2 ResourceBundle (java.util.ResourceBundle)2 Initializable (javafx.fxml.Initializable)2 Point2D (javafx.geometry.Point2D)2 KeyCode (javafx.scene.input.KeyCode)2 ShapeProperties (net.sf.latexdraw.commands.shape.ShapeProperties)2 ShapeFactory (net.sf.latexdraw.models.ShapeFactory)2 IPlot (net.sf.latexdraw.models.interfaces.shape.IPlot)2 TextAreaAutoSize (net.sf.latexdraw.ui.TextAreaAutoSize)2 ViewText (net.sf.latexdraw.view.jfx.ViewText)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Optional (java.util.Optional)1 ExecutionException (java.util.concurrent.ExecutionException)1 Future (java.util.concurrent.Future)1