Search in sources :

Example 21 with IGrid

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

the class TestHandGridStyle method testPickcolourLabelsColourHand.

@Test
public void testPickcolourLabelsColourHand() {
    new CompositeGUIVoidCommand(activateHand, selectionAddDot, selectionAddGrid, selectionAddGrid, updateIns).execute();
    Color col = colourLabels.getValue();
    pickcolourLabels.execute();
    assertEquals(colourLabels.getValue(), ((IGrid) drawing.getSelection().getShapeAt(1)).getGridLabelsColour().toJFX());
    assertEquals(colourLabels.getValue(), ((IGrid) drawing.getSelection().getShapeAt(2)).getGridLabelsColour().toJFX());
    assertNotEquals(col, colourLabels.getValue());
}
Also used : CompositeGUIVoidCommand(net.sf.latexdraw.instruments.CompositeGUIVoidCommand) Color(javafx.scene.paint.Color) IGrid(net.sf.latexdraw.models.interfaces.shape.IGrid) Test(org.junit.Test)

Example 22 with IGrid

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

the class TestCanvasCreation method testDrawGrid.

@Test
public void testDrawGrid() {
    pencil.setCurrentChoice(EditionChoice.GRID);
    final Point2D pos = point(canvas).query();
    moveTo(pos).clickOn(MouseButton.PRIMARY).sleep(SLEEP);
    assertEquals(1, drawing.size());
    assertTrue(drawing.getShapeAt(0) instanceof IGrid);
    final IGrid sh = (IGrid) drawing.getShapeAt(0);
    assertEquals(-Canvas.getMargins() + canvas.screenToLocal(pos).getX(), sh.getPosition().getX(), 1d);
    assertEquals(-Canvas.getMargins() + canvas.screenToLocal(pos).getY(), sh.getPosition().getY(), 1d);
}
Also used : Point2D(javafx.geometry.Point2D) IGrid(net.sf.latexdraw.models.interfaces.shape.IGrid) Test(org.junit.Test)

Example 23 with IGrid

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

the class TestPencilGridStyle method testPickcolourLabelsColourPencil.

@Test
public void testPickcolourLabelsColourPencil() {
    new CompositeGUIVoidCommand(activatePencil, pencilCreatesGrid, updateIns).execute();
    Color col = colourLabels.getValue();
    pickcolourLabels.execute();
    assertEquals(colourLabels.getValue(), ((IGrid) pencil.createShapeInstance()).getGridLabelsColour().toJFX());
    assertNotEquals(col, colourLabels.getValue());
}
Also used : CompositeGUIVoidCommand(net.sf.latexdraw.instruments.CompositeGUIVoidCommand) Color(javafx.scene.paint.Color) IGrid(net.sf.latexdraw.models.interfaces.shape.IGrid) Test(org.junit.Test)

Example 24 with IGrid

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

the class TestParsingPsgrid method testParse3Coord.

@Test
public void testParse3Coord() {
    parser("\\psgrid(0,-1)(1,2)(3,4)");
    final IGrid grid = getShapeAt(0);
    assertEquals(0d, grid.getOriginX(), 0.0001);
    assertEquals(-1d, grid.getOriginY(), 0.0001);
    assertEquals(1d, grid.getGridStartX(), 0.0001);
    assertEquals(2d, grid.getGridStartY(), 0.0001);
    assertEquals(3d, grid.getGridEndX(), 0.0001);
    assertEquals(4d, grid.getGridEndY(), 0.0001);
    assertTrue(grid.isXLabelSouth());
    assertTrue(grid.isYLabelWest());
}
Also used : IGrid(net.sf.latexdraw.models.interfaces.shape.IGrid) Test(org.junit.Test)

Example 25 with IGrid

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

the class TestParsingPsgrid method testGridSubGridWidth.

@Test
public void testGridSubGridWidth() {
    parser("\\psgrid[subgridwidth=0.3](0,0)(0,0)(1,1)");
    final IGrid grid = getShapeAt(0);
    assertEquals(0.3 * IShape.PPC, grid.getSubGridWidth(), 0.00001);
}
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