Search in sources :

Example 26 with Grid

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

the class TestParsingPsBegin method testPspictureWithGridAndShapesBasic.

@Test
public void testPspictureWithGridAndShapesBasic() {
    parser("\\pspicture(0,0)(2,2)\n\\psgrid\n\\psframe(0,0)(2,2)\n\\psframe(1,1)(3,3)\n\\endpspicture");
    final Grid grid = getShapeAt(0);
    final Rectangle rec1 = getShapeAt(1);
    final Rectangle rec2 = getShapeAt(2);
    assertEquals(0d, grid.getPosition().getX(), 0.001);
    assertEquals(0d, grid.getPosition().getY(), 0.001);
    assertEquals(0d, rec1.getPosition().getX(), 0.001);
    assertEquals(0d, rec1.getPosition().getY(), 0.001);
    assertEquals(Shape.PPC, rec2.getPosition().getX(), 0.001);
    assertEquals(-(double) Shape.PPC, rec2.getPosition().getY(), 0.001);
}
Also used : Grid(net.sf.latexdraw.model.api.shape.Grid) Rectangle(net.sf.latexdraw.model.api.shape.Rectangle) Test(org.junit.jupiter.api.Test)

Example 27 with Grid

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

the class TestParsingPsgrid method testGridColor.

@Test
public void testGridColor() {
    parser("\\psgrid[gridcolor=green](0,0)(0,0)(1,1)");
    final Grid grid = getShapeAt(0);
    assertEquals(DviPsColors.GREEN, grid.getLineColour());
}
Also used : Grid(net.sf.latexdraw.model.api.shape.Grid) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 28 with Grid

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

the class TestParsingPsgrid method testParse0Coord.

@Test
public void testParse0Coord() {
    parser("\\begin{pspicture}(2,2)(5,5)\\psgrid\\end{pspicture}");
    final Grid grid = getShapeAt(0);
    assertEquals(0d, grid.getOriginX(), 0.0001);
    assertEquals(0d, grid.getOriginY(), 0.0001);
    assertEquals(2d, grid.getGridMinX(), 0.0001);
    assertEquals(2d, grid.getGridMinY(), 0.0001);
    assertEquals(5d, grid.getGridMaxX(), 0.0001);
    assertEquals(5d, grid.getGridMaxY(), 0.0001);
    assertTrue(grid.isXLabelSouth());
    assertTrue(grid.isYLabelWest());
}
Also used : Grid(net.sf.latexdraw.model.api.shape.Grid) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 29 with Grid

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

the class TestParsingPsgrid method testGridXUnit.

@Test
public void testGridXUnit() {
    parser("\\psgrid[xunit=0.3](0,0)(0,0)(1,1)");
    final Grid grid = getShapeAt(0);
    assertEquals(1d, grid.getUnit(), 0.00001);
}
Also used : Grid(net.sf.latexdraw.model.api.shape.Grid) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 30 with Grid

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

the class TestParsingPsgrid method testParse2Coord.

@Test
public void testParse2Coord() {
    parser("\\psgrid(1,2)(3,4)");
    final Grid grid = getShapeAt(0);
    assertEquals(1d, grid.getOriginX(), 0.0001);
    assertEquals(2d, grid.getOriginY(), 0.0001);
    assertEquals(1d, grid.getGridMinX(), 0.0001);
    assertEquals(2d, grid.getGridMinY(), 0.0001);
    assertEquals(3d, grid.getGridMaxX(), 0.0001);
    assertEquals(4d, grid.getGridMaxY(), 0.0001);
    assertTrue(grid.isXLabelSouth());
    assertTrue(grid.isYLabelWest());
}
Also used : Grid(net.sf.latexdraw.model.api.shape.Grid) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Grid (net.sf.latexdraw.model.api.shape.Grid)41 Test (org.junit.jupiter.api.Test)28 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)26 Test (org.junit.Test)8 Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)5 Color (javafx.scene.paint.Color)4 HelperTest (net.sf.latexdraw.HelperTest)3 StandardGrid (net.sf.latexdraw.model.api.shape.StandardGrid)3 ValueSource (org.junit.jupiter.params.provider.ValueSource)3 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 Dot (net.sf.latexdraw.model.api.shape.Dot)1 Ellipse (net.sf.latexdraw.model.api.shape.Ellipse)1 Freehand (net.sf.latexdraw.model.api.shape.Freehand)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