Search in sources :

Example 51 with ArrowableSingleShape

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

the class TestPencilArrowStyle method testSelectRightArrowStyleCIRCLEINPencil.

@Test
public void testSelectRightArrowStyleCIRCLEINPencil() {
    Cmds.of(activatePencil, pencilCreatesBezier, updateIns).execute();
    final ArrowStyle style = arrowRightCB.getSelectionModel().getSelectedItem();
    Cmds.of(() -> selectArrowRightCB.execute(ArrowStyle.CIRCLE_IN)).execute();
    final ArrowStyle newStyle = arrowRightCB.getSelectionModel().getSelectedItem();
    assertEquals(ArrowStyle.CIRCLE_IN, newStyle);
    assertEquals(newStyle, ((ArrowableSingleShape) editing.createShapeInstance()).getArrowAt(-1).getArrowStyle());
    assertNotEquals(style, newStyle);
    assertFalse(arrowPane.isVisible());
    assertTrue(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 52 with ArrowableSingleShape

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

the class TestHandArrowStyle method testSelectRightArrowStyleHand.

@Test
public void testSelectRightArrowStyleHand() {
    Cmds.of(selectionAddBezier, selectionAddBezier, activateHand, updateIns).execute();
    final ArrowStyle style = arrowRightCB.getSelectionModel().getSelectedItem();
    selectArrowRightCB.execute(ArrowStyle.ROUND_IN);
    waitFXEvents.execute();
    final ArrowStyle newStyle = arrowRightCB.getSelectionModel().getSelectedItem();
    assertEquals(ArrowStyle.ROUND_IN, newStyle);
    assertEquals(newStyle, ((ArrowableSingleShape) drawing.getSelection().getShapeAt(0).orElseThrow()).getArrowAt(-1).getArrowStyle());
    assertEquals(newStyle, ((ArrowableSingleShape) drawing.getSelection().getShapeAt(1).orElseThrow()).getArrowAt(-1).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 53 with ArrowableSingleShape

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

the class PolymorphArrowableTest method testArrowRBracketParamsArr1.

@ParameterizedTest
@MethodSource("arrowsParamsDiv")
default void testArrowRBracketParamsArr1(final ArrowableSingleShape sh, final ArrowStyle arr) {
    assumeTrue(arr.isRoundBracket());
    assumeFalse(sh instanceof Axes);
    sh.setArrowStyle(arr, 0);
    final ArrowableSingleShape s2 = produceOutputShapeFrom(sh);
    CompareShapeMatcher.INST.assertEqualsArrowRBracket(sh.getArrowAt(0), s2.getArrowAt(0));
}
Also used : Axes(net.sf.latexdraw.model.api.shape.Axes) ArrowableSingleShape(net.sf.latexdraw.model.api.shape.ArrowableSingleShape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 54 with ArrowableSingleShape

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

the class PolymorphArrowableTest method testArrowArrow1.

@ParameterizedTest
@MethodSource("arrowsParamsDiv")
default void testArrowArrow1(final ArrowableSingleShape sh, final ArrowStyle arr) {
    assumeTrue(arr.isArrow());
    sh.setArrowStyle(arr, 0);
    sh.setArrowStyle(ArrowStyle.LEFT_ROUND_BRACKET, 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(0), s2.getArrowAt(0));
}
Also used : ArrowableSingleShape(net.sf.latexdraw.model.api.shape.ArrowableSingleShape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 55 with ArrowableSingleShape

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

the class PolymorphArrowableTest method testArrowCircleDiskParamsArr1.

@ParameterizedTest
@MethodSource("arrowsParamsDiv")
default void testArrowCircleDiskParamsArr1(final ArrowableSingleShape sh, final ArrowStyle arr) {
    assumeTrue(arr.isCircleDisk());
    assumeFalse(sh instanceof Axes);
    sh.setArrowStyle(arr, 0);
    final ArrowableSingleShape s2 = produceOutputShapeFrom(sh);
    CompareShapeMatcher.INST.assertEqualsArrowCircleDisk(sh.getArrowAt(0), s2.getArrowAt(0));
}
Also used : Axes(net.sf.latexdraw.model.api.shape.Axes) ArrowableSingleShape(net.sf.latexdraw.model.api.shape.ArrowableSingleShape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

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