use of net.sf.latexdraw.model.api.shape.Triangle in project latexdraw by arnobl.
the class TestParsingPstriangle method testParse2CoordinatesFloat.
@Test
public void testParse2CoordinatesFloat() {
parser("\\pstriangle(10.5,20.5)(35.5,50.5)");
final Triangle tri = getShapeAt(0);
assertEquals(10.5 * Shape.PPC - 35.5 / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
assertEquals(20.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 testParse2CoordinatesFloatSigns.
@Test
public void testParse2CoordinatesFloatSigns() {
parser("\\pstriangle(-+-.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 testCoordinatesCm.
@Test
public void testCoordinatesCm() {
parser("\\pstriangle(0,0)(35cm,20cm)");
final Triangle tri = getShapeAt(0);
assertEquals(-35d / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
assertEquals(0d, tri.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC, tri.getWidth(), 0.001);
assertEquals(20d * Shape.PPC, tri.getHeight(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Triangle in project latexdraw by arnobl.
the class TestParsingPstriangle method testParse2WidthHeight0.
@Test
public void testParse2WidthHeight0() {
parser("\\pstriangle(0,0)(0,0)");
final Triangle tri = getShapeAt(0);
assertThat(tri.getWidth()).isGreaterThan(0d);
assertThat(tri.getHeight()).isGreaterThan(0d);
}
use of net.sf.latexdraw.model.api.shape.Triangle in project latexdraw by arnobl.
the class TestParsingPstriangle method testParse2CoordinatesFloatSigns2.
@Test
public void testParse2CoordinatesFloatSigns2() {
parser("\\pstriangle(-+.5,+-5)(+++35.5,--50.5)");
final Triangle tri = getShapeAt(0);
assertEquals(-.5 * Shape.PPC - 35.5 / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
assertEquals(-5d * -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);
}
Aggregations