Search in sources :

Example 16 with Ellipse

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

the class TestParsingPsellipse method testParse2CoordinatesFloatSigns2.

@Test
public void testParse2CoordinatesFloatSigns2() {
    parser("\\psellipse(-+.5,+-5)(+++35.5,--50.5)");
    final Ellipse ell = getShapeAt(0);
    assertEquals(-.5 * Shape.PPC - 35.5 * Shape.PPC, ell.getPosition().getX(), 0.001);
    assertEquals(-5d * -Shape.PPC + 50.5 * Shape.PPC, ell.getPosition().getY(), 0.001);
    assertEquals(35.5 * Shape.PPC * 2d, ell.getWidth(), 0.001);
    assertEquals(50.5 * Shape.PPC * 2d, ell.getHeight(), 0.001);
}
Also used : Ellipse(net.sf.latexdraw.model.api.shape.Ellipse) Test(org.junit.jupiter.api.Test)

Example 17 with Ellipse

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

the class TestParsingPsellipse method testParse2WidthHeight0.

@Test
public void testParse2WidthHeight0() {
    parser("\\psellipse(0,0)(0,0)");
    final Ellipse ell = getShapeAt(0);
    assertTrue(ell.getWidth() > 0);
    assertTrue(ell.getHeight() > 0);
}
Also used : Ellipse(net.sf.latexdraw.model.api.shape.Ellipse) Test(org.junit.jupiter.api.Test)

Example 18 with Ellipse

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

the class TestParsingPsellipse method testParse2CoordinatesFloat2.

@Test
public void testParse2CoordinatesFloat2() {
    parser("\\psellipse(.5,.5)(35.5,50.5)");
    final Ellipse ell = getShapeAt(0);
    assertEquals(.5 * Shape.PPC - 35.5 * Shape.PPC, ell.getPosition().getX(), 0.001);
    assertEquals(.5 * -Shape.PPC + 50.5 * Shape.PPC, ell.getPosition().getY(), 0.001);
    assertEquals(35.5 * Shape.PPC * 2d, ell.getWidth(), 0.001);
    assertEquals(50.5 * Shape.PPC * 2d, ell.getHeight(), 0.001);
}
Also used : Ellipse(net.sf.latexdraw.model.api.shape.Ellipse) Test(org.junit.jupiter.api.Test)

Example 19 with Ellipse

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

the class TestParsingPsellipse method testParse2CoordinatesFloat.

@Test
public void testParse2CoordinatesFloat() {
    parser("\\psellipse(10.5,20.5)(35.5,50.5)");
    final Ellipse ell = getShapeAt(0);
    assertEquals(10.5 * Shape.PPC - 35.5 * Shape.PPC, ell.getPosition().getX(), 0.001);
    assertEquals(20.5 * -Shape.PPC + 50.5 * Shape.PPC, ell.getPosition().getY(), 0.001);
    assertEquals(35.5 * Shape.PPC * 2d, ell.getWidth(), 0.001);
    assertEquals(50.5 * Shape.PPC * 2d, ell.getHeight(), 0.001);
}
Also used : Ellipse(net.sf.latexdraw.model.api.shape.Ellipse) Test(org.junit.jupiter.api.Test)

Example 20 with Ellipse

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

the class TestParsingPsellipse method testCoordinatesCm.

@Test
public void testCoordinatesCm() {
    parser("\\psellipse(0,0)(35cm,20cm)");
    final Ellipse ell = getShapeAt(0);
    assertEquals(-35d * Shape.PPC, ell.getPosition().getX(), 0.001);
    assertEquals(-20d * Shape.PPC * -1d, ell.getPosition().getY(), 0.001);
    assertEquals(35d * Shape.PPC * 2d, ell.getWidth(), 0.001);
    assertEquals(20d * Shape.PPC * 2d, ell.getHeight(), 0.001);
}
Also used : Ellipse(net.sf.latexdraw.model.api.shape.Ellipse) Test(org.junit.jupiter.api.Test)

Aggregations

Ellipse (net.sf.latexdraw.model.api.shape.Ellipse)20 Test (org.junit.jupiter.api.Test)14 Test (org.junit.Test)4 HelperTest (net.sf.latexdraw.HelperTest)3 Circle (net.sf.latexdraw.model.api.shape.Circle)2 Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)2 Point2D (javafx.geometry.Point2D)1 Axes (net.sf.latexdraw.model.api.shape.Axes)1 BezierCurve (net.sf.latexdraw.model.api.shape.BezierCurve)1 CircleArc (net.sf.latexdraw.model.api.shape.CircleArc)1 Dot (net.sf.latexdraw.model.api.shape.Dot)1 Freehand (net.sf.latexdraw.model.api.shape.Freehand)1 Grid (net.sf.latexdraw.model.api.shape.Grid)1 Plot (net.sf.latexdraw.model.api.shape.Plot)1 Polygon (net.sf.latexdraw.model.api.shape.Polygon)1 Polyline (net.sf.latexdraw.model.api.shape.Polyline)1 PositionShape (net.sf.latexdraw.model.api.shape.PositionShape)1 RectangularShape (net.sf.latexdraw.model.api.shape.RectangularShape)1 Rhombus (net.sf.latexdraw.model.api.shape.Rhombus)1 Shape (net.sf.latexdraw.model.api.shape.Shape)1