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);
}
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);
}
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());
}
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()));
}
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());
}
Aggregations