Search in sources :

Example 31 with ArrowableSingleShape

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

the class PolymorphArrowableTest method testArrowArrow2.

@ParameterizedTest
@MethodSource("arrowsParamsDiv")
default void testArrowArrow2(final ArrowableSingleShape sh, final ArrowStyle arr) {
    assumeTrue(arr.isArrow());
    sh.setArrowStyle(ArrowStyle.LEFT_SQUARE_BRACKET, 0);
    sh.setArrowStyle(arr, 1);
    final ArrowableSingleShape s2 = produceOutputShapeFrom(sh);
    CompareShapeMatcher.INST.assertEqualsArrowStyle(sh.getArrowAt(0), s2.getArrowAt(0));
    CompareShapeMatcher.INST.assertEqualsArrowStyle(sh.getArrowAt(1), s2.getArrowAt(1));
    CompareShapeMatcher.INST.assertEqualsArrowArrow(sh.getArrowAt(1), s2.getArrowAt(1));
}
Also used : ArrowableSingleShape(net.sf.latexdraw.model.api.shape.ArrowableSingleShape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 32 with ArrowableSingleShape

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

the class TestHandArrowStyle method testSelectLeftArrowStyleHand.

@Test
public void testSelectLeftArrowStyleHand() {
    Cmds.of(selectionAddBezier, selectionAddBezier, activateHand, updateIns).execute();
    final ArrowStyle style = arrowLeftCB.getSelectionModel().getSelectedItem();
    selectArrowLeftCB.execute(ArrowStyle.BAR_IN);
    waitFXEvents.execute();
    final ArrowStyle newStyle = arrowLeftCB.getSelectionModel().getSelectedItem();
    assertEquals(ArrowStyle.BAR_IN, newStyle);
    assertEquals(newStyle, ((ArrowableSingleShape) drawing.getSelection().getShapeAt(0).orElseThrow()).getArrowAt(0).getArrowStyle());
    assertEquals(newStyle, ((ArrowableSingleShape) drawing.getSelection().getShapeAt(1).orElseThrow()).getArrowAt(0).getArrowStyle());
    assertNotEquals(style, newStyle);
}
Also used : ArrowStyle(net.sf.latexdraw.model.api.shape.ArrowStyle) ArrowableSingleShape(net.sf.latexdraw.model.api.shape.ArrowableSingleShape) Test(org.junit.Test)

Example 33 with ArrowableSingleShape

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

the class TestPencilArrowStyle method testSelectLeftArrowStyleRIGHTDBLEARROWPencil.

@Test
public void testSelectLeftArrowStyleRIGHTDBLEARROWPencil() {
    Cmds.of(activatePencil, pencilCreatesBezier, updateIns).execute();
    final ArrowStyle style = arrowLeftCB.getSelectionModel().getSelectedItem();
    Cmds.of(() -> selectArrowLeftCB.execute(ArrowStyle.RIGHT_DBLE_ARROW)).execute();
    final ArrowStyle newStyle = arrowLeftCB.getSelectionModel().getSelectedItem();
    assertEquals(ArrowStyle.RIGHT_DBLE_ARROW, newStyle);
    assertEquals(newStyle, ((ArrowableSingleShape) editing.createShapeInstance()).getArrowAt(0).getArrowStyle());
    assertNotEquals(style, newStyle);
    assertTrue(arrowPane.isVisible());
    assertFalse(dotPane.isVisible());
    assertFalse(barPane.isVisible());
    assertFalse(bracketPane.isVisible());
    assertFalse(rbracketPane.isVisible());
}
Also used : ArrowStyle(net.sf.latexdraw.model.api.shape.ArrowStyle) ArrowableSingleShape(net.sf.latexdraw.model.api.shape.ArrowableSingleShape) Test(org.junit.Test)

Example 34 with ArrowableSingleShape

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

the class TestPencilArrowStyle method testSelectRightArrowStyleLEFTARROWPencil.

@Test
public void testSelectRightArrowStyleLEFTARROWPencil() {
    Cmds.of(activatePencil, pencilCreatesBezier, updateIns).execute();
    final ArrowStyle style = arrowRightCB.getSelectionModel().getSelectedItem();
    Cmds.of(() -> selectArrowRightCB.execute(ArrowStyle.LEFT_ARROW)).execute();
    final ArrowStyle newStyle = arrowRightCB.getSelectionModel().getSelectedItem();
    assertEquals(ArrowStyle.LEFT_ARROW, newStyle);
    assertEquals(newStyle, ((ArrowableSingleShape) editing.createShapeInstance()).getArrowAt(-1).getArrowStyle());
    assertNotEquals(style, newStyle);
    assertTrue(arrowPane.isVisible());
    assertFalse(dotPane.isVisible());
    assertFalse(barPane.isVisible());
    assertFalse(bracketPane.isVisible());
    assertFalse(rbracketPane.isVisible());
}
Also used : ArrowStyle(net.sf.latexdraw.model.api.shape.ArrowStyle) ArrowableSingleShape(net.sf.latexdraw.model.api.shape.ArrowableSingleShape) Test(org.junit.Test)

Example 35 with ArrowableSingleShape

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

the class TestPencilArrowStyle method testSelectRightArrowStyleRIGHTSQUAREBRACKETPencil.

@Test
public void testSelectRightArrowStyleRIGHTSQUAREBRACKETPencil() {
    Cmds.of(activatePencil, pencilCreatesBezier, updateIns).execute();
    final ArrowStyle style = arrowRightCB.getSelectionModel().getSelectedItem();
    Cmds.of(() -> selectArrowRightCB.execute(ArrowStyle.RIGHT_SQUARE_BRACKET)).execute();
    final ArrowStyle newStyle = arrowRightCB.getSelectionModel().getSelectedItem();
    assertEquals(ArrowStyle.RIGHT_SQUARE_BRACKET, newStyle);
    assertEquals(newStyle, ((ArrowableSingleShape) editing.createShapeInstance()).getArrowAt(-1).getArrowStyle());
    assertNotEquals(style, newStyle);
    assertFalse(arrowPane.isVisible());
    assertFalse(dotPane.isVisible());
    assertTrue(barPane.isVisible());
    assertTrue(bracketPane.isVisible());
    assertFalse(rbracketPane.isVisible());
}
Also used : ArrowStyle(net.sf.latexdraw.model.api.shape.ArrowStyle) ArrowableSingleShape(net.sf.latexdraw.model.api.shape.ArrowableSingleShape) Test(org.junit.Test)

Aggregations

ArrowableSingleShape (net.sf.latexdraw.model.api.shape.ArrowableSingleShape)89 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)55 MethodSource (org.junit.jupiter.params.provider.MethodSource)55 ArrowStyle (net.sf.latexdraw.model.api.shape.ArrowStyle)34 Test (org.junit.Test)34 Axes (net.sf.latexdraw.model.api.shape.Axes)7