Search in sources :

Example 1 with Rhombus

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

the class TestParsingPsdiamond method testCoordinatesCm.

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

Example 2 with Rhombus

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

the class TestParsingPsdiamond method testParse2CoordinatesFloatSigns.

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

Example 3 with Rhombus

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

the class TestParsingPsdiamond method testCoordinatesMm.

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

Example 4 with Rhombus

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

the class TestParsingPsdiamond method testParse2CoordinatesFloat.

@Test
public void testParse2CoordinatesFloat() {
    parser("\\psdiamond(10.5,20.5)(35.5,50.5)");
    final Rhombus rh = getShapeAt(0);
    assertEquals(10.5 * Shape.PPC - 35.5 * Shape.PPC, rh.getPosition().getX(), 0.001);
    assertEquals(20.5 * -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)

Example 5 with Rhombus

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

the class TestParsingPsdiamond method testParse2CoordinatesFloat2.

@Test
public void testParse2CoordinatesFloat2() {
    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(.5 * -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