Search in sources :

Example 6 with Group

use of net.sf.latexdraw.model.api.shape.Group in project latexdraw by arnobl.

the class TestPSTViewFactory method testCreateGroupViewPST.

@Test
void testCreateGroupViewPST() {
    final Group gp = ShapeFactory.INST.createGroup();
    gp.addShape(ShapeFactory.INST.createText());
    final Optional<PSTShapeView<Group>> view = factory.createView(gp);
    assertTrue(view.isPresent());
}
Also used : Group(net.sf.latexdraw.model.api.shape.Group) Test(org.junit.jupiter.api.Test)

Example 7 with Group

use of net.sf.latexdraw.model.api.shape.Group in project latexdraw by arnobl.

the class TestGroup method testDuplicateArrow.

@Test
public void testDuplicateArrow() {
    shape.addShape(ShapeFactory.INST.createPolyline(Collections.emptyList()));
    shape.setArrowStyle(ArrowStyle.BAR_END, 0);
    shape.setArrowStyle(ArrowStyle.CIRCLE_END, 1);
    final Group shape2 = shape.duplicate();
    assertEquals(ArrowStyle.BAR_END, shape2.getArrowStyle(0));
    assertEquals(ArrowStyle.CIRCLE_END, shape2.getArrowStyle(1));
}
Also used : Group(net.sf.latexdraw.model.api.shape.Group) HelperTest(net.sf.latexdraw.HelperTest) Test(org.junit.Test)

Example 8 with Group

use of net.sf.latexdraw.model.api.shape.Group 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());
}
Also used : Group(net.sf.latexdraw.model.api.shape.Group) Shape(net.sf.latexdraw.model.api.shape.Shape) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

Group (net.sf.latexdraw.model.api.shape.Group)8 Test (org.junit.Test)4 Shape (net.sf.latexdraw.model.api.shape.Shape)3 ArrayList (java.util.ArrayList)2 URL (java.net.URL)1 List (java.util.List)1 ResourceBundle (java.util.ResourceBundle)1 FXML (javafx.fxml.FXML)1 Button (javafx.scene.control.Button)1 AnchorPane (javafx.scene.layout.AnchorPane)1 HelperTest (net.sf.latexdraw.HelperTest)1 JoinShapes (net.sf.latexdraw.command.shape.JoinShapes)1 SeparateShapes (net.sf.latexdraw.command.shape.SeparateShapes)1 Drawing (net.sf.latexdraw.model.api.shape.Drawing)1 Point (net.sf.latexdraw.model.api.shape.Point)1 PSTContext (net.sf.latexdraw.parser.pst.PSTContext)1 PSTLatexdrawListener (net.sf.latexdraw.parser.pst.PSTLatexdrawListener)1 PSTLexer (net.sf.latexdraw.parser.pst.PSTLexer)1 PSTParser (net.sf.latexdraw.parser.pst.PSTParser)1 EditingService (net.sf.latexdraw.service.EditingService)1