use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.
the class TestParsingPsBegin method testBeginPsPictureWithGridAndShapesComplex.
@Test
public void testBeginPsPictureWithGridAndShapesComplex() {
parser("\\begin{pspicture}(-3,-3)(2,2)\n\\psgrid\n\\psframe(0,0)(2,2)\n\\psframe(1,1)(3,3)\n\\end{pspicture}");
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);
}
use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.
the class TestParsingPsBegin method testPspictureWithGrid.
@Test
public void testPspictureWithGrid() {
parser("\\pspicture\\psgrid\\endpspicture");
final Grid grid = getShapeAt(0);
assertEquals(10d, grid.getGridMaxX(), 0.001);
assertEquals(10d, grid.getGridMaxY(), 0.001);
assertEquals(0d, grid.getGridMinY(), 0.001);
assertEquals(0d, grid.getGridMinX(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.
the class TestParsingPsBegin method testBeginPsPictureWithGrid.
@Test
public void testBeginPsPictureWithGrid() {
parser("\\begin{pspicture}\\psgrid\\end{pspicture}");
final Grid grid = getShapeAt(0);
assertEquals(10d, grid.getGridMaxX(), 0.001);
assertEquals(10d, grid.getGridMaxY(), 0.001);
assertEquals(0d, grid.getGridMinY(), 0.001);
assertEquals(0d, grid.getGridMinX(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Grid 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 Grid grid = getShapeAt(0);
assertEquals(0.3, grid.getUnit(), 0.00001);
}
use of net.sf.latexdraw.model.api.shape.Grid 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 Grid grid = getShapeAt(0);
assertEquals(1.3 * Shape.PPC, grid.getGridWidth(), 0.001);
}
Aggregations