use of net.sf.latexdraw.model.api.shape.Circle in project latexdraw by arnobl.
the class TestParsingPscircle method testCoordinatesPt.
@Test
public void testCoordinatesPt() {
parser("\\pscircle(35pt,20pt){10pt}");
final Circle cir = getShapeAt(0);
assertEquals(35d * Shape.PPC / PSTricksConstants.CM_VAL_PT - 10d * Shape.PPC / PSTricksConstants.CM_VAL_PT, cir.getPosition().getX(), 0.001);
assertEquals((20d * Shape.PPC / PSTricksConstants.CM_VAL_PT - 10d * Shape.PPC / PSTricksConstants.CM_VAL_PT) * -1d, cir.getPosition().getY(), 0.001);
assertEquals(10d * Shape.PPC / PSTricksConstants.CM_VAL_PT * 2d, cir.getWidth(), 0.0000001);
assertEquals(10d * Shape.PPC / PSTricksConstants.CM_VAL_PT * 2d, cir.getHeight(), 0.0000001);
}
use of net.sf.latexdraw.model.api.shape.Circle in project latexdraw by arnobl.
the class TestParsingPscircle method testCoordinatesCm.
@Test
public void testCoordinatesCm() {
parser("\\pscircle(35cm,20cm){.5cm}");
final Circle cir = getShapeAt(0);
assertEquals(35d * Shape.PPC - .5 * Shape.PPC, cir.getPosition().getX(), 0.001);
assertEquals((20d * Shape.PPC - .5 * Shape.PPC) * -1d, cir.getPosition().getY(), 0.001);
assertEquals(.5 * Shape.PPC * 2d, cir.getWidth(), 0.0000001);
assertEquals(.5 * Shape.PPC * 2d, cir.getHeight(), 0.0000001);
}
use of net.sf.latexdraw.model.api.shape.Circle in project latexdraw by arnobl.
the class TestParsingPscircle method testCoordinatesMissing.
@Test
public void testCoordinatesMissing() {
parser("\\pscircle(,){1}");
final Circle cir = getShapeAt(0);
assertEquals(Shape.PPC - 1d * Shape.PPC, cir.getPosition().getX(), 0.0000001);
assertEquals((Shape.PPC - 1d * Shape.PPC) * -1d, cir.getPosition().getY(), 0.0000001);
assertEquals(1d * Shape.PPC * 2d, cir.getWidth(), 0.0000001);
assertEquals(1d * Shape.PPC * 2d, cir.getHeight(), 0.0000001);
}
use of net.sf.latexdraw.model.api.shape.Circle in project latexdraw by arnobl.
the class TestParsingPscircle method testCoordinatesInch.
@Test
public void testCoordinatesInch() {
parser("\\pscircle(35in,20in){1.2in}");
final Circle cir = getShapeAt(0);
assertEquals(35d * Shape.PPC / 2.54 - 1.2 * Shape.PPC / 2.54, cir.getPosition().getX(), 0.001);
assertEquals((20d * Shape.PPC / 2.54 - 1.2 * Shape.PPC / 2.54) * -1d, cir.getPosition().getY(), 0.001);
assertEquals(1.2 * Shape.PPC / 2.54 * 2d, cir.getWidth(), 0.0000001);
assertEquals(1.2 * Shape.PPC / 2.54 * 2d, cir.getHeight(), 0.0000001);
}
use of net.sf.latexdraw.model.api.shape.Circle in project latexdraw by arnobl.
the class TestParsingPscircle method testNegativeRadius.
@Test
public void testNegativeRadius() {
parser("\\pscircle(0,0){-1}");
final Circle cir = getShapeAt(0);
assertThat(cir.getWidth()).isPositive();
assertThat(cir.getHeight()).isPositive();
}
Aggregations