use of net.sf.latexdraw.model.api.shape.Shape 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());
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestDrawing method testSetSelectionList2.
@Test
public void testSetSelectionList2() {
final List<Shape> list = new ArrayList<>();
final Group selection = drawing.getSelection();
final Shape sh = ShapeFactory.INST.createRectangle();
final Shape sh2 = ShapeFactory.INST.createRectangle();
list.add(sh);
list.add(sh2);
drawing.setSelection(list);
assertEquals(selection, drawing.getSelection());
assertEquals(2, drawing.getSelection().size());
assertEquals(sh, drawing.getSelection().getShapeAt(0).orElseThrow());
assertEquals(sh2, drawing.getSelection().getShapeAt(1).orElseThrow());
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestEllipse method testIsTypeOf.
@Test
public void testIsTypeOf() {
final Ellipse shape = ShapeFactory.INST.createEllipse();
assertFalse(shape.isTypeOf(Rectangle.class));
assertFalse(shape.isTypeOf(Circle.class));
assertTrue(shape.isTypeOf(Shape.class));
assertTrue(shape.isTypeOf(PositionShape.class));
assertTrue(shape.isTypeOf(RectangularShape.class));
assertTrue(shape.isTypeOf(Ellipse.class));
assertTrue(shape.isTypeOf(shape.getClass()));
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class PolymorphShapeTest method testLoadShapeShowPtsParams.
@ParameterizedTest
@MethodSource("net.sf.latexdraw.data.ShapeSupplier#getDiversifiedShapes")
default void testLoadShapeShowPtsParams(final Shape sh) {
assumeTrue(sh.isShowPtsable());
final Shape s2 = produceOutputShapeFrom(sh);
CompareShapeMatcher.INST.assertEqualShapeShowPts(sh, s2);
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class PolymorphShapeTest method testLoadFillStyleParams.
@ParameterizedTest
@MethodSource("net.sf.latexdraw.data.ShapeSupplier#getDiversifiedShapes")
default void testLoadFillStyleParams(final Shape sh) {
assumeTrue(sh.isInteriorStylable());
final Shape s2 = produceOutputShapeFrom(sh);
CompareShapeMatcher.INST.assertEqualShapeFillStyle(sh, s2);
}
Aggregations