use of net.sf.latexdraw.model.api.shape.Ellipse in project latexdraw by arnobl.
the class TestParsingPsellipse method testParse1Coordinates.
@Test
public void testParse1Coordinates() {
parser("\\psellipse(35,20)");
final Ellipse ell = getShapeAt(0);
assertEquals(-35d * Shape.PPC, ell.getPosition().getX(), 0.001);
assertEquals(-20d * Shape.PPC * -1d, ell.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC * 2d, ell.getWidth(), 0.001);
assertEquals(20d * 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 testParse2CoordinatesTwoFirstMissing.
@Test
public void testParse2CoordinatesTwoFirstMissing() {
parser("\\psellipse(,)(35,50)");
final Ellipse ell = getShapeAt(0);
assertEquals(Shape.PPC - 35 * Shape.PPC, ell.getPosition().getX(), 0.001);
assertEquals(-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 testCoordinatesInch.
@Test
public void testCoordinatesInch() {
parser("\\psellipse(0,0)(35in,20in)");
final Ellipse ell = getShapeAt(0);
assertEquals(-35d * Shape.PPC / 2.54, ell.getPosition().getX(), 0.001);
assertEquals(-20d * Shape.PPC / 2.54 * -1d, ell.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC / 2.54 * 2d, ell.getWidth(), 0.001);
assertEquals(20d * Shape.PPC / 2.54 * 2d, ell.getHeight(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Ellipse in project latexdraw by arnobl.
the class TestParsingPsellipse method testCoordinatesPt.
@Test
public void testCoordinatesPt() {
parser("\\psellipse(0,0)(35pt,20pt)");
final Ellipse ell = getShapeAt(0);
assertEquals(-35d * Shape.PPC / PSTricksConstants.CM_VAL_PT, ell.getPosition().getX(), 0.001);
assertEquals(-20d * Shape.PPC / PSTricksConstants.CM_VAL_PT * -1d, ell.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC / PSTricksConstants.CM_VAL_PT * 2d, ell.getWidth(), 0.001);
assertEquals(20d * Shape.PPC / PSTricksConstants.CM_VAL_PT * 2d, ell.getHeight(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Ellipse in project latexdraw by arnobl.
the class TestParsingPsellipse method testParse2CoordinatesFloatSigns.
@Test
public void testParse2CoordinatesFloatSigns() {
parser("\\psellipse(-+-.5,+--.5)(+++35.5,--50.5)");
final Ellipse ell = getShapeAt(0);
assertEquals(.5 * Shape.PPC - 35.5 * Shape.PPC, ell.getPosition().getX(), 0.001);
assertEquals(.5 * -Shape.PPC + 50.5 * Shape.PPC, ell.getPosition().getY(), 0.001);
assertEquals(35.5 * Shape.PPC * 2d, ell.getWidth(), 0.001);
assertEquals(50.5 * Shape.PPC * 2d, ell.getHeight(), 0.001);
}
Aggregations