Search in sources :

Example 21 with ICircle

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

the class TestParsingQdisk method testCoordinatesCm.

@Test
public void testCoordinatesCm() {
    parser("\\qdisk(35cm,20cm){.5cm}");
    ICircle cir = getShapeAt(0);
    assertEquals(35d * IShape.PPC - 0.5 * IShape.PPC, cir.getPosition().getX(), 0.001);
    assertEquals((20d * IShape.PPC - 0.5 * IShape.PPC) * -1d, cir.getPosition().getY(), 0.001);
    assertEquals(0.5 * IShape.PPC * 2d, cir.getWidth(), 0.0000001);
    assertEquals(0.5 * IShape.PPC * 2d, cir.getHeight(), 0.0000001);
}
Also used : ICircle(net.sf.latexdraw.models.interfaces.shape.ICircle) Test(org.junit.Test)

Example 22 with ICircle

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

the class TestParsingPscircle method testUnit.

@Test
public void testUnit() {
    parser("\\psset{unit=4}\\pscircle(2,3cm){5}");
    ICircle cir = getShapeAt(0);
    assertEquals(4d * 2d * IShape.PPC - 5d * IShape.PPC, cir.getX(), 0.0001);
    assertEquals(-3d * IShape.PPC + 5d * IShape.PPC, cir.getY(), 0.0001);
    assertEquals(2d * 5d * IShape.PPC, cir.getWidth(), 0.0001);
}
Also used : ICircle(net.sf.latexdraw.models.interfaces.shape.ICircle) Test(org.junit.Test)

Example 23 with ICircle

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

the class TestParsingPscircle method testNegativeRadius.

@Test
public void testNegativeRadius() {
    parser("\\pscircle(0,0){-1}");
    ICircle cir = getShapeAt(0);
    assertThat(cir.getWidth(), greaterThan(0d));
    assertThat(cir.getHeight(), greaterThan(0d));
}
Also used : ICircle(net.sf.latexdraw.models.interfaces.shape.ICircle) Test(org.junit.Test)

Aggregations

ICircle (net.sf.latexdraw.models.interfaces.shape.ICircle)23 Test (org.junit.Test)20 HelperTest (net.sf.latexdraw.HelperTest)2 Point2D (javafx.geometry.Point2D)1 IAxes (net.sf.latexdraw.models.interfaces.shape.IAxes)1 IBezierCurve (net.sf.latexdraw.models.interfaces.shape.IBezierCurve)1 ICircleArc (net.sf.latexdraw.models.interfaces.shape.ICircleArc)1 IDot (net.sf.latexdraw.models.interfaces.shape.IDot)1 IEllipse (net.sf.latexdraw.models.interfaces.shape.IEllipse)1 IFreehand (net.sf.latexdraw.models.interfaces.shape.IFreehand)1 IGrid (net.sf.latexdraw.models.interfaces.shape.IGrid)1 IPlot (net.sf.latexdraw.models.interfaces.shape.IPlot)1 IPolygon (net.sf.latexdraw.models.interfaces.shape.IPolygon)1 IPolyline (net.sf.latexdraw.models.interfaces.shape.IPolyline)1 IRectangle (net.sf.latexdraw.models.interfaces.shape.IRectangle)1 IRhombus (net.sf.latexdraw.models.interfaces.shape.IRhombus)1 ISquare (net.sf.latexdraw.models.interfaces.shape.ISquare)1 IText (net.sf.latexdraw.models.interfaces.shape.IText)1 ITriangle (net.sf.latexdraw.models.interfaces.shape.ITriangle)1