Search in sources :

Example 6 with BezierCurve

use of net.sf.latexdraw.model.api.shape.BezierCurve in project latexdraw by arnobl.

the class TestParsingPSbezier method testParamBarInSqureBracket.

@Test
public void testParamBarInSqureBracket() {
    parser("\\psbezier{|-]}(1,2)(3,4)(5,6)(7,8)");
    final BezierCurve bc = getShapeAt(0);
    assertEquals(ArrowStyle.BAR_IN, bc.getArrowStyle(0));
    assertEquals(ArrowStyle.RIGHT_SQUARE_BRACKET, bc.getArrowStyle(1));
}
Also used : BezierCurve(net.sf.latexdraw.model.api.shape.BezierCurve) Test(org.junit.jupiter.api.Test)

Example 7 with BezierCurve

use of net.sf.latexdraw.model.api.shape.BezierCurve in project latexdraw by arnobl.

the class TestParsingPSbezier method testParse6Coordinates.

@Test
public void testParse6Coordinates() {
    parser("\\psbezier(1,2)(3,4)(5,6)(7,8)(9,10)(11,12)");
    final BezierCurve bc = getShapeAt(0);
    assertEquals(3, bc.getNbPoints());
    assertEquals(0d, bc.getPtAt(0).getX(), 0.0001);
    assertEquals(0d, bc.getPtAt(0).getY(), 0.0001);
    assertEquals(5d * Shape.PPC, bc.getPtAt(1).getX(), 0.0001);
    assertEquals(-6d * Shape.PPC, bc.getPtAt(1).getY(), 0.0001);
    assertEquals(11d * Shape.PPC, bc.getPtAt(2).getX(), 0.0001);
    assertEquals(-12d * Shape.PPC, bc.getPtAt(2).getY(), 0.0001);
    assertEquals(-1d * Shape.PPC, bc.getSecondCtrlPtAt(0).getX(), 0.0001);
    assertEquals(2d * Shape.PPC, bc.getSecondCtrlPtAt(0).getY(), 0.0001);
    assertEquals(7d * Shape.PPC, bc.getSecondCtrlPtAt(1).getX(), 0.0001);
    assertEquals(-8d * Shape.PPC, bc.getSecondCtrlPtAt(1).getY(), 0.0001);
    assertEquals(3d * Shape.PPC, bc.getFirstCtrlPtAt(1).getX(), 0.0001);
    assertEquals(-4d * Shape.PPC, bc.getFirstCtrlPtAt(1).getY(), 0.0001);
    assertEquals(9d * Shape.PPC, bc.getFirstCtrlPtAt(2).getX(), 0.0001);
    assertEquals(-10d * Shape.PPC, bc.getFirstCtrlPtAt(2).getY(), 0.0001);
}
Also used : BezierCurve(net.sf.latexdraw.model.api.shape.BezierCurve) Test(org.junit.jupiter.api.Test)

Example 8 with BezierCurve

use of net.sf.latexdraw.model.api.shape.BezierCurve in project latexdraw by arnobl.

the class TestParsingPSbezier method testShowPoints.

@Test
public void testShowPoints() {
    parser("\\psbezier[showpoints=true](5,10)(1,2)(3,4)(5,6)");
    final BezierCurve bc = getShapeAt(0);
    assertTrue(bc.isShowPts());
}
Also used : BezierCurve(net.sf.latexdraw.model.api.shape.BezierCurve) Test(org.junit.jupiter.api.Test)

Example 9 with BezierCurve

use of net.sf.latexdraw.model.api.shape.BezierCurve in project latexdraw by arnobl.

the class TestBezierCurve method testCopy.

@Test
public void testCopy() {
    final BezierCurve sh2 = ShapeFactory.INST.createBezierCurve(Collections.emptyList());
    shape.setOpened(sh2.isOpened());
    sh2.setOpened(!sh2.isOpened());
    shape.copy(sh2);
    assertEquals(shape.isOpened(), sh2.isOpened());
}
Also used : BezierCurve(net.sf.latexdraw.model.api.shape.BezierCurve) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 10 with BezierCurve

use of net.sf.latexdraw.model.api.shape.BezierCurve in project latexdraw by arnobl.

the class TestBezierCurve method testDuplicate.

@Test
public void testDuplicate() {
    shape.setOpened(!shape.isOpened());
    final BezierCurve dup = shape.duplicate();
    assertEquals(shape.isOpened(), dup.isOpened());
}
Also used : BezierCurve(net.sf.latexdraw.model.api.shape.BezierCurve) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Aggregations

BezierCurve (net.sf.latexdraw.model.api.shape.BezierCurve)26 Test (org.junit.jupiter.api.Test)16 HelperTest (net.sf.latexdraw.HelperTest)6 Point (net.sf.latexdraw.model.api.shape.Point)4 Test (org.junit.Test)4 Polygon (net.sf.latexdraw.model.api.shape.Polygon)3 ArrayList (java.util.ArrayList)2 Freehand (net.sf.latexdraw.model.api.shape.Freehand)2 Polyline (net.sf.latexdraw.model.api.shape.Polyline)2 Shape (net.sf.latexdraw.model.api.shape.Shape)2 NotNull (org.jetbrains.annotations.NotNull)2 Click (io.github.interacto.jfx.interaction.library.Click)1 DnD (io.github.interacto.jfx.interaction.library.DnD)1 MultiClick (io.github.interacto.jfx.interaction.library.MultiClick)1 PointsData (io.github.interacto.jfx.interaction.library.PointsData)1 Press (io.github.interacto.jfx.interaction.library.Press)1 Point2D (java.awt.geom.Point2D)1 Arrays (java.util.Arrays)1 Objects (java.util.Objects)1 Function (java.util.function.Function)1