use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestParsingPSRotate method testPSRotationSeveralAngles.
@Test
public void testPSRotationSeveralAngles() {
parser("\\psrotate(1,1){10}{\\psrotate(1,1){30}{\\psframe(2,2)}}\\psframe(2,2)");
assertEquals(2, parsedShapes.size());
final Rectangle rec = getShapeAt(0);
assertEquals(-40d, Math.toDegrees(rec.getRotationAngle()), 0.001);
assertEquals(parsedShapes.get(1).getGravityCentre(), rec.getGravityCentre());
}
use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestParsingPsframe method testParse2CoordinatesTwoLastMissing.
@Test
public void testParse2CoordinatesTwoLastMissing() {
parser("\\psframe(0,0)(,)");
final Rectangle rec = getShapeAt(0);
assertEquals(0d, rec.getPosition().getX(), 0.001);
assertEquals(0d, rec.getPosition().getY(), 0.001);
assertEquals(Shape.PPC, rec.getWidth(), 0.001);
assertEquals(Shape.PPC, rec.getHeight(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Rectangle in project latexdraw by arnobl.
the class TestParsingPsframe method testParamFramearcOK.
@ParameterizedTest
@ValueSource(doubles = { 0d, 1d, 0.5 })
public void testParamFramearcOK(final double arc) {
parser("\\psframe[framearc=" + arc + "](35,20)");
final Rectangle rec = getShapeAt(0);
assertEquals(arc, rec.getLineArc(), 0.00001);
}
use of net.sf.latexdraw.model.api.shape.Rectangle 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}");
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 testCoordinatesInch.
@Test
public void testCoordinatesInch() {
parser("\\psframe(0,0)(35in,20in)");
final Rectangle rec = getShapeAt(0);
assertEquals(0d, rec.getPosition().getX(), 0.001);
assertEquals(0d, rec.getPosition().getY(), 0.001);
assertEquals(35d * Shape.PPC / 2.54, rec.getWidth(), 0.001);
assertEquals(20d * Shape.PPC / 2.54, rec.getHeight(), 0.001);
}
Aggregations