use of net.sf.latexdraw.models.interfaces.shape.IShapeFactory in project latexdraw by arnobl.
the class TestAlignShape method setUp.
@Override
@Before
public void setUp() {
super.setUp();
canvas = Mockito.mock(Canvas.class);
final IShapeFactory fac = ShapeFactory.INST;
shapes = fac.createGroup();
shapes.addShape(fac.createRectangle(fac.createPoint(10d, -2d), 6d, 6d));
shapes.addShape(fac.createRectangle(fac.createPoint(-5d, 20d), 12d, 15d));
shapes.addShape(fac.createRectangle(fac.createPoint(14d, 60d), 20d, 16d));
views = new Group();
IntStream.range(0, shapes.size()).forEach(i -> {
views.getChildren().add(ViewFactory.INSTANCE.createView(shapes.getShapeAt(i)).get());
Mockito.when(canvas.getViewFromShape(shapes.getShapeAt(i))).thenReturn(Optional.of((ViewShape<?>) views.getChildren().get(i)));
});
}