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);
}
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());
}
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());
}
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);
}
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());
}
Aggregations