use of net.sf.latexdraw.model.api.shape.Rhombus in project latexdraw by arnobl.
the class TestParsingPsdiamond method testParse2CoordinatesTwoFirstMissing.
@Test
public void testParse2CoordinatesTwoFirstMissing() {
parser("\\psdiamond(,)(35,50)");
final Rhombus rh = getShapeAt(0);
assertEquals(Shape.PPC - 35 * Shape.PPC, rh.getPosition().getX(), 0.001);
assertEquals(-Shape.PPC + 50d * Shape.PPC, rh.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC * 2d, rh.getWidth(), 0.001);
assertEquals(50d * Shape.PPC * 2d, rh.getHeight(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Rhombus in project latexdraw by arnobl.
the class TestParsingPsdiamond method testParse2CoordinatesInt.
@Test
public void testParse2CoordinatesInt() {
parser("\\psdiamond(10,20)(35,50)");
final Rhombus rh = getShapeAt(0);
assertEquals(10d * Shape.PPC - 35d * Shape.PPC, rh.getPosition().getX(), 0.001);
assertEquals(20d * -Shape.PPC + 50d * Shape.PPC, rh.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC * 2d, rh.getWidth(), 0.001);
assertEquals(50d * Shape.PPC * 2d, rh.getHeight(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Rhombus in project latexdraw by arnobl.
the class TestParsingPsdiamond method testParse2WidthHeight0.
@Test
public void testParse2WidthHeight0() {
parser("\\psdiamond(0,0)(0,0)");
final Rhombus rh = getShapeAt(0);
assertThat(rh.getWidth()).isPositive();
assertThat(rh.getHeight()).isPositive();
}
use of net.sf.latexdraw.model.api.shape.Rhombus in project latexdraw by arnobl.
the class TestParsingPsdiamond method testCoordinatesInch.
@Test
public void testCoordinatesInch() {
parser("\\psdiamond(0,0)(35in,20in)");
final Rhombus rh = getShapeAt(0);
assertEquals(-35d * Shape.PPC / 2.54, rh.getPosition().getX(), 0.001);
assertEquals(-20d * Shape.PPC / 2.54 * -1d, rh.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC / 2.54 * 2d, rh.getWidth(), 0.001);
assertEquals(20d * Shape.PPC / 2.54 * 2d, rh.getHeight(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Rhombus in project latexdraw by arnobl.
the class TestParsingPsdiamond method testParse2CoordinatesFloatSigns2.
@Test
public void testParse2CoordinatesFloatSigns2() {
parser("\\psdiamond(-+.5,+-5)(+++35.5,--50.5)");
final Rhombus rh = getShapeAt(0);
assertEquals(-.5 * Shape.PPC - 35.5 * Shape.PPC, rh.getPosition().getX(), 0.001);
assertEquals(-5d * -Shape.PPC + 50.5 * Shape.PPC, rh.getPosition().getY(), 0.001);
assertEquals(35.5 * Shape.PPC * 2d, rh.getWidth(), 0.001);
assertEquals(50.5 * Shape.PPC * 2d, rh.getHeight(), 0.001);
}
Aggregations