Search in sources :

Example 6 with Shape

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

the class TestParsingShape method testParamHatchsep.

@ParameterizedTest
@MethodSource(value = "cmdUnitProvider")
void testParamHatchsep(final Tuple<String, String> cmd, final String unit) {
    parser(cmd.a + "[fillstyle=clines, hatchsep=2.1" + unit + "]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isInteriorStylable());
    assertEquals(PSTContext.doubleUnitToUnit(2.1, unit) * Shape.PPC, sh.getHatchingsSep(), 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 7 with Shape

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

the class TestParsingShape method testParamHatchwidth.

@ParameterizedTest
@MethodSource(value = "cmdUnitProvider")
void testParamHatchwidth(final Tuple<String, String> cmd, final String unit) {
    parser(cmd.a + "[fillstyle=clines, hatchwidth=23" + unit + "]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isInteriorStylable());
    assertEquals(PSTContext.doubleUnitToUnit(23, unit) * Shape.PPC, sh.getHatchingsWidth(), 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 8 with Shape

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

the class TestParsingShape method testParamLinecolorPredefinedColor.

@ParameterizedTest
@MethodSource(value = "cmds")
void testParamLinecolorPredefinedColor(final Tuple<String, String> cmd) {
    parser(cmd.a + "[linecolor=blue]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isLineStylable());
    assertEquals(DviPsColors.BLUE, sh.getLineColour());
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 9 with Shape

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

the class TestParsingShape method testParamNoShadow.

@ParameterizedTest
@MethodSource(value = "cmds")
void testParamNoShadow(final Tuple<String, String> cmd) {
    parser(cmd.a + "[shadow = false]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isShadowable());
    assertFalse(sh.hasShadow());
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 10 with Shape

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

the class TestParsingShape method testParamShadowsize.

@ParameterizedTest
@MethodSource(value = "cmdUnitProvider")
void testParamShadowsize(final Tuple<String, String> cmd, final String unit) {
    parser(cmd.a + "[shadow=true, shadowsize=5.4" + unit + "]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isShadowable());
    assertEquals(PSTContext.doubleUnitToUnit(5.4, unit) * Shape.PPC, sh.getShadowSize(), 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