Search in sources :

Example 11 with Rhombus

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

the class TestParsingPsdiamond method testParse2CoordinatesTwoFirstMissing.

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

Example 12 with Rhombus

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

the class TestParsingPsdiamond method testParse2CoordinatesInt.

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

Example 13 with Rhombus

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

the class TestParsingPsdiamond method testParse2WidthHeight0.

@Test
public void testParse2WidthHeight0() {
    parser("\\psdiamond(0,0)(0,0)");
    final Rhombus rh = getShapeAt(0);
    assertThat(rh.getWidth()).isPositive();
    assertThat(rh.getHeight()).isPositive();
}
Also used : Rhombus(net.sf.latexdraw.model.api.shape.Rhombus) Test(org.junit.jupiter.api.Test)

Example 14 with Rhombus

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

the class TestParsingPsdiamond method testCoordinatesInch.

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

Example 15 with Rhombus

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

the class TestParsingPsdiamond method testParse2CoordinatesFloatSigns2.

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

Aggregations

Rhombus (net.sf.latexdraw.model.api.shape.Rhombus)18 Test (org.junit.jupiter.api.Test)14 HelperTest (net.sf.latexdraw.HelperTest)3 Test (org.junit.Test)3 Circle (net.sf.latexdraw.model.api.shape.Circle)2 Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)2 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 PositionShape (net.sf.latexdraw.model.api.shape.PositionShape)1 RectangularShape (net.sf.latexdraw.model.api.shape.RectangularShape)1 Shape (net.sf.latexdraw.model.api.shape.Shape)1 Square (net.sf.latexdraw.model.api.shape.Square)1