Search in sources :

Example 36 with IRectangle

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

the class TestParsingPsframe method testCoordinatesCm.

@Test
public void testCoordinatesCm() {
    parser("\\psframe(0,0)(35cm,20cm)");
    final IRectangle rec = getShapeAt(0);
    assertEquals(0d, rec.getPosition().getX(), 0.001);
    assertEquals(0d, rec.getPosition().getY(), 0.001);
    assertEquals(35d * IShape.PPC, rec.getWidth(), 0.001);
    assertEquals(20d * IShape.PPC, rec.getHeight(), 0.001);
}
Also used : IRectangle(net.sf.latexdraw.models.interfaces.shape.IRectangle) Test(org.junit.Test)

Example 37 with IRectangle

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

the class TestIRectangle method testIsTypeOf.

@Test
public void testIsTypeOf() {
    final IRectangle shape = ShapeFactory.INST.createRectangle();
    assertFalse(shape.isTypeOf(null));
    assertFalse(shape.isTypeOf(IEllipse.class));
    assertFalse(shape.isTypeOf(ICircle.class));
    assertTrue(shape.isTypeOf(IShape.class));
    assertTrue(shape.isTypeOf(ILineArcProp.class));
    assertTrue(shape.isTypeOf(IPositionShape.class));
    assertTrue(shape.isTypeOf(IRectangularShape.class));
    assertTrue(shape.isTypeOf(IRectangle.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) IEllipse(net.sf.latexdraw.models.interfaces.shape.IEllipse) ILineArcProp(net.sf.latexdraw.models.interfaces.prop.ILineArcProp) IShape(net.sf.latexdraw.models.interfaces.shape.IShape) IRectangle(net.sf.latexdraw.models.interfaces.shape.IRectangle) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 38 with IRectangle

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

the class TestIRectangle method testConstructorsOK1.

@Test
public void testConstructorsOK1() {
    IRectangle rec = ShapeFactory.INST.createRectangle(ShapeFactory.INST.createPoint(20, 26), ShapeFactory.INST.createPoint(30, 35));
    assertEqualsDouble(20., rec.getPosition().getX());
    assertEqualsDouble(35., rec.getPosition().getY());
    assertEqualsDouble(10., rec.getWidth());
    assertEqualsDouble(9., rec.getHeight());
}
Also used : IRectangle(net.sf.latexdraw.models.interfaces.shape.IRectangle) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 39 with IRectangle

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

the class TestIPlot method testCopyFromOther.

@Test
public void testCopyFromOther() {
    IRectangle rec = ShapeFactory.INST.createRectangle();
    rec.setFillingCol(DviPsColors.BLUE);
    shape.copy(rec);
    assertEquals(DviPsColors.BLUE, shape.getFillingCol());
}
Also used : IRectangle(net.sf.latexdraw.models.interfaces.shape.IRectangle) HelperTest(net.sf.latexdraw.HelperTest) Test(org.junit.Test)

Aggregations

IRectangle (net.sf.latexdraw.models.interfaces.shape.IRectangle)39 Test (org.junit.Test)33 HelperTest (net.sf.latexdraw.HelperTest)5 IGrid (net.sf.latexdraw.models.interfaces.shape.IGrid)5 ICircle (net.sf.latexdraw.models.interfaces.shape.ICircle)2 IDot (net.sf.latexdraw.models.interfaces.shape.IDot)2 IEllipse (net.sf.latexdraw.models.interfaces.shape.IEllipse)2 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)2 IText (net.sf.latexdraw.models.interfaces.shape.IText)2 Theory (org.junit.experimental.theories.Theory)2 Point2D (javafx.geometry.Point2D)1 ILineArcProp (net.sf.latexdraw.models.interfaces.prop.ILineArcProp)1 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 IFreehand (net.sf.latexdraw.models.interfaces.shape.IFreehand)1 IPlot (net.sf.latexdraw.models.interfaces.shape.IPlot)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