Search in sources :

Example 26 with Dot

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

the class TestParsingPSdot method testDotStyleOK.

@ParameterizedTest
@MethodSource(value = "cmdDotStyleProvider")
public void testDotStyleOK(final String cmd, final DotStyle style) {
    parser(cmd + "[dotstyle=" + style.getPSTToken() + "](1,1)");
    final Dot dot = getShapeAt(0);
    assertEquals(style, dot.getDotStyle());
}
Also used : Dot(net.sf.latexdraw.model.api.shape.Dot) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 27 with Dot

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

the class TestParsingPSdot method testNoCoordinate.

@Test
public void testNoCoordinate() {
    parser("\\psdot");
    final Dot dot = getShapeAt(0);
    assertEquals(0d, dot.getPtAt(0).getX(), 0.0001);
    assertEquals(0d, dot.getPtAt(0).getY(), 0.0001);
}
Also used : Dot(net.sf.latexdraw.model.api.shape.Dot) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 28 with Dot

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

the class TestParsingPSdot method testCoordinatesCm.

@ParameterizedTest
@MethodSource(value = "cmds")
public void testCoordinatesCm(final String cmd) {
    parser(cmd + "(35cm,20cm)");
    final Dot dot = getShapeAt(0);
    assertEquals(35d * Shape.PPC, dot.getPtAt(0).getX(), 0.0001);
    assertEquals(-20d * Shape.PPC, dot.getPtAt(0).getY(), 0.0001);
}
Also used : Dot(net.sf.latexdraw.model.api.shape.Dot) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 29 with Dot

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

the class TestPSTGeneralFeatures method testBugpssetsetOfShapes.

@Test
void testBugpssetsetOfShapes() {
    parser("\\psframe(0.5,0.5)(1.5,1.5)\\psdot[linewidth=1cm,dotsize=1](1,1)\\psset{unit=2}\\psframe(0.5,0.5)(1.5,1.5)\\psdot(2," + "2)");
    Rectangle rec = getShapeAt(0);
    assertEquals(0.5 * Shape.PPC, rec.getX(), 0.000001);
    assertEquals(-0.5 * Shape.PPC, rec.getY(), 0.000001);
    assertEquals(Shape.PPC, rec.getWidth(), 0.000001);
    assertEquals(Shape.PPC, rec.getHeight(), 0.000001);
    Dot dot = getShapeAt(1);
    assertEquals(Shape.PPC, dot.getX(), 0.000001);
    assertEquals(-Shape.PPC, dot.getY(), 0.000001);
    rec = getShapeAt(2);
    assertEquals(0.5 * 2d * Shape.PPC, rec.getX(), 0.000001);
    assertEquals(-0.5 * 2d * Shape.PPC, rec.getY(), 0.000001);
    assertEquals(2d * Shape.PPC, rec.getWidth(), 0.000001);
    assertEquals(2d * Shape.PPC, rec.getHeight(), 0.000001);
    dot = getShapeAt(3);
    assertEquals(2d * 2d * Shape.PPC, dot.getX(), 0.000001);
    assertEquals(-2d * 2d * Shape.PPC, dot.getY(), 0.000001);
}
Also used : Rectangle(net.sf.latexdraw.model.api.shape.Rectangle) Dot(net.sf.latexdraw.model.api.shape.Dot) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 30 with Dot

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

the class TestPSTGeneralFeatures method testBug756733.

@Test
void testBug756733() {
    // https://bugs.launchpad.net/latexdraw/+bug/756733
    parser("\\psset{unit=5}\\psdot(1,1)\\psdot(1,10pt)");
    Dot dot = getShapeAt(0);
    assertEquals(5d * Shape.PPC, dot.getX(), 0.000001);
    assertEquals(5d * -Shape.PPC, dot.getY(), 0.000001);
    dot = getShapeAt(1);
    assertEquals(5d * Shape.PPC, dot.getX(), 0.000001);
    assertEquals(10d * -Shape.PPC / PSTricksConstants.CM_VAL_PT, dot.getY(), 0.000001);
}
Also used : Dot(net.sf.latexdraw.model.api.shape.Dot) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

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