Search in sources :

Example 6 with IRhombus

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

the class TestParsingPsdiamond method testParse2CoordinatesFloatSigns.

@Test
public void testParse2CoordinatesFloatSigns() {
    parser("\\psdiamond(-+-.5,+--.5)(+++35.5,--50.5)");
    IRhombus rh = getShapeAt(0);
    assertEquals(.5 * IShape.PPC - 35.5 * IShape.PPC, rh.getPosition().getX(), 0.001);
    assertEquals(.5 * -IShape.PPC + 50.5 * IShape.PPC, rh.getPosition().getY(), 0.001);
    assertEquals(35.5 * IShape.PPC * 2d, rh.getWidth(), 0.001);
    assertEquals(50.5 * IShape.PPC * 2d, rh.getHeight(), 0.001);
}
Also used : IRhombus(net.sf.latexdraw.models.interfaces.shape.IRhombus) Test(org.junit.Test)

Example 7 with IRhombus

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

the class TestParsingPsdiamond method testParse2CoordinatesFloat.

@Test
public void testParse2CoordinatesFloat() {
    parser("\\psdiamond(10.5,20.5)(35.5,50.5)");
    IRhombus rh = getShapeAt(0);
    assertEquals(10.5 * IShape.PPC - 35.5 * IShape.PPC, rh.getPosition().getX(), 0.001);
    assertEquals(20.5 * -IShape.PPC + 50.5 * IShape.PPC, rh.getPosition().getY(), 0.001);
    assertEquals(35.5 * IShape.PPC * 2d, rh.getWidth(), 0.001);
    assertEquals(50.5 * IShape.PPC * 2d, rh.getHeight(), 0.001);
}
Also used : IRhombus(net.sf.latexdraw.models.interfaces.shape.IRhombus) Test(org.junit.Test)

Example 8 with IRhombus

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

the class TestParsingPsdiamond method testParse2CoordinatesInt.

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

Example 9 with IRhombus

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

the class TestParsingPsdiamond method testParse2WidthHeight0.

@Test
public void testParse2WidthHeight0() {
    parser("\\psdiamond(0,0)(0,0)");
    IRhombus rh = getShapeAt(0);
    assertThat(rh.getWidth(), greaterThan(0d));
    assertThat(rh.getHeight(), greaterThan(0d));
}
Also used : IRhombus(net.sf.latexdraw.models.interfaces.shape.IRhombus) Test(org.junit.Test)

Example 10 with IRhombus

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

the class TestParsingPsdiamond method testParse1Coordinates.

@Test
public void testParse1Coordinates() {
    parser("\\psdiamond(35,20)");
    IRhombus rh = getShapeAt(0);
    assertEquals(-35d * IShape.PPC, rh.getPosition().getX(), 0.001);
    assertEquals(-20d * IShape.PPC * -1d, rh.getPosition().getY(), 0.001);
    assertEquals(35d * IShape.PPC * 2d, rh.getWidth(), 0.001);
    assertEquals(20d * IShape.PPC * 2d, rh.getHeight(), 0.001);
}
Also used : IRhombus(net.sf.latexdraw.models.interfaces.shape.IRhombus) Test(org.junit.Test)

Aggregations

IRhombus (net.sf.latexdraw.models.interfaces.shape.IRhombus)19 Test (org.junit.Test)17 HelperTest (net.sf.latexdraw.HelperTest)3 ICircle (net.sf.latexdraw.models.interfaces.shape.ICircle)2 IRectangle (net.sf.latexdraw.models.interfaces.shape.IRectangle)2 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 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)1 IPolygon (net.sf.latexdraw.models.interfaces.shape.IPolygon)1 IPolyline (net.sf.latexdraw.models.interfaces.shape.IPolyline)1 IPositionShape (net.sf.latexdraw.models.interfaces.shape.IPositionShape)1 IRectangularShape (net.sf.latexdraw.models.interfaces.shape.IRectangularShape)1 IShape (net.sf.latexdraw.models.interfaces.shape.IShape)1 ISquare (net.sf.latexdraw.models.interfaces.shape.ISquare)1