Search in sources :

Example 16 with Triangle

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

the class TestParsingPstriangle method testHeightNegative.

@Test
public void testHeightNegative() {
    parser("\\pstriangle(35,-10)");
    final Triangle tri = getShapeAt(0);
    assertEquals(10d * Shape.PPC, tri.getHeight(), 0.001);
    assertEquals(Math.PI, tri.getRotationAngle(), 0.001);
}
Also used : Triangle(net.sf.latexdraw.model.api.shape.Triangle) Test(org.junit.jupiter.api.Test)

Example 17 with Triangle

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

the class TestParsingPstriangle method testParse2CoordinatesFloat2.

@Test
public void testParse2CoordinatesFloat2() {
    parser("\\pstriangle(0.5,.5)(35.5,50.5)");
    final Triangle tri = getShapeAt(0);
    assertEquals(0.5 * Shape.PPC - 35.5 / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
    assertEquals(0.5 * -Shape.PPC, tri.getPosition().getY(), 0.001);
    assertEquals(35.5 * Shape.PPC, tri.getWidth(), 0.001);
    assertEquals(50.5 * Shape.PPC, tri.getHeight(), 0.001);
}
Also used : Triangle(net.sf.latexdraw.model.api.shape.Triangle) Test(org.junit.jupiter.api.Test)

Example 18 with Triangle

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

the class TestParsingPstriangle method testParse2CoordinatesTwoFirstMissing.

@Test
public void testParse2CoordinatesTwoFirstMissing() {
    parser("\\pstriangle(,)(35,50)");
    final Triangle tri = getShapeAt(0);
    assertEquals(Shape.PPC - 35d / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
    assertEquals(Shape.PPC * -1d, tri.getPosition().getY(), 0.001);
    assertEquals(35d * Shape.PPC, tri.getWidth(), 0.001);
    assertEquals(50d * Shape.PPC, tri.getHeight(), 0.001);
}
Also used : Triangle(net.sf.latexdraw.model.api.shape.Triangle) Test(org.junit.jupiter.api.Test)

Example 19 with Triangle

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

the class TestParsingPstriangle method testParse2CoordinatesInt.

@Test
public void testParse2CoordinatesInt() {
    parser("\\pstriangle(10,20)(35,50)");
    final Triangle tri = getShapeAt(0);
    assertEquals(10d * Shape.PPC - 35d / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
    assertEquals(20d * -Shape.PPC, tri.getPosition().getY(), 0.001);
    assertEquals(35d * Shape.PPC, tri.getWidth(), 0.001);
    assertEquals(50d * Shape.PPC, tri.getHeight(), 0.001);
}
Also used : Triangle(net.sf.latexdraw.model.api.shape.Triangle) Test(org.junit.jupiter.api.Test)

Aggregations

Triangle (net.sf.latexdraw.model.api.shape.Triangle)19 Test (org.junit.jupiter.api.Test)15 HelperTest (net.sf.latexdraw.HelperTest)3 Test (org.junit.Test)3 Circle (net.sf.latexdraw.model.api.shape.Circle)2 Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)2 Axes (net.sf.latexdraw.model.api.shape.Axes)1 BezierCurve (net.sf.latexdraw.model.api.shape.BezierCurve)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 PositionShape (net.sf.latexdraw.model.api.shape.PositionShape)1 RectangularShape (net.sf.latexdraw.model.api.shape.RectangularShape)1 Rhombus (net.sf.latexdraw.model.api.shape.Rhombus)1 Shape (net.sf.latexdraw.model.api.shape.Shape)1