Search in sources :

Example 6 with Text

use of net.sf.latexdraw.model.api.shape.Text in project latexdraw by arnobl.

the class TestParsingRPut method testRefPointtr.

@Test
void testRefPointtr() {
    parser("\\rput[tr](10,20){coucou}");
    final Text txt = getShapeAt(0);
    assertEquals(TextPosition.TOP_RIGHT, txt.getTextPosition());
    assertEquals(10d * Shape.PPC, txt.getPosition().getX(), 0.001);
    assertEquals(-20d * Shape.PPC, txt.getPosition().getY(), 0.001);
}
Also used : Text(net.sf.latexdraw.model.api.shape.Text) Test(org.junit.jupiter.api.Test)

Example 7 with Text

use of net.sf.latexdraw.model.api.shape.Text in project latexdraw by arnobl.

the class TestParsingRPut method testDoubleRputRotationMustNotRotateOtherShapes.

@Test
void testDoubleRputRotationMustNotRotateOtherShapes() {
    parser("\\rput{10}(0,0){\\rput{80}(0,0){coucou}}\\psframe(10,10)");
    final Text txt = getShapeAt(0);
    final Rectangle rec = getShapeAt(1);
    assertEquals(Math.toRadians(-90), txt.getRotationAngle(), 0.001);
    assertEquals(0d, rec.getRotationAngle(), 0.001);
}
Also used : Rectangle(net.sf.latexdraw.model.api.shape.Rectangle) Text(net.sf.latexdraw.model.api.shape.Text) Test(org.junit.jupiter.api.Test)

Example 8 with Text

use of net.sf.latexdraw.model.api.shape.Text in project latexdraw by arnobl.

the class TestParsingRPut method testRPutCoordRotationNText.

@Test
void testRPutCoordRotationNText() {
    parser("\\rput{N}(1,2){coucou}");
    final Text txt = getShapeAt(0);
    assertEquals("coucou", txt.getText());
    assertEquals(Shape.PPC, txt.getPosition().getX(), 0.001);
    assertEquals(-2d * Shape.PPC, txt.getPosition().getY(), 0.001);
    assertEquals(0d, txt.getRotationAngle(), 0.001);
}
Also used : Text(net.sf.latexdraw.model.api.shape.Text) Test(org.junit.jupiter.api.Test)

Example 9 with Text

use of net.sf.latexdraw.model.api.shape.Text in project latexdraw by arnobl.

the class TestParsingRPut method testRPutCoordStarFloatText.

@Test
void testRPutCoordStarFloatText() {
    parser("\\rput{*-90.8929}(1,2){coucou}");
    final Text txt = getShapeAt(0);
    assertEquals("coucou", txt.getText());
    assertEquals(Shape.PPC, txt.getPosition().getX(), 0.001);
    assertEquals(-2d * Shape.PPC, txt.getPosition().getY(), 0.001);
    assertEquals(Math.toRadians(90.8929), txt.getRotationAngle(), 0.001);
}
Also used : Text(net.sf.latexdraw.model.api.shape.Text) Test(org.junit.jupiter.api.Test)

Example 10 with Text

use of net.sf.latexdraw.model.api.shape.Text in project latexdraw by arnobl.

the class TestParsingRPut method testRPutCoordRotationSText.

@Test
void testRPutCoordRotationSText() {
    parser("\\rput{S}(1,2){coucou}");
    final Text txt = getShapeAt(0);
    assertEquals("coucou", txt.getText());
    assertEquals(Shape.PPC, txt.getPosition().getX(), 0.001);
    assertEquals(-2d * Shape.PPC, txt.getPosition().getY(), 0.001);
    assertEquals(Math.toRadians(-180d), txt.getRotationAngle(), 0.001);
}
Also used : Text(net.sf.latexdraw.model.api.shape.Text) Test(org.junit.jupiter.api.Test)

Aggregations

Text (net.sf.latexdraw.model.api.shape.Text)67 Test (org.junit.jupiter.api.Test)53 Test (org.junit.Test)10 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)10 HelperTest (net.sf.latexdraw.HelperTest)6 Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)2 ExecutionException (java.util.concurrent.ExecutionException)1 Point2D (javafx.geometry.Point2D)1 Axes (net.sf.latexdraw.model.api.shape.Axes)1 BezierCurve (net.sf.latexdraw.model.api.shape.BezierCurve)1 Circle (net.sf.latexdraw.model.api.shape.Circle)1 CircleArc (net.sf.latexdraw.model.api.shape.CircleArc)1 Dot (net.sf.latexdraw.model.api.shape.Dot)1 Ellipse (net.sf.latexdraw.model.api.shape.Ellipse)1 Freehand (net.sf.latexdraw.model.api.shape.Freehand)1 Grid (net.sf.latexdraw.model.api.shape.Grid)1 Plot (net.sf.latexdraw.model.api.shape.Plot)1 Polygon (net.sf.latexdraw.model.api.shape.Polygon)1 Polyline (net.sf.latexdraw.model.api.shape.Polyline)1 Rhombus (net.sf.latexdraw.model.api.shape.Rhombus)1