Search in sources :

Example 11 with Dot

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

the class TestPlot method testCopyFromDot.

@Test
public void testCopyFromDot() {
    final Dot dot = ShapeFactory.INST.createDot(ShapeFactory.INST.createPoint());
    dot.setDotStyle(DotStyle.DIAMOND);
    dot.setDotFillingCol(DviPsColors.BLUE);
    dot.setDiametre(3.0);
    shape.copy(dot);
    assertEquals(DviPsColors.BLUE, shape.getDotFillingCol());
    assertEquals(3.0, shape.getDiametre(), 0.0001);
    assertEquals(DotStyle.DIAMOND, shape.getDotStyle());
}
Also used : Dot(net.sf.latexdraw.model.api.shape.Dot) HelperTest(net.sf.latexdraw.HelperTest) Test(org.junit.Test)

Example 12 with Dot

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

the class PolymorphDotTest method testDotParams.

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

Example 13 with Dot

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

the class TestHandDotStyle method testPickLineColourSelection.

@Test
public void testPickLineColourSelection() {
    Cmds.of(activateHand, selectionAddDot, selectionAddBezier, selectionAddDot, setDotStyleFillable, updateIns).execute();
    final Color col = fillingB.getValue();
    Cmds.of(pickFillingColour).execute();
    assertEquals(fillingB.getValue(), ((Dot) drawing.getSelection().getShapeAt(0).orElseThrow()).getDotFillingCol().toJFX());
    assertEquals(fillingB.getValue(), ((Dot) drawing.getSelection().getShapeAt(2).orElseThrow()).getDotFillingCol().toJFX());
    assertNotEquals(col, fillingB.getValue());
}
Also used : Color(javafx.scene.paint.Color) Dot(net.sf.latexdraw.model.api.shape.Dot) Test(org.junit.Test)

Example 14 with Dot

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

the class TestCanvasCreation method testDrawDot.

@Test
public void testDrawDot() {
    final Point2D pos = point(canvas).query();
    Cmds.of(CmdFXVoid.of(() -> editing.setCurrentChoice(EditionChoice.DOT)), () -> moveTo(pos).clickOn(MouseButton.PRIMARY)).execute();
    assertEquals(1, drawing.size());
    assertTrue(drawing.getShapeAt(0).orElseThrow() instanceof Dot);
    final Dot sh = (Dot) drawing.getShapeAt(0).orElseThrow();
    assertEquals(-Canvas.getMargins() + canvas.screenToLocal(pos).getX(), sh.getPosition().getX(), 1d);
    assertEquals(-Canvas.getMargins() + canvas.screenToLocal(pos).getY(), sh.getPosition().getY(), 1d);
}
Also used : Point2D(javafx.geometry.Point2D) Dot(net.sf.latexdraw.model.api.shape.Dot) Test(org.junit.Test)

Example 15 with Dot

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

the class TestPencilDotStyle method testPickLineColourPencil.

@Test
public void testPickLineColourPencil() {
    Cmds.of(activatePencil, pencilCreatesDot, setDotStyleFillable, updateIns).execute();
    final Color col = fillingB.getValue();
    Cmds.of(pickFillingColour).execute();
    assertEquals(fillingB.getValue(), ((Dot) editing.createShapeInstance()).getDotFillingCol().toJFX());
    assertNotEquals(col, fillingB.getValue());
}
Also used : Color(javafx.scene.paint.Color) Dot(net.sf.latexdraw.model.api.shape.Dot) Test(org.junit.Test)

Aggregations

Dot (net.sf.latexdraw.model.api.shape.Dot)36 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)27 MethodSource (org.junit.jupiter.params.provider.MethodSource)22 Test (org.junit.Test)8 HelperTest (net.sf.latexdraw.HelperTest)5 Test (org.junit.jupiter.api.Test)5 Color (javafx.scene.paint.Color)2 Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)2 Point2D (javafx.geometry.Point2D)1 Axes (net.sf.latexdraw.model.api.shape.Axes)1 BezierCurve (net.sf.latexdraw.model.api.shape.BezierCurve)1 Circle (net.sf.latexdraw.model.api.shape.Circle)1 CircleArc (net.sf.latexdraw.model.api.shape.CircleArc)1 Ellipse (net.sf.latexdraw.model.api.shape.Ellipse)1 Freehand (net.sf.latexdraw.model.api.shape.Freehand)1 Grid (net.sf.latexdraw.model.api.shape.Grid)1 Plot (net.sf.latexdraw.model.api.shape.Plot)1 Polygon (net.sf.latexdraw.model.api.shape.Polygon)1 Polyline (net.sf.latexdraw.model.api.shape.Polyline)1 Rhombus (net.sf.latexdraw.model.api.shape.Rhombus)1