use of net.sf.latexdraw.model.api.shape.Triangle in project latexdraw by arnobl.
the class TestParsingPstriangle method testHeightNegative.
@Test
public void testHeightNegative() {
parser("\\pstriangle(35,-10)");
final Triangle tri = getShapeAt(0);
assertEquals(10d * Shape.PPC, tri.getHeight(), 0.001);
assertEquals(Math.PI, tri.getRotationAngle(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Triangle in project latexdraw by arnobl.
the class TestParsingPstriangle method testParse2CoordinatesFloat2.
@Test
public void testParse2CoordinatesFloat2() {
parser("\\pstriangle(0.5,.5)(35.5,50.5)");
final Triangle tri = getShapeAt(0);
assertEquals(0.5 * Shape.PPC - 35.5 / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
assertEquals(0.5 * -Shape.PPC, tri.getPosition().getY(), 0.001);
assertEquals(35.5 * Shape.PPC, tri.getWidth(), 0.001);
assertEquals(50.5 * Shape.PPC, tri.getHeight(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Triangle in project latexdraw by arnobl.
the class TestParsingPstriangle method testParse2CoordinatesTwoFirstMissing.
@Test
public void testParse2CoordinatesTwoFirstMissing() {
parser("\\pstriangle(,)(35,50)");
final Triangle tri = getShapeAt(0);
assertEquals(Shape.PPC - 35d / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
assertEquals(Shape.PPC * -1d, tri.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC, tri.getWidth(), 0.001);
assertEquals(50d * Shape.PPC, tri.getHeight(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Triangle in project latexdraw by arnobl.
the class TestParsingPstriangle method testParse2CoordinatesInt.
@Test
public void testParse2CoordinatesInt() {
parser("\\pstriangle(10,20)(35,50)");
final Triangle tri = getShapeAt(0);
assertEquals(10d * Shape.PPC - 35d / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
assertEquals(20d * -Shape.PPC, tri.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC, tri.getWidth(), 0.001);
assertEquals(50d * Shape.PPC, tri.getHeight(), 0.001);
}
Aggregations