use of net.sf.latexdraw.models.interfaces.shape.IPoint in project latexdraw by arnobl.
the class TestIPositionShape method testGetSetPositionKONULL.
@Theory
public void testGetSetPositionKONULL(@PosShapeData final IPositionShape shape) {
IPoint pt = ShapeFactory.INST.createPoint(15d, 25d);
shape.setPosition(pt);
shape.setPosition(null);
assertEqualsDouble(pt.getX(), shape.getPosition().getX());
assertEqualsDouble(pt.getY(), shape.getPosition().getY());
}
use of net.sf.latexdraw.models.interfaces.shape.IPoint in project latexdraw by arnobl.
the class TestIPositionShape method testGetSetPositionKO.
@Theory
public void testGetSetPositionKO(@PosShapeData final IPositionShape shape, @DoubleData(vals = {}, bads = true) final double value) {
IPoint pt = ShapeFactory.INST.createPoint(15d, 25d);
shape.setPosition(pt);
shape.setPosition(ShapeFactory.INST.createPoint(value, value));
assertEqualsDouble(pt.getX(), shape.getPosition().getX());
assertEqualsDouble(pt.getY(), shape.getPosition().getY());
}
use of net.sf.latexdraw.models.interfaces.shape.IPoint in project latexdraw by arnobl.
the class TestIPositionShape method testGetSetPosition.
@Theory
public void testGetSetPosition(@PosShapeData final IPositionShape shape) {
IPoint pt = ShapeFactory.INST.createPoint(15d, 25d);
shape.setPosition(pt);
assertEqualsDouble(pt.getX(), shape.getPosition().getX());
assertEqualsDouble(pt.getY(), shape.getPosition().getY());
assertEqualsDouble(15d, shape.getX());
assertEqualsDouble(25d, shape.getY());
}
use of net.sf.latexdraw.models.interfaces.shape.IPoint in project latexdraw by arnobl.
the class TestIRectangularShape method testTranslate.
@Theory
public void testTranslate(@RectangularData final IRectangularShape shape, @DoubleData final double tx, @DoubleData final double ty) {
final IPoint p1 = ShapeFactory.INST.createPoint(3, 1);
final IPoint p2 = ShapeFactory.INST.createPoint(1, 3);
shape.setPosition(p2);
shape.setWidth(p1.getX() - p2.getX());
shape.setHeight(p2.getY() - p1.getY());
shape.translate(tx, ty);
assertEqualsDouble(p2.getX() + tx, shape.getPtAt(0).getX());
assertEqualsDouble(p1.getX() + tx, shape.getPtAt(1).getX());
assertEqualsDouble(p1.getX() + tx, shape.getPtAt(2).getX());
assertEqualsDouble(p2.getX() + tx, shape.getPtAt(-1).getX());
assertEqualsDouble(p1.getY() + ty, shape.getPtAt(0).getY());
assertEqualsDouble(p1.getY() + ty, shape.getPtAt(1).getY());
assertEqualsDouble(p2.getY() + ty, shape.getPtAt(2).getY());
assertEqualsDouble(p2.getY() + ty, shape.getPtAt(-1).getY());
}
use of net.sf.latexdraw.models.interfaces.shape.IPoint in project latexdraw by arnobl.
the class TestIRectangularShape method testTranslateKO.
@Theory
public void testTranslateKO(@RectangularData final IRectangularShape shape, @DoubleData(vals = { 0d }, bads = true) final double tx, @DoubleData(vals = { 0d }, bads = true) final double ty) {
final IPoint p1 = ShapeFactory.INST.createPoint(3, 1);
final IPoint p2 = ShapeFactory.INST.createPoint(1, 3);
shape.setPosition(p2);
shape.setWidth(p1.getX() - p2.getX());
shape.setHeight(p2.getY() - p1.getY());
shape.translate(tx, ty);
assertEqualsDouble(1d, shape.getPtAt(0).getX());
assertEqualsDouble(3d, shape.getPtAt(1).getX());
assertEqualsDouble(3d, shape.getPtAt(2).getX());
assertEqualsDouble(1d, shape.getPtAt(-1).getX());
assertEqualsDouble(1d, shape.getPtAt(0).getY());
assertEqualsDouble(1d, shape.getPtAt(1).getY());
assertEqualsDouble(3d, shape.getPtAt(2).getY());
assertEqualsDouble(3d, shape.getPtAt(-1).getY());
}
Aggregations