Search in sources :

Example 41 with Shape

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

the class TestShapePositioner method testSeveralShapesForeground.

@Test
public void testSeveralShapesForeground() {
    Cmds.of(selectThreeShapes, selectTwoShapes).execute();
    selectShapeAt.execute(Arrays.asList(1, 2));
    final Shape s2 = drawing.getShapeAt(1).orElseThrow();
    final Shape s3 = drawing.getShapeAt(2).orElseThrow();
    Cmds.of(() -> clickOn("#foregroundB")).execute();
    assertEquals(s2, drawing.getShapeAt(drawing.size() - 2).orElseThrow());
    assertEquals(s3, drawing.getShapeAt(-1).orElseThrow());
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) Test(org.junit.Test)

Example 42 with Shape

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

the class PolymorphShapeTest method testLoadShapeLineStyleParams.

@ParameterizedTest
@MethodSource("net.sf.latexdraw.data.ShapeSupplier#getDiversifiedShapes")
default void testLoadShapeLineStyleParams(final Shape sh) {
    assumeTrue(sh.isLineStylable());
    final Shape s2 = produceOutputShapeFrom(sh);
    CompareShapeMatcher.INST.assertEqualShapeLineStyle(sh, s2);
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 43 with Shape

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

the class PolymorphShapeTest method testLoadRotationAngleParams.

@ParameterizedTest
@MethodSource("net.sf.latexdraw.data.ShapeSupplier#getDiversifiedShapes")
default void testLoadRotationAngleParams(final Shape sh) {
    final Shape s2 = produceOutputShapeFrom(sh);
    CompareShapeMatcher.INST.assertEqualShapeRotationAngle(sh, s2);
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 44 with Shape

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

the class PolymorphShapeTest method testPointsEquals.

@ParameterizedTest
@MethodSource("net.sf.latexdraw.data.ShapeSupplier#getDiversifiedShapes")
default void testPointsEquals(final Shape sh) {
    WaitForAsyncUtils.waitForFxEvents();
    final Shape s2 = produceOutputShapeFrom(sh);
    assertThat(sh.getPoints()).isEqualTo(s2.getPoints());
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 45 with Shape

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

the class TestPSTShape method testFreeHandPointsLines.

@Test
public void testFreeHandPointsLines() {
    final Freehand fh = ShapeFactory.INST.createFreeHand(Arrays.asList(ShapeFactory.INST.createPoint(50d, 70d), ShapeFactory.INST.createPoint(100d, 90d), ShapeFactory.INST.createPoint(132d, 112d), ShapeFactory.INST.createPoint(150d, 180d)));
    fh.setInterval(1);
    fh.setType(FreeHandStyle.LINES);
    final Shape s2 = produceOutputShapeFrom(fh);
    assertThat(s2.getPoints()).isEqualTo(produceOutputShapeFrom(s2).getPoints());
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) Freehand(net.sf.latexdraw.model.api.shape.Freehand) PolymorphShapeTest(net.sf.latexdraw.view.PolymorphShapeTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Shape (net.sf.latexdraw.model.api.shape.Shape)75 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)43 MethodSource (org.junit.jupiter.params.provider.MethodSource)41 Test (org.junit.Test)12 Point (net.sf.latexdraw.model.api.shape.Point)8 PositionShape (net.sf.latexdraw.model.api.shape.PositionShape)7 HelperTest (net.sf.latexdraw.HelperTest)6 ShapeFactory (net.sf.latexdraw.model.ShapeFactory)6 Circle (net.sf.latexdraw.model.api.shape.Circle)6 RectangularShape (net.sf.latexdraw.model.api.shape.RectangularShape)6 NotNull (org.jetbrains.annotations.NotNull)6 Click (io.github.interacto.jfx.interaction.library.Click)5 ArrayList (java.util.ArrayList)5 Objects (java.util.Objects)5 MathUtils (net.sf.latexdraw.model.MathUtils)5 Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)5 Inject (net.sf.latexdraw.util.Inject)5 CommandsRegistry (io.github.interacto.command.CommandsRegistry)3 Redo (io.github.interacto.command.library.Redo)3 Undo (io.github.interacto.command.library.Undo)3