Search in sources :

Example 66 with Shape

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

the class TestParsingShape method testParamDoublecolorPredefined.

@ParameterizedTest
@MethodSource(value = "cmds")
void testParamDoublecolorPredefined(final Tuple<String, String> cmd) {
    parser(cmd.a + "[doubleline=true, doublecolor=red]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isDbleBorderable());
    assertEquals(DviPsColors.RED, sh.getDbleBordCol());
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 67 with Shape

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

the class TestParsingShape method testParamLinewidth.

@ParameterizedTest
@MethodSource(value = "cmdUnitProvider")
void testParamLinewidth(final Tuple<String, String> cmd, final String unit) {
    parser(cmd.a + "[linewidth=2" + unit + "]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isThicknessable());
    assertEquals(PSTContext.doubleUnitToUnit(2, unit) * Shape.PPC, sh.getThickness(), 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 68 with Shape

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

the class TestParsingShape method testParamFillingcolorPredefined.

@ParameterizedTest
@MethodSource(value = "cmds")
void testParamFillingcolorPredefined(final Tuple<String, String> cmd) {
    parser(cmd.a + "[fillstyle=solid, fillcolor=green]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isFillable());
    assertEquals(DviPsColors.GREEN, sh.getFillingCol());
}
Also used : Shape(net.sf.latexdraw.model.api.shape.Shape) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 69 with Shape

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

the class TestParsingShape method testParamShadowangle.

@ParameterizedTest
@MethodSource(value = "cmds")
void testParamShadowangle(final Tuple<String, String> cmd) {
    parser(cmd.a + "[shadow=true, shadowangle=-23.1]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isShadowable());
    assertEquals(Math.toRadians(-23.1), sh.getShadowAngle(), 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 70 with Shape

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

the class TestParsingShape method testParamHatchcolor.

@ParameterizedTest
@MethodSource(value = "cmds")
void testParamHatchcolor(final Tuple<String, String> cmd) {
    parser(cmd.a + "[fillstyle=clines, hatchcolor=blue]" + cmd.b);
    final Shape sh = getShapeAt(0);
    assumeTrue(sh.isInteriorStylable());
    assertEquals(DviPsColors.BLUE, sh.getHatchingsCol());
}
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