use of net.sf.latexdraw.models.interfaces.shape.IFreehand in project latexdraw by arnobl.
the class TestParsingPscustom method testPsCustomMovetoCurvetoLineTo.
@Test
public void testPsCustomMovetoCurvetoLineTo() {
parser("\\pscustom{\\moveto(1,2)\\curveto(3.1,4.1)(3.2,4.3)(3,4)\\lineto(5,6)}");
assertEquals(1, listener.getShapes().size());
IFreehand fh = getShapeAt(0);
assertEquals(3, fh.getNbPoints());
assertEquals(1d * IShape.PPC, fh.getPtAt(0).getX(), 0.001);
assertEquals(-2d * IShape.PPC, fh.getPtAt(0).getY(), 0.001);
assertEquals(3d * IShape.PPC, fh.getPtAt(1).getX(), 0.001);
assertEquals(-4d * IShape.PPC, fh.getPtAt(1).getY(), 0.001);
assertEquals(5d * IShape.PPC, fh.getPtAt(2).getX(), 0.001);
assertEquals(-6d * IShape.PPC, fh.getPtAt(2).getY(), 0.001);
assertEquals(FreeHandStyle.LINES, fh.getType());
}
use of net.sf.latexdraw.models.interfaces.shape.IFreehand in project latexdraw by arnobl.
the class TestParsingPscustom method testPsCustomMovetoCurveto.
@Test
public void testPsCustomMovetoCurveto() {
parser("\\pscustom[linewidth=10cm]{\\moveto(1,2)\\curveto(3.1,4.1)(3.2,4.3)(3,4)}");
IFreehand fh = getShapeAt(0);
assertEquals(2, fh.getNbPoints());
assertEquals(1d * IShape.PPC, fh.getPtAt(0).getX(), 0.001);
assertEquals(-2d * IShape.PPC, fh.getPtAt(0).getY(), 0.001);
assertEquals(3d * IShape.PPC, fh.getPtAt(1).getX(), 0.001);
assertEquals(-4d * IShape.PPC, fh.getPtAt(1).getY(), 0.001);
assertEquals(FreeHandStyle.CURVES, fh.getType());
}
use of net.sf.latexdraw.models.interfaces.shape.IFreehand in project latexdraw by arnobl.
the class TestParsingPscustom method testPsCustomMovetoLineto.
@Test
public void testPsCustomMovetoLineto() {
parser("\\pscustom[linewidth=10cm]{\\moveto(1,2)\\lineto(3,4)}");
IFreehand fh = getShapeAt(0);
assertEquals(2, fh.getNbPoints());
assertEquals(1d * IShape.PPC, fh.getPtAt(0).getX(), 0.001);
assertEquals(-2d * IShape.PPC, fh.getPtAt(0).getY(), 0.001);
assertEquals(3d * IShape.PPC, fh.getPtAt(1).getX(), 0.001);
assertEquals(-4d * IShape.PPC, fh.getPtAt(1).getY(), 0.001);
assertEquals(FreeHandStyle.LINES, fh.getType());
}
use of net.sf.latexdraw.models.interfaces.shape.IFreehand in project latexdraw by arnobl.
the class TestIFreehand method testDuplicate.
@Test
public void testDuplicate() {
shape.setOpened(!shape.isOpened());
shape.setInterval(shape.getInterval() * 2);
shape.setType(FreeHandStyle.LINES);
final IFreehand dup = shape.duplicate();
assertEquals(shape.isOpened(), dup.isOpened());
assertEquals(shape.getInterval(), dup.getInterval());
assertEquals(FreeHandStyle.LINES, dup.getType());
}
Aggregations