Search in sources :

Example 11 with Triangle

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

the class TestParsingPstriangle method testParse2CoordinatesFloat.

@Test
public void testParse2CoordinatesFloat() {
    parser("\\pstriangle(10.5,20.5)(35.5,50.5)");
    final Triangle tri = getShapeAt(0);
    assertEquals(10.5 * Shape.PPC - 35.5 / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
    assertEquals(20.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 12 with Triangle

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

the class TestParsingPstriangle method testParse2CoordinatesFloatSigns.

@Test
public void testParse2CoordinatesFloatSigns() {
    parser("\\pstriangle(-+-.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 13 with Triangle

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

the class TestParsingPstriangle method testCoordinatesCm.

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

Example 14 with Triangle

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

the class TestParsingPstriangle method testParse2WidthHeight0.

@Test
public void testParse2WidthHeight0() {
    parser("\\pstriangle(0,0)(0,0)");
    final Triangle tri = getShapeAt(0);
    assertThat(tri.getWidth()).isGreaterThan(0d);
    assertThat(tri.getHeight()).isGreaterThan(0d);
}
Also used : Triangle(net.sf.latexdraw.model.api.shape.Triangle) Test(org.junit.jupiter.api.Test)

Example 15 with Triangle

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

the class TestParsingPstriangle method testParse2CoordinatesFloatSigns2.

@Test
public void testParse2CoordinatesFloatSigns2() {
    parser("\\pstriangle(-+.5,+-5)(+++35.5,--50.5)");
    final Triangle tri = getShapeAt(0);
    assertEquals(-.5 * Shape.PPC - 35.5 / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
    assertEquals(-5d * -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)

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