Search in sources :

Example 11 with IFreehand

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

Example 12 with IFreehand

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

Example 13 with IFreehand

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

Example 14 with IFreehand

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());
}
Also used : IFreehand(net.sf.latexdraw.models.interfaces.shape.IFreehand) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Aggregations

IFreehand (net.sf.latexdraw.models.interfaces.shape.IFreehand)14 Test (org.junit.Test)7 Point2D (javafx.geometry.Point2D)3 IBezierCurve (net.sf.latexdraw.models.interfaces.shape.IBezierCurve)2 IGroup (net.sf.latexdraw.models.interfaces.shape.IGroup)2 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)2 IPolygon (net.sf.latexdraw.models.interfaces.shape.IPolygon)2 IPolyline (net.sf.latexdraw.models.interfaces.shape.IPolyline)2 IShape (net.sf.latexdraw.models.interfaces.shape.IShape)2 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 Function (java.util.function.Function)1 Platform (javafx.application.Platform)1 ObjectProperty (javafx.beans.property.ObjectProperty)1 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)1 Point3D (javafx.geometry.Point3D)1 Cursor (javafx.scene.Cursor)1 MouseButton (javafx.scene.input.MouseButton)1 FileChooser (javafx.stage.FileChooser)1