Search in sources :

Example 16 with Circle

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

the class TestParsingPscircle method testCoordinatesPt.

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

Example 17 with Circle

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

the class TestParsingPscircle method testCoordinatesCm.

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

Example 18 with Circle

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

the class TestParsingPscircle method testCoordinatesMissing.

@Test
public void testCoordinatesMissing() {
    parser("\\pscircle(,){1}");
    final Circle cir = getShapeAt(0);
    assertEquals(Shape.PPC - 1d * Shape.PPC, cir.getPosition().getX(), 0.0000001);
    assertEquals((Shape.PPC - 1d * Shape.PPC) * -1d, cir.getPosition().getY(), 0.0000001);
    assertEquals(1d * Shape.PPC * 2d, cir.getWidth(), 0.0000001);
    assertEquals(1d * Shape.PPC * 2d, cir.getHeight(), 0.0000001);
}
Also used : Circle(net.sf.latexdraw.model.api.shape.Circle) Test(org.junit.jupiter.api.Test)

Example 19 with Circle

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

the class TestParsingPscircle method testCoordinatesInch.

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

Example 20 with Circle

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

the class TestParsingPscircle method testNegativeRadius.

@Test
public void testNegativeRadius() {
    parser("\\pscircle(0,0){-1}");
    final Circle cir = getShapeAt(0);
    assertThat(cir.getWidth()).isPositive();
    assertThat(cir.getHeight()).isPositive();
}
Also used : Circle(net.sf.latexdraw.model.api.shape.Circle) Test(org.junit.jupiter.api.Test)

Aggregations

Circle (net.sf.latexdraw.model.api.shape.Circle)21 Test (org.junit.jupiter.api.Test)17 Test (org.junit.Test)3 HelperTest (net.sf.latexdraw.HelperTest)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 Ellipse (net.sf.latexdraw.model.api.shape.Ellipse)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 Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)1 Rhombus (net.sf.latexdraw.model.api.shape.Rhombus)1 Square (net.sf.latexdraw.model.api.shape.Square)1 Text (net.sf.latexdraw.model.api.shape.Text)1 Triangle (net.sf.latexdraw.model.api.shape.Triangle)1