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