Search in sources :

Example 1 with ITriangle

use of net.sf.latexdraw.models.interfaces.shape.ITriangle in project latexdraw by arnobl.

the class TestParsingPstriangle method testCoordinatesCm.

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

Example 2 with ITriangle

use of net.sf.latexdraw.models.interfaces.shape.ITriangle in project latexdraw by arnobl.

the class TestParsingPstriangle method testParse2WidthHeight0.

@Test
public void testParse2WidthHeight0() {
    parser("\\pstriangle(0,0)(0,0)");
    ITriangle tri = getShapeAt(0);
    assertThat(tri.getWidth(), greaterThan(0d));
    assertThat(tri.getHeight(), greaterThan(0d));
}
Also used : ITriangle(net.sf.latexdraw.models.interfaces.shape.ITriangle) Test(org.junit.Test)

Example 3 with ITriangle

use of net.sf.latexdraw.models.interfaces.shape.ITriangle in project latexdraw by arnobl.

the class TestParsingPstriangle method testParse2CoordinatesFloat.

@Test
public void testParse2CoordinatesFloat() {
    parser("\\pstriangle(10.5,20.5)(35.5,50.5)");
    ITriangle tri = getShapeAt(0);
    assertEquals(10.5 * IShape.PPC - 35.5 / 2d * IShape.PPC, tri.getPosition().getX(), 0.001);
    assertEquals(20.5 * -IShape.PPC, tri.getPosition().getY(), 0.001);
    assertEquals(35.5 * IShape.PPC, tri.getWidth(), 0.001);
    assertEquals(50.5 * IShape.PPC, tri.getHeight(), 0.001);
}
Also used : ITriangle(net.sf.latexdraw.models.interfaces.shape.ITriangle) Test(org.junit.Test)

Example 4 with ITriangle

use of net.sf.latexdraw.models.interfaces.shape.ITriangle in project latexdraw by arnobl.

the class TestParsingPstriangle method testParse1Coordinates.

@Test
public void testParse1Coordinates() {
    parser("\\pstriangle(35,20)");
    ITriangle tri = getShapeAt(0);
    assertEquals(-35d / 2d * IShape.PPC, tri.getPosition().getX(), 0.001);
    assertEquals(0d, tri.getPosition().getY(), 0.001);
    assertEquals(35d * IShape.PPC, tri.getWidth(), 0.001);
    assertEquals(20d * IShape.PPC, tri.getHeight(), 0.001);
}
Also used : ITriangle(net.sf.latexdraw.models.interfaces.shape.ITriangle) Test(org.junit.Test)

Example 5 with ITriangle

use of net.sf.latexdraw.models.interfaces.shape.ITriangle in project latexdraw by arnobl.

the class TestParsingPstriangle method testParse2CoordinatesInt.

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

Aggregations

ITriangle (net.sf.latexdraw.models.interfaces.shape.ITriangle)20 Test (org.junit.Test)18 HelperTest (net.sf.latexdraw.HelperTest)3 ICircle (net.sf.latexdraw.models.interfaces.shape.ICircle)2 IRectangle (net.sf.latexdraw.models.interfaces.shape.IRectangle)2 IAxes (net.sf.latexdraw.models.interfaces.shape.IAxes)1 IBezierCurve (net.sf.latexdraw.models.interfaces.shape.IBezierCurve)1 ICircleArc (net.sf.latexdraw.models.interfaces.shape.ICircleArc)1 IDot (net.sf.latexdraw.models.interfaces.shape.IDot)1 IEllipse (net.sf.latexdraw.models.interfaces.shape.IEllipse)1 IFreehand (net.sf.latexdraw.models.interfaces.shape.IFreehand)1 IGrid (net.sf.latexdraw.models.interfaces.shape.IGrid)1 IPlot (net.sf.latexdraw.models.interfaces.shape.IPlot)1 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)1 IPolygon (net.sf.latexdraw.models.interfaces.shape.IPolygon)1 IPolyline (net.sf.latexdraw.models.interfaces.shape.IPolyline)1 IPositionShape (net.sf.latexdraw.models.interfaces.shape.IPositionShape)1 IRectangularShape (net.sf.latexdraw.models.interfaces.shape.IRectangularShape)1 IRhombus (net.sf.latexdraw.models.interfaces.shape.IRhombus)1 IShape (net.sf.latexdraw.models.interfaces.shape.IShape)1