use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.
the class TestParsingPsgrid method testGridUnitin.
@Test
public void testGridUnitin() {
parser("\\psgrid[unit=20in](0,0)(0,0)(1,1)");
final Grid grid = getShapeAt(0);
assertEquals(20d / PSTricksConstants.INCH_VAL_CM, grid.getUnit(), 0.00001);
}
use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.
the class TestGrid method testCopy.
@Test
public void testCopy() {
final Grid shape2 = ShapeFactory.INST.createGrid(ShapeFactory.INST.createPoint());
shape2.setGridDots(45);
shape2.setSubGridDots(55);
shape2.setGridLabelsColour(DviPsColors.CYAN);
shape2.setSubGridColour(DviPsColors.GREEN);
shape2.setUnit(0.6);
shape2.setGridWidth(12);
shape2.setSubGridWidth(24);
shape2.setSubGridDiv(32);
shape2.setXLabelSouth(false);
shape2.setYLabelWest(false);
shape.copy(shape2);
assertEquals(shape2.getGridDots(), shape.getGridDots());
assertEquals(shape2.getSubGridDiv(), shape2.getSubGridDiv());
assertEquals(shape2.getGridLabelsColour(), shape.getGridLabelsColour());
assertEquals(shape2.getSubGridColour(), shape.getSubGridColour());
assertEqualsDouble(shape2.getUnit(), shape.getUnit());
assertEqualsDouble(shape2.getGridWidth(), shape.getGridWidth());
assertEqualsDouble(shape2.getSubGridWidth(), shape.getSubGridWidth());
assertEquals(shape2.getSubGridDiv(), shape.getSubGridDiv());
assertFalse(shape2.isXLabelSouth());
assertFalse(shape2.isYLabelWest());
}
use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.
the class TestCanvasCreation method testDrawGrid.
@Test
public void testDrawGrid() {
final Point2D pos = point(canvas).query();
Cmds.of(CmdFXVoid.of(() -> editing.setCurrentChoice(EditionChoice.GRID)), () -> moveTo(pos).clickOn(MouseButton.PRIMARY)).execute();
assertEquals(1, drawing.size());
assertTrue(drawing.getShapeAt(0).orElseThrow() instanceof Grid);
final Grid sh = (Grid) drawing.getShapeAt(0).orElseThrow();
assertEquals(-Canvas.getMargins() + canvas.screenToLocal(pos).getX(), sh.getPosition().getX(), 1d);
assertEquals(-Canvas.getMargins() + canvas.screenToLocal(pos).getY(), sh.getPosition().getY(), 1d);
}
use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.
the class TestHandGridStyle method testPickLineColourHand.
@Test
public void testPickLineColourHand() {
Cmds.of(activateHand, selectionAddDot, selectionAddGrid, selectionAddGrid, updateIns).execute();
final Color col = colourSubGrid.getValue();
Cmds.of(pickcolourSubGrid).execute();
assertEquals(colourSubGrid.getValue(), ((Grid) drawing.getSelection().getShapeAt(1).orElseThrow()).getSubGridColour().toJFX());
assertEquals(colourSubGrid.getValue(), ((Grid) drawing.getSelection().getShapeAt(2).orElseThrow()).getSubGridColour().toJFX());
assertNotEquals(col, colourSubGrid.getValue());
}
use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.
the class TestPencilGridStyle method testPickcolourLabelsColourPencil.
@Test
public void testPickcolourLabelsColourPencil() {
Cmds.of(activatePencil, pencilCreatesGrid, updateIns).execute();
final Color col = colourLabels.getValue();
Cmds.of(pickcolourLabels).execute();
assertEquals(colourLabels.getValue(), ((Grid) editing.createShapeInstance()).getGridLabelsColour().toJFX());
assertNotEquals(col, colourLabels.getValue());
}
Aggregations