Search in sources :

Example 1 with IGrid

use of net.sf.latexdraw.models.interfaces.shape.IGrid in project latexdraw by arnobl.

the class TestParsingPsgrid method testParse2Coord.

@Test
public void testParse2Coord() {
    parser("\\psgrid(1,2)(3,4)");
    final IGrid 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 : IGrid(net.sf.latexdraw.models.interfaces.shape.IGrid) Test(org.junit.Test)

Example 2 with IGrid

use of net.sf.latexdraw.models.interfaces.shape.IGrid in project latexdraw by arnobl.

the class TestParsingPsgrid method testParse2CoordInverted.

@Test
public void testParse2CoordInverted() {
    parser("\\psgrid(3,4)(1,2)");
    final IGrid grid = getShapeAt(0);
    assertEquals(3d, grid.getOriginX(), 0.0001);
    assertEquals(4d, 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);
    assertFalse(grid.isXLabelSouth());
    assertFalse(grid.isYLabelWest());
}
Also used : IGrid(net.sf.latexdraw.models.interfaces.shape.IGrid) Test(org.junit.Test)

Example 3 with IGrid

use of net.sf.latexdraw.models.interfaces.shape.IGrid in project latexdraw by arnobl.

the class TestParsingPsgrid method testGridUnit.

@Test
public void testGridUnit() {
    parser("\\psgrid[unit=0.3](0,0)(0,0)(1,1)");
    final IGrid grid = getShapeAt(0);
    assertEquals(0.3, grid.getUnit(), 0.00001);
}
Also used : IGrid(net.sf.latexdraw.models.interfaces.shape.IGrid) Test(org.junit.Test)

Example 4 with IGrid

use of net.sf.latexdraw.models.interfaces.shape.IGrid in project latexdraw by arnobl.

the class TestParsingPsgrid method testGridXUnitCM.

@Test
public void testGridXUnitCM() {
    parser("\\psgrid[xunit=20in](0,0)(0,0)(1,1)");
    final IGrid grid = getShapeAt(0);
    assertEquals(1d, grid.getUnit(), 0.00001);
}
Also used : IGrid(net.sf.latexdraw.models.interfaces.shape.IGrid) Test(org.junit.Test)

Example 5 with IGrid

use of net.sf.latexdraw.models.interfaces.shape.IGrid in project latexdraw by arnobl.

the class TestParsingPsgrid method testGridWidthcm.

@Test
public void testGridWidthcm() {
    parser("\\psgrid[gridwidth=1.3cm](0,0)(0,0)(1,1)");
    final IGrid grid = getShapeAt(0);
    assertEquals(1.3 * IShape.PPC, grid.getGridWidth(), 0.001);
}
Also used : IGrid(net.sf.latexdraw.models.interfaces.shape.IGrid) Test(org.junit.Test)

Aggregations

IGrid (net.sf.latexdraw.models.interfaces.shape.IGrid)43 Test (org.junit.Test)36 IRectangle (net.sf.latexdraw.models.interfaces.shape.IRectangle)5 Color (javafx.scene.paint.Color)4 CompositeGUIVoidCommand (net.sf.latexdraw.instruments.CompositeGUIVoidCommand)4 Theory (org.junit.experimental.theories.Theory)4 HelperTest (net.sf.latexdraw.HelperTest)3 Point2D (javafx.geometry.Point2D)1 IAxes (net.sf.latexdraw.models.interfaces.shape.IAxes)1 IBezierCurve (net.sf.latexdraw.models.interfaces.shape.IBezierCurve)1 ICircle (net.sf.latexdraw.models.interfaces.shape.ICircle)1 ICircleArc (net.sf.latexdraw.models.interfaces.shape.ICircleArc)1 IDot (net.sf.latexdraw.models.interfaces.shape.IDot)1 IEllipse (net.sf.latexdraw.models.interfaces.shape.IEllipse)1 IFreehand (net.sf.latexdraw.models.interfaces.shape.IFreehand)1 IPlot (net.sf.latexdraw.models.interfaces.shape.IPlot)1 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)1 IPolygon (net.sf.latexdraw.models.interfaces.shape.IPolygon)1 IPolyline (net.sf.latexdraw.models.interfaces.shape.IPolyline)1 IRhombus (net.sf.latexdraw.models.interfaces.shape.IRhombus)1