Search in sources :

Example 16 with IEllipse

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

the class TestParsingPsellipse method testCoordinatesCm.

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

Example 17 with IEllipse

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

the class TestParsingPsellipse method testParse2CoordinatesTwoFirstMissing.

@Test
public void testParse2CoordinatesTwoFirstMissing() {
    parser("\\psellipse(,)(35,50)");
    IEllipse ell = getShapeAt(0);
    assertEquals(IShape.PPC - 35 * IShape.PPC, ell.getPosition().getX(), 0.001);
    assertEquals(-IShape.PPC + 50d * IShape.PPC, ell.getPosition().getY(), 0.001);
    assertEquals(35d * IShape.PPC * 2d, ell.getWidth(), 0.001);
    assertEquals(50d * IShape.PPC * 2d, ell.getHeight(), 0.001);
}
Also used : IEllipse(net.sf.latexdraw.models.interfaces.shape.IEllipse) Test(org.junit.Test)

Example 18 with IEllipse

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

the class TestIEllipse method testConstructors3OK.

@Test
public void testConstructors3OK() {
    final IEllipse ell = ShapeFactory.INST.createEllipse(ShapeFactory.INST.createPoint(20, 26), ShapeFactory.INST.createPoint(30, 35));
    assertEqualsDouble(20., ell.getPosition().getX());
    assertEqualsDouble(35., ell.getPosition().getY());
    assertEqualsDouble(10., ell.getWidth());
    assertEqualsDouble(9., ell.getHeight());
}
Also used : IEllipse(net.sf.latexdraw.models.interfaces.shape.IEllipse) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 19 with IEllipse

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

the class TestIEllipse method testIsTypeOf.

@Test
public void testIsTypeOf() {
    final IEllipse shape = ShapeFactory.INST.createEllipse();
    assertFalse(shape.isTypeOf(null));
    assertFalse(shape.isTypeOf(IRectangle.class));
    assertFalse(shape.isTypeOf(ICircle.class));
    assertTrue(shape.isTypeOf(IShape.class));
    assertTrue(shape.isTypeOf(IPositionShape.class));
    assertTrue(shape.isTypeOf(IRectangularShape.class));
    assertTrue(shape.isTypeOf(IEllipse.class));
    assertTrue(shape.isTypeOf(shape.getClass()));
}
Also used : IRectangularShape(net.sf.latexdraw.models.interfaces.shape.IRectangularShape) ICircle(net.sf.latexdraw.models.interfaces.shape.ICircle) IPositionShape(net.sf.latexdraw.models.interfaces.shape.IPositionShape) IEllipse(net.sf.latexdraw.models.interfaces.shape.IEllipse) IShape(net.sf.latexdraw.models.interfaces.shape.IShape) IRectangle(net.sf.latexdraw.models.interfaces.shape.IRectangle) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 20 with IEllipse

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

the class TestIEllipse method testConstructors2.

@Test
public void testConstructors2() {
    final IEllipse ell = ShapeFactory.INST.createEllipse();
    assertEquals(4, ell.getNbPoints());
}
Also used : IEllipse(net.sf.latexdraw.models.interfaces.shape.IEllipse) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Aggregations

IEllipse (net.sf.latexdraw.models.interfaces.shape.IEllipse)21 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 Point2D (javafx.geometry.Point2D)1 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 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