Search in sources :

Example 16 with IRhombus

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

the class TestParsingPsdiamond method testCoordinatesCm.

@Test
public void testCoordinatesCm() {
    parser("\\psdiamond(0,0)(35cm,20cm)");
    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)

Example 17 with IRhombus

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

the class TestParsingPsdiamond method testParse2CoordinatesFloatSigns2.

@Test
public void testParse2CoordinatesFloatSigns2() {
    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(-5d * -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 18 with IRhombus

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

the class TestIRhombus method testConstructor1.

@Test
public void testConstructor1() {
    final IRhombus shape = ShapeFactory.INST.createRhombus();
    assertEqualsDouble(1d, shape.getWidth());
    assertEqualsDouble(1d, shape.getHeight());
    assertEqualsDouble(0d, shape.getPosition().getX());
    assertEqualsDouble(0d, shape.getPosition().getY());
}
Also used : IRhombus(net.sf.latexdraw.models.interfaces.shape.IRhombus) HelperTest(net.sf.latexdraw.HelperTest) Test(org.junit.Test)

Example 19 with IRhombus

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

the class TestIRhombus method testIsTypeOf.

@Test
public void testIsTypeOf() {
    final IRhombus shape = ShapeFactory.INST.createRhombus();
    assertFalse(shape.isTypeOf(null));
    assertFalse(shape.isTypeOf(IRectangle.class));
    assertFalse(shape.isTypeOf(ICircle.class));
    assertTrue(shape.isTypeOf(IShape.class));
    assertTrue(shape.isTypeOf(IPositionShape.class));
    assertTrue(shape.isTypeOf(IRectangularShape.class));
    assertTrue(shape.isTypeOf(IRhombus.class));
    assertTrue(shape.isTypeOf(shape.getClass()));
}
Also used : IRectangularShape(net.sf.latexdraw.models.interfaces.shape.IRectangularShape) ICircle(net.sf.latexdraw.models.interfaces.shape.ICircle) IPositionShape(net.sf.latexdraw.models.interfaces.shape.IPositionShape) IShape(net.sf.latexdraw.models.interfaces.shape.IShape) IRhombus(net.sf.latexdraw.models.interfaces.shape.IRhombus) IRectangle(net.sf.latexdraw.models.interfaces.shape.IRectangle) HelperTest(net.sf.latexdraw.HelperTest) 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