use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestPositionShapeBase method testGetSetPosition.
@Theory
public void testGetSetPosition(@PosShapeData final PositionShape shape) {
final Point 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.model.api.shape.Point in project latexdraw by arnobl.
the class TestPositionShapeBase method testGetSetPositionKO.
@Theory
public void testGetSetPositionKO(@PosShapeData final PositionShape shape, @DoubleData(vals = {}, bads = true) final double value) {
final Point 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.model.api.shape.Point in project latexdraw by arnobl.
the class TestRectangularShapeBase method testMirrorVertical.
@Theory
public void testMirrorVertical(@RectangularData final RectangularShape shape) {
final Point p1 = ShapeFactory.INST.createPoint(4, 1);
final Point p2 = ShapeFactory.INST.createPoint(1, 3);
shape.setPosition(p2);
shape.setWidth(p1.getX() - p2.getX());
shape.setHeight(p2.getY() - p1.getY());
shape.mirrorVertical(shape.getGravityCentre().getY());
assertEqualsDouble(1d, shape.getTopLeftPoint().getX());
assertEqualsDouble(4d, shape.getTopRightPoint().getX());
assertEqualsDouble(1d, shape.getTopLeftPoint().getY());
assertEqualsDouble(3d, shape.getBottomLeftPoint().getY());
assertEqualsDouble(1d, shape.getPtAt(0).getX());
assertEqualsDouble(1d, shape.getPtAt(0).getY());
assertEqualsDouble(4d, shape.getPtAt(2).getX());
assertEqualsDouble(3d, shape.getPtAt(2).getY());
}
use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestShape method testGetFullTopLeftPoint.
@Theory
public void testGetFullTopLeftPoint(@ShapeData final Shape shape) {
shape.setThickness(10.);
shape.setHasDbleBord(false);
shape.setBordersPosition(BorderPos.INTO);
final Point pt = shape.getTopLeftPoint();
final double gap = shape.getBorderGap();
pt.translate(-gap, -gap);
assertEquals(pt, shape.getFullTopLeftPoint());
}
use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestShape method testDuplicateDoNotSharePoints.
@Theory
public void testDuplicateDoNotSharePoints(@ShapeData final Shape shape) {
final List<Point> pts = cloneList(shape.getPoints(), pt -> ShapeFactory.INST.createPoint(pt));
final Shape sh = shape.duplicate();
sh.translate(11d, 12d);
assertEquals(pts, shape.getPoints());
}
Aggregations