use of net.sf.latexdraw.models.interfaces.shape.IRectangle 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}");
IGrid grid = getShapeAt(0);
IRectangle rec1 = getShapeAt(1);
IRectangle 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(IShape.PPC, rec2.getPosition().getX(), 0.001);
assertEquals(-(double) IShape.PPC, rec2.getPosition().getY(), 0.001);
}
use of net.sf.latexdraw.models.interfaces.shape.IRectangle in project latexdraw by arnobl.
the class TestParsingPsBegin method testBeginPsPictureWithGridAndShapesComplex.
@Test
public void testBeginPsPictureWithGridAndShapesComplex() {
parser("\\begin{pspicture}(-3,-3)(2,2)\n\\psgrid\n\\psframe(0,0)(2,2)\n\\psframe(1,1)(3,3)\n\\end{pspicture}");
IGrid grid = getShapeAt(0);
IRectangle rec1 = getShapeAt(1);
IRectangle 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(IShape.PPC, rec2.getPosition().getX(), 0.001);
assertEquals(-(double) IShape.PPC, rec2.getPosition().getY(), 0.001);
}
use of net.sf.latexdraw.models.interfaces.shape.IRectangle in project latexdraw by arnobl.
the class TestParsingPsframe method testParse1Coordinates.
@Test
public void testParse1Coordinates() {
parser("\\psframe(35,20)");
final IRectangle rec = getShapeAt(0);
assertEquals(0d, rec.getPosition().getX(), 0.001);
assertEquals(0d, rec.getPosition().getY(), 0.001);
assertEquals(35d * IShape.PPC, rec.getWidth(), 0.001);
assertEquals(20d * IShape.PPC, rec.getHeight(), 0.001);
}
use of net.sf.latexdraw.models.interfaces.shape.IRectangle in project latexdraw by arnobl.
the class TestParsingPsframe method testCoordinatesMm.
@Test
public void testCoordinatesMm() {
parser("\\psframe(0,0)(350mm,200mm)");
final IRectangle rec = getShapeAt(0);
assertEquals(0d, rec.getPosition().getX(), 0.001);
assertEquals(0d, rec.getPosition().getY(), 0.001);
assertEquals(35d * IShape.PPC, rec.getWidth(), 0.001);
assertEquals(20d * IShape.PPC, rec.getHeight(), 0.001);
}
use of net.sf.latexdraw.models.interfaces.shape.IRectangle in project latexdraw by arnobl.
the class TestParsingPsframe method testParse2CoordinatesFloatSigns.
@Test
public void testParse2CoordinatesFloatSigns() {
parser("\\psframe(-+-.5,+--.5)(+++35.5,--50.5)");
final IRectangle rec = getShapeAt(0);
assertEquals(0.5 * IShape.PPC, rec.getPosition().getX(), 0.001);
assertEquals(0.5 * -IShape.PPC, rec.getPosition().getY(), 0.001);
assertEquals(35d * IShape.PPC, rec.getWidth(), 0.001);
assertEquals(50d * IShape.PPC, rec.getHeight(), 0.001);
}
Aggregations