Search in sources :

Example 56 with Shape

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

the class TestParsingShape method testParamFillingStyle.

@ParameterizedTest
@MethodSource(value = "cmdFillStyleProvider")
void testParamFillingStyle(final Tuple<String, String> cmd, final FillingStyle style) {
    parser(cmd.a + "[fillstyle=" + style.getLatexToken() + "]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isFillable());
    assertEquals(style, sh.getFillingStyle());
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 57 with Shape

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

the class TestParsingShape method testParamLineStyle.

@ParameterizedTest
@MethodSource(value = "cmdLineStyleProvider")
void testParamLineStyle(final Tuple<String, String> cmd, final LineStyle style) {
    parser(cmd.a + "[linestyle=" + style.getLatexToken() + "]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isLineStylable());
    assertEquals(style, sh.getLineStyle());
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 58 with Shape

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

the class TestParsingShape method testParamGradangle.

@ParameterizedTest
@MethodSource(value = "cmds")
void testParamGradangle(final Tuple<String, String> cmd) {
    parser(cmd.a + "[fillstyle=gradient, gradangle=2.34]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isInteriorStylable());
    assertEquals(Math.toRadians(2.34), sh.getGradAngle(), 0.00001);
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 59 with Shape

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

the class TestParsingShape method testParamDimen.

@ParameterizedTest
@MethodSource(value = "cmdBorderPosProvider")
void testParamDimen(final Tuple<String, String> cmd, final BorderPos pos) {
    parser(cmd.a + "[dimen=" + pos.getLatexToken() + "]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isBordersMovable());
    assertEquals(pos, sh.getBordersPosition());
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 60 with Shape

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

the class TestParsingShape method testParamHatchangle.

@ParameterizedTest
@MethodSource(value = "cmds")
void testParamHatchangle(final Tuple<String, String> cmd) {
    parser(cmd.a + "[fillstyle=clines, hatchangle=-23]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isInteriorStylable());
    assertThat(sh.getHatchingsAngle()).isCloseTo(Math.toRadians(-23), within(0.00001));
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

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