Search in sources :

Example 26 with IRectangle

use of net.sf.latexdraw.models.interfaces.shape.IRectangle in project latexdraw by arnobl.

the class TestPSTGeneralFeatures method testPssetlinewidth.

@Test
public void testPssetlinewidth() {
    parser("\\psset{linewidth=2cm}\\psframe(10,10)");
    IRectangle rec = getShapeAt(0);
    assertEquals(2d * IShape.PPC, rec.getThickness(), 0.0001);
}
Also used : IRectangle(net.sf.latexdraw.models.interfaces.shape.IRectangle) Test(org.junit.Test)

Example 27 with IRectangle

use of net.sf.latexdraw.models.interfaces.shape.IRectangle in project latexdraw by arnobl.

the class TestParsingRPut method testDoubleRputRotationMustNotRotateOtherShapes.

@Test
public void testDoubleRputRotationMustNotRotateOtherShapes() {
    parser("\\rput{10}(0,0){\\rput{80}(0,0){coucou}}\\psframe(10,10)");
    final IText txt = getShapeAt(0);
    final IRectangle rec = getShapeAt(1);
    assertEquals(Math.toRadians(-90), txt.getRotationAngle(), 0.001);
    assertEquals(0d, rec.getRotationAngle(), 0.001);
}
Also used : IText(net.sf.latexdraw.models.interfaces.shape.IText) IRectangle(net.sf.latexdraw.models.interfaces.shape.IRectangle) Test(org.junit.Test)

Example 28 with IRectangle

use of net.sf.latexdraw.models.interfaces.shape.IRectangle 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");
    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);
}
Also used : IGrid(net.sf.latexdraw.models.interfaces.shape.IGrid) IRectangle(net.sf.latexdraw.models.interfaces.shape.IRectangle) Test(org.junit.Test)

Example 29 with IRectangle

use of net.sf.latexdraw.models.interfaces.shape.IRectangle in project latexdraw by arnobl.

the class TestParsingPsBegin method testPspictureWithGridAndShapesComplex.

@Test
public void testPspictureWithGridAndShapesComplex() {
    parser("\\pspicture(-3,-3)(2,2)\n\\psgrid\n\\psframe(0,0)(2,2)\n\\psframe(1,1)(3,3)\n\\endpspicture");
    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);
}
Also used : IGrid(net.sf.latexdraw.models.interfaces.shape.IGrid) IRectangle(net.sf.latexdraw.models.interfaces.shape.IRectangle) Test(org.junit.Test)

Example 30 with IRectangle

use of net.sf.latexdraw.models.interfaces.shape.IRectangle in project latexdraw by arnobl.

the class TestParsingPsframe method testParse2CoordinatesIntOppositeX.

@Test
public void testParse2CoordinatesIntOppositeX() {
    parser("\\psframe(35,20)(10,50)");
    final IRectangle rec = getShapeAt(0);
    assertEquals(10d * IShape.PPC, rec.getPosition().getX(), 0.001);
    assertEquals(20d * -IShape.PPC, rec.getPosition().getY(), 0.001);
    assertEquals(25d * IShape.PPC, rec.getWidth(), 0.001);
    assertEquals(30d * IShape.PPC, rec.getHeight(), 0.001);
}
Also used : IRectangle(net.sf.latexdraw.models.interfaces.shape.IRectangle) Test(org.junit.Test)

Aggregations

IRectangle (net.sf.latexdraw.models.interfaces.shape.IRectangle)39 Test (org.junit.Test)33 HelperTest (net.sf.latexdraw.HelperTest)5 IGrid (net.sf.latexdraw.models.interfaces.shape.IGrid)5 ICircle (net.sf.latexdraw.models.interfaces.shape.ICircle)2 IDot (net.sf.latexdraw.models.interfaces.shape.IDot)2 IEllipse (net.sf.latexdraw.models.interfaces.shape.IEllipse)2 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)2 IText (net.sf.latexdraw.models.interfaces.shape.IText)2 Theory (org.junit.experimental.theories.Theory)2 Point2D (javafx.geometry.Point2D)1 ILineArcProp (net.sf.latexdraw.models.interfaces.prop.ILineArcProp)1 IAxes (net.sf.latexdraw.models.interfaces.shape.IAxes)1 IBezierCurve (net.sf.latexdraw.models.interfaces.shape.IBezierCurve)1 ICircleArc (net.sf.latexdraw.models.interfaces.shape.ICircleArc)1 IFreehand (net.sf.latexdraw.models.interfaces.shape.IFreehand)1 IPlot (net.sf.latexdraw.models.interfaces.shape.IPlot)1 IPolygon (net.sf.latexdraw.models.interfaces.shape.IPolygon)1 IPolyline (net.sf.latexdraw.models.interfaces.shape.IPolyline)1 IPositionShape (net.sf.latexdraw.models.interfaces.shape.IPositionShape)1