Search in sources :

Example 1 with Ellipse

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

the class TestParsingPsellipse method testParse1Coordinates.

@Test
public void testParse1Coordinates() {
    parser("\\psellipse(35,20)");
    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)

Example 2 with Ellipse

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

the class TestParsingPsellipse method testParse2CoordinatesTwoFirstMissing.

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

Example 3 with Ellipse

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

the class TestParsingPsellipse method testCoordinatesInch.

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

Example 4 with Ellipse

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

the class TestParsingPsellipse method testCoordinatesPt.

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

Example 5 with Ellipse

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

the class TestParsingPsellipse method testParse2CoordinatesFloatSigns.

@Test
public void testParse2CoordinatesFloatSigns() {
    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)

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