Search in sources :

Example 56 with Point

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

the class TestText method testMirrorVertical.

@Test
public void testMirrorVertical() {
    final Point pos = ShapeFactory.INST.createPoint(shape.getPosition());
    shape.mirrorVertical(shape.getGravityCentre().getY());
    assertEquals(pos, shape.getPosition());
}
Also used : Point(net.sf.latexdraw.model.api.shape.Point) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 57 with Point

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

the class TestText method testMirrorHorizontal.

@Test
public void testMirrorHorizontal() {
    final Point pos = ShapeFactory.INST.createPoint(shape.getPosition());
    shape.mirrorHorizontal(shape.getGravityCentre().getX());
    assertEquals(pos, shape.getPosition());
}
Also used : Point(net.sf.latexdraw.model.api.shape.Point) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 58 with Point

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

the class TestPlot method testGetBottomLeftPoint.

@Test
public void testGetBottomLeftPoint() {
    shape.setPlotEquation("x");
    shape.setPlotMaxX(20.0);
    shape.setPlotMinX(10.0);
    shape.setXScale(1.0);
    shape.setYScale(1.0);
    shape.setNbPlottedPoints(30);
    shape.setPosition(10.0, 20.0);
    final Point pt = shape.getBottomLeftPoint();
    assertTrue(MathUtils.INST.isValidPt(pt));
    assertEquals(10.0 + 10.0 * Shape.PPC, pt.getX(), 0.0001);
    assertEquals(20.0 - 10.0 * Shape.PPC, pt.getY(), 0.0001);
}
Also used : Point(net.sf.latexdraw.model.api.shape.Point) HelperTest(net.sf.latexdraw.HelperTest) Test(org.junit.Test)

Example 59 with Point

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

the class TestPlot method testGetTopRightPoint.

@Test
public void testGetTopRightPoint() {
    shape.setPlotEquation("x");
    shape.setPlotMaxX(20.0);
    shape.setPlotMinX(10.0);
    shape.setXScale(1.0);
    shape.setYScale(1.0);
    shape.setNbPlottedPoints(30);
    shape.setPosition(10.0, 20.0);
    final Point pt = shape.getTopRightPoint();
    assertTrue(MathUtils.INST.isValidPt(pt));
    assertEquals(10.0 + 20.0 * Shape.PPC, pt.getX(), 0.0001);
    assertEquals(20.0 - 20.0 * Shape.PPC, pt.getY(), 0.0001);
}
Also used : Point(net.sf.latexdraw.model.api.shape.Point) HelperTest(net.sf.latexdraw.HelperTest) Test(org.junit.Test)

Example 60 with Point

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

the class TestPlot method testGetTopLeftPoint.

@Test
public void testGetTopLeftPoint() {
    shape.setPlotEquation("x");
    shape.setPlotMaxX(20.0);
    shape.setPlotMinX(10.0);
    shape.setXScale(1.0);
    shape.setYScale(1.0);
    shape.setNbPlottedPoints(30);
    shape.setPosition(10.0, 20.0);
    final Point pt = shape.getTopLeftPoint();
    assertTrue(MathUtils.INST.isValidPt(pt));
    assertEquals(10.0 + 10.0 * Shape.PPC, pt.getX(), 0.0001);
    assertEquals(20.0 - 20.0 * Shape.PPC, pt.getY(), 0.0001);
}
Also used : Point(net.sf.latexdraw.model.api.shape.Point) HelperTest(net.sf.latexdraw.HelperTest) Test(org.junit.Test)

Aggregations

Point (net.sf.latexdraw.model.api.shape.Point)139 Test (org.junit.Test)52 HelperTest (net.sf.latexdraw.HelperTest)27 Theory (org.junit.experimental.theories.Theory)23 NotNull (org.jetbrains.annotations.NotNull)19 Line (net.sf.latexdraw.model.api.shape.Line)10 Shape (net.sf.latexdraw.model.api.shape.Shape)9 SVGElement (net.sf.latexdraw.parser.svg.SVGElement)9 SVGGElement (net.sf.latexdraw.parser.svg.SVGGElement)9 Test (org.junit.jupiter.api.Test)8 ArrayList (java.util.ArrayList)7 Polyline (net.sf.latexdraw.model.api.shape.Polyline)5 Color (javafx.scene.paint.Color)4 MathUtils (net.sf.latexdraw.model.MathUtils)4 ShapeFactory (net.sf.latexdraw.model.ShapeFactory)4 BezierCurve (net.sf.latexdraw.model.api.shape.BezierCurve)4 Canvas (net.sf.latexdraw.view.jfx.Canvas)4 Point2D (java.awt.geom.Point2D)3 List (java.util.List)3 ShapeData (net.sf.latexdraw.data.ShapeData)3