Search in sources :

Example 1 with IShapeFactory

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)));
    });
}
Also used : IGroup(net.sf.latexdraw.models.interfaces.shape.IGroup) Group(javafx.scene.Group) Canvas(net.sf.latexdraw.view.jfx.Canvas) ViewShape(net.sf.latexdraw.view.jfx.ViewShape) IShapeFactory(net.sf.latexdraw.models.interfaces.shape.IShapeFactory) Before(org.junit.Before)

Aggregations

Group (javafx.scene.Group)1 IGroup (net.sf.latexdraw.models.interfaces.shape.IGroup)1 IShapeFactory (net.sf.latexdraw.models.interfaces.shape.IShapeFactory)1 Canvas (net.sf.latexdraw.view.jfx.Canvas)1 ViewShape (net.sf.latexdraw.view.jfx.ViewShape)1 Before (org.junit.Before)1