use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestPolyline method testIsTypeOf.
@Test
public void testIsTypeOf() {
final Polyline shape = ShapeFactory.INST.createPolyline(Collections.emptyList());
assertFalse(shape.isTypeOf(Rectangle.class));
assertFalse(shape.isTypeOf(Circle.class));
assertTrue(shape.isTypeOf(Shape.class));
assertTrue(shape.isTypeOf(ModifiablePointsShape.class));
assertTrue(shape.isTypeOf(Polygon.class));
assertTrue(shape.isTypeOf(Polyline.class));
assertTrue(shape.isTypeOf(shape.getClass()));
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestRhombus method testIsTypeOf.
@Test
public void testIsTypeOf() {
final Rhombus shape = ShapeFactory.INST.createRhombus();
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(Rhombus.class));
assertTrue(shape.isTypeOf(shape.getClass()));
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestControlPointShapeBase method testDuplicateDoNotShareCtrlPoints.
@Theory
public void testDuplicateDoNotShareCtrlPoints(@CtrlShapeData final ControlPointShape shape) {
final List<Point> ctrlPts = cloneList(shape.getFirstCtrlPts(), pt -> ShapeFactory.INST.createPoint(pt));
final Shape sh = shape.duplicate();
sh.translate(11d, 12d);
assertEquals(ctrlPts, shape.getFirstCtrlPts());
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestDrawing method testSetSelectionList1.
@Test
public void testSetSelectionList1() {
final List<Shape> list = new ArrayList<>();
final Group selection = drawing.getSelection();
final Shape sh = ShapeFactory.INST.createRectangle();
list.add(sh);
drawing.setSelection(list);
assertEquals(selection, drawing.getSelection());
assertEquals(1, drawing.getSelection().size());
assertEquals(sh, drawing.getSelection().getShapeAt(0).orElseThrow());
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestParsingShape method testParamDoublesep.
@ParameterizedTest
@MethodSource(value = "cmdUnitProvider")
void testParamDoublesep(final Tuple<String, String> cmd, final String unit) {
parser(cmd.a + "[doubleline=true, doublesep=3.1" + unit + "]" + cmd.b);
final Shape sh = getShapeAt(0);
assumeTrue(sh.isDbleBorderable());
assertEquals(PSTContext.doubleUnitToUnit(3.1, unit) * Shape.PPC, sh.getDbleBordSep(), 0.00001);
}
Aggregations