Search in sources :

Example 16 with ITriangle

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

the class TestParsingPstriangle method testHeightNegative.

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

Example 17 with ITriangle

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

the class TestParsingPstriangle method testParse2CoordinatesFloat2.

@Test
public void testParse2CoordinatesFloat2() {
    parser("\\pstriangle(0.5,.5)(35.5,50.5)");
    ITriangle tri = getShapeAt(0);
    assertEquals(0.5 * IShape.PPC - 35.5 / 2d * IShape.PPC, tri.getPosition().getX(), 0.001);
    assertEquals(0.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 18 with ITriangle

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

the class TestParsingPstriangle method testCoordinatesMm.

@Test
public void testCoordinatesMm() {
    parser("\\pstriangle(0,0)(350mm,200mm)");
    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 19 with ITriangle

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

the class TestParsingPstriangle method testParse2CoordinatesTwoLastMissing.

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

Example 20 with ITriangle

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

the class TestITriangle method testConstructor1.

@Test
public void testConstructor1() {
    final ITriangle shape = ShapeFactory.INST.createTriangle();
    assertEqualsDouble(1d, shape.getWidth());
    assertEqualsDouble(1d, shape.getHeight());
    assertEqualsDouble(0d, shape.getPosition().getX());
    assertEqualsDouble(1d, shape.getPosition().getY());
}
Also used : ITriangle(net.sf.latexdraw.models.interfaces.shape.ITriangle) HelperTest(net.sf.latexdraw.HelperTest) 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