Search in sources :

Example 6 with Ellipse

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

the class TestParsingPsellipse method testParse2CoordinatesInt.

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

Example 7 with Ellipse

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

the class TestParsingPsellipse method testParse2CoordinatesTwoLastMissing.

@Test
public void testParse2CoordinatesTwoLastMissing() {
    parser("\\psellipse(0,0)(,)");
    final Ellipse ell = getShapeAt(0);
    assertEquals(-Shape.PPC, ell.getPosition().getX(), 0.001);
    assertEquals(Shape.PPC, ell.getPosition().getY(), 0.001);
    assertEquals(Shape.PPC * 2d, ell.getWidth(), 0.001);
    assertEquals(Shape.PPC * 2d, ell.getHeight(), 0.001);
}
Also used : Ellipse(net.sf.latexdraw.model.api.shape.Ellipse) Test(org.junit.jupiter.api.Test)

Example 8 with Ellipse

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

the class TestEllipse method testConstructors2.

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

Example 9 with Ellipse

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

the class TestEllipse method testIsTypeOf.

@Test
public void testIsTypeOf() {
    final Ellipse shape = ShapeFactory.INST.createEllipse();
    assertFalse(shape.isTypeOf(Rectangle.class));
    assertFalse(shape.isTypeOf(Circle.class));
    assertTrue(shape.isTypeOf(Shape.class));
    assertTrue(shape.isTypeOf(PositionShape.class));
    assertTrue(shape.isTypeOf(RectangularShape.class));
    assertTrue(shape.isTypeOf(Ellipse.class));
    assertTrue(shape.isTypeOf(shape.getClass()));
}
Also used : Circle(net.sf.latexdraw.model.api.shape.Circle) Ellipse(net.sf.latexdraw.model.api.shape.Ellipse) PositionShape(net.sf.latexdraw.model.api.shape.PositionShape) Shape(net.sf.latexdraw.model.api.shape.Shape) RectangularShape(net.sf.latexdraw.model.api.shape.RectangularShape) PositionShape(net.sf.latexdraw.model.api.shape.PositionShape) Rectangle(net.sf.latexdraw.model.api.shape.Rectangle) RectangularShape(net.sf.latexdraw.model.api.shape.RectangularShape) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 10 with Ellipse

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

the class TestEllipse method testConstructors3OK.

@Test
public void testConstructors3OK() {
    final Ellipse 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 : Ellipse(net.sf.latexdraw.model.api.shape.Ellipse) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Aggregations

Ellipse (net.sf.latexdraw.model.api.shape.Ellipse)20 Test (org.junit.jupiter.api.Test)14 Test (org.junit.Test)4 HelperTest (net.sf.latexdraw.HelperTest)3 Circle (net.sf.latexdraw.model.api.shape.Circle)2 Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)2 Point2D (javafx.geometry.Point2D)1 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 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