use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestParsingPsBegin method testBeginPsPictureWithGridAndShapesBasic.
@Test
public void testBeginPsPictureWithGridAndShapesBasic() {
parser("\\begin{pspicture}(0,0)(2,2)\n\\psgrid\n\\psframe(0,0)(2,2)\n\\psframe(1,1)(3,3)\n\\end{pspicture}");
final Grid grid = getShapeAt(0);
final Rectangle rec1 = getShapeAt(1);
final Rectangle rec2 = getShapeAt(2);
assertEquals(0d, grid.getPosition().getX(), 0.001);
assertEquals(0d, grid.getPosition().getY(), 0.001);
assertEquals(0d, rec1.getPosition().getX(), 0.001);
assertEquals(0d, rec1.getPosition().getY(), 0.001);
assertEquals(Shape.PPC, rec2.getPosition().getX(), 0.001);
assertEquals(-(double) Shape.PPC, rec2.getPosition().getY(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestParsingPsBegin method testPspictureWithGridAndShapesBasic.
@Test
public void testPspictureWithGridAndShapesBasic() {
parser("\\pspicture(0,0)(2,2)\n\\psgrid\n\\psframe(0,0)(2,2)\n\\psframe(1,1)(3,3)\n\\endpspicture");
final Grid grid = getShapeAt(0);
final Rectangle rec1 = getShapeAt(1);
final Rectangle rec2 = getShapeAt(2);
assertEquals(0d, grid.getPosition().getX(), 0.001);
assertEquals(0d, grid.getPosition().getY(), 0.001);
assertEquals(0d, rec1.getPosition().getX(), 0.001);
assertEquals(0d, rec1.getPosition().getY(), 0.001);
assertEquals(Shape.PPC, rec2.getPosition().getX(), 0.001);
assertEquals(-(double) Shape.PPC, rec2.getPosition().getY(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestParsingPsframe method testParse2CoordinatesIntOppositeAll.
@Test
public void testParse2CoordinatesIntOppositeAll() {
parser("\\psframe(35,50)(10,20)");
final Rectangle rec = getShapeAt(0);
assertEquals(10d * Shape.PPC, rec.getPosition().getX(), 0.001);
assertEquals(20d * -Shape.PPC, rec.getPosition().getY(), 0.001);
assertEquals(25d * Shape.PPC, rec.getWidth(), 0.001);
assertEquals(30d * Shape.PPC, rec.getHeight(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestParsingPsframe method testCoordinatesCm.
@Test
public void testCoordinatesCm() {
parser("\\psframe(0,0)(35cm,20cm)");
final Rectangle rec = getShapeAt(0);
assertEquals(0d, rec.getPosition().getX(), 0.001);
assertEquals(0d, rec.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC, rec.getWidth(), 0.001);
assertEquals(20d * Shape.PPC, rec.getHeight(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestParsingPsframe method testParse1Coordinates.
@Test
public void testParse1Coordinates() {
parser("\\psframe(35,20)");
final Rectangle rec = getShapeAt(0);
assertEquals(0d, rec.getPosition().getX(), 0.001);
assertEquals(0d, rec.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC, rec.getWidth(), 0.001);
assertEquals(20d * Shape.PPC, rec.getHeight(), 0.001);
}
Aggregations