Search in sources :

Example 11 with IPoint

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

the class TestIPicture method testGetTopRightPoint.

@Test
public void testGetTopRightPoint() {
    final IPoint pt = shape.getTopRightPoint();
    assertEqualsDouble(shape.getPosition().getX() + shape.getImage().getWidth(), pt.getX());
    assertEqualsDouble(shape.getPosition().getY(), pt.getY());
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 12 with IPoint

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

the class TestIPlot method testGetBottomRightPoint.

@Test
public void testGetBottomRightPoint() {
    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);
    IPoint pt = shape.getBottomRightPoint();
    assertTrue(MathUtils.INST.isValidPt(pt));
    assertEquals(10.0 + 20.0 * IShape.PPC, pt.getX(), 0.0001);
    assertEquals(20.0 - 10.0 * IShape.PPC, pt.getY(), 0.0001);
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) HelperTest(net.sf.latexdraw.HelperTest) Test(org.junit.Test)

Example 13 with IPoint

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

the class TestIPlot 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);
    IPoint pt = shape.getTopRightPoint();
    assertTrue(MathUtils.INST.isValidPt(pt));
    assertEquals(10.0 + 20.0 * IShape.PPC, pt.getX(), 0.0001);
    assertEquals(20.0 - 20.0 * IShape.PPC, pt.getY(), 0.0001);
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) HelperTest(net.sf.latexdraw.HelperTest) Test(org.junit.Test)

Example 14 with IPoint

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

the class TestIPlot 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);
    IPoint pt = shape.getBottomLeftPoint();
    assertTrue(MathUtils.INST.isValidPt(pt));
    assertEquals(10.0 + 10.0 * IShape.PPC, pt.getX(), 0.0001);
    assertEquals(20.0 - 10.0 * IShape.PPC, pt.getY(), 0.0001);
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) HelperTest(net.sf.latexdraw.HelperTest) Test(org.junit.Test)

Example 15 with IPoint

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

the class TestIPoint method testLPointOK.

@Theory
public void testLPointOK(@DoubleData final double x, @DoubleData final double y) {
    final IPoint point = ShapeFactory.INST.createPoint(x, y);
    assertEqualsDouble(x, point.getX());
    assertEqualsDouble(y, point.getY());
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) Theory(org.junit.experimental.theories.Theory)

Aggregations

IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)191 Test (org.junit.Test)45 HelperTest (net.sf.latexdraw.HelperTest)25 Theory (org.junit.experimental.theories.Theory)21 IShape (net.sf.latexdraw.models.interfaces.shape.IShape)15 SVGElement (net.sf.latexdraw.parsers.svg.SVGElement)11 SVGGElement (net.sf.latexdraw.parsers.svg.SVGGElement)11 ShapeFactory (net.sf.latexdraw.models.ShapeFactory)10 ILine (net.sf.latexdraw.models.interfaces.shape.ILine)10 IBezierCurve (net.sf.latexdraw.models.interfaces.shape.IBezierCurve)9 IGroup (net.sf.latexdraw.models.interfaces.shape.IGroup)9 ArrayList (java.util.ArrayList)8 MathUtils (net.sf.latexdraw.models.MathUtils)8 Collections (java.util.Collections)7 IPolygon (net.sf.latexdraw.models.interfaces.shape.IPolygon)7 Arrays (java.util.Arrays)6 Cursor (javafx.scene.Cursor)6 BorderPos (net.sf.latexdraw.models.interfaces.shape.BorderPos)6 IModifiablePointsShape (net.sf.latexdraw.models.interfaces.shape.IModifiablePointsShape)6 Inject (net.sf.latexdraw.util.Inject)6