use of net.sf.latexdraw.models.interfaces.shape.ITriangle in project latexdraw by arnobl.
the class TestParsingPstriangle method testCoordinatesCm.
@Test
public void testCoordinatesCm() {
parser("\\pstriangle(0,0)(35cm,20cm)");
ITriangle tri = getShapeAt(0);
assertEquals(-35d / 2d * IShape.PPC, tri.getPosition().getX(), 0.001);
assertEquals(0d, tri.getPosition().getY(), 0.001);
assertEquals(35d * IShape.PPC, tri.getWidth(), 0.001);
assertEquals(20d * IShape.PPC, tri.getHeight(), 0.001);
}
use of net.sf.latexdraw.models.interfaces.shape.ITriangle in project latexdraw by arnobl.
the class TestParsingPstriangle method testParse2WidthHeight0.
@Test
public void testParse2WidthHeight0() {
parser("\\pstriangle(0,0)(0,0)");
ITriangle tri = getShapeAt(0);
assertThat(tri.getWidth(), greaterThan(0d));
assertThat(tri.getHeight(), greaterThan(0d));
}
use of net.sf.latexdraw.models.interfaces.shape.ITriangle in project latexdraw by arnobl.
the class TestParsingPstriangle method testParse2CoordinatesFloat.
@Test
public void testParse2CoordinatesFloat() {
parser("\\pstriangle(10.5,20.5)(35.5,50.5)");
ITriangle tri = getShapeAt(0);
assertEquals(10.5 * IShape.PPC - 35.5 / 2d * IShape.PPC, tri.getPosition().getX(), 0.001);
assertEquals(20.5 * -IShape.PPC, tri.getPosition().getY(), 0.001);
assertEquals(35.5 * IShape.PPC, tri.getWidth(), 0.001);
assertEquals(50.5 * IShape.PPC, tri.getHeight(), 0.001);
}
use of net.sf.latexdraw.models.interfaces.shape.ITriangle in project latexdraw by arnobl.
the class TestParsingPstriangle method testParse1Coordinates.
@Test
public void testParse1Coordinates() {
parser("\\pstriangle(35,20)");
ITriangle tri = getShapeAt(0);
assertEquals(-35d / 2d * IShape.PPC, tri.getPosition().getX(), 0.001);
assertEquals(0d, tri.getPosition().getY(), 0.001);
assertEquals(35d * IShape.PPC, tri.getWidth(), 0.001);
assertEquals(20d * IShape.PPC, tri.getHeight(), 0.001);
}
use of net.sf.latexdraw.models.interfaces.shape.ITriangle in project latexdraw by arnobl.
the class TestParsingPstriangle method testParse2CoordinatesInt.
@Test
public void testParse2CoordinatesInt() {
parser("\\pstriangle(10,20)(35,50)");
ITriangle tri = getShapeAt(0);
assertEquals(10d * IShape.PPC - 35d / 2d * IShape.PPC, tri.getPosition().getX(), 0.001);
assertEquals(20d * -IShape.PPC, tri.getPosition().getY(), 0.001);
assertEquals(35d * IShape.PPC, tri.getWidth(), 0.001);
assertEquals(50d * IShape.PPC, tri.getHeight(), 0.001);
}
Aggregations