Search in sources :

Example 36 with Grid

use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.

the class TestGrid method testDuplicate.

@Test
public void testDuplicate() {
    shape.setGridDots(45);
    shape.setSubGridDots(55);
    shape.setGridLabelsColour(DviPsColors.CYAN);
    shape.setSubGridColour(DviPsColors.GREEN);
    shape.setUnit(0.6);
    shape.setGridWidth(12);
    shape.setSubGridWidth(24);
    shape.setSubGridDiv(32);
    shape.setXLabelSouth(false);
    shape.setYLabelWest(false);
    final Grid dup = shape.duplicate();
    assertEquals(dup.getGridDots(), shape.getGridDots());
    assertEquals(dup.getSubGridDiv(), shape.getSubGridDiv());
    assertEquals(dup.getGridLabelsColour(), shape.getGridLabelsColour());
    assertEquals(dup.getSubGridColour(), shape.getSubGridColour());
    assertEqualsDouble(dup.getUnit(), shape.getUnit());
    assertEqualsDouble(dup.getGridWidth(), shape.getGridWidth());
    assertEqualsDouble(dup.getSubGridWidth(), shape.getSubGridWidth());
    assertEquals(dup.getSubGridDiv(), shape.getSubGridDiv());
    assertFalse(dup.isXLabelSouth());
    assertFalse(dup.isYLabelWest());
}
Also used : Grid(net.sf.latexdraw.model.api.shape.Grid) StandardGrid(net.sf.latexdraw.model.api.shape.StandardGrid) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 37 with Grid

use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.

the class TestGrid method testConstructors.

@Test
public void testConstructors() {
    final Grid grid = ShapeFactory.INST.createGrid(ShapeFactory.INST.createPoint());
    assertThat(grid.getGridEndX()).isGreaterThanOrEqualTo(grid.getGridStartX());
    assertThat(grid.getGridEndY()).isGreaterThanOrEqualTo(grid.getGridStartY());
    assertEqualsDouble(0d, grid.getPosition().getX());
    assertEqualsDouble(0d, grid.getPosition().getY());
}
Also used : Grid(net.sf.latexdraw.model.api.shape.Grid) StandardGrid(net.sf.latexdraw.model.api.shape.StandardGrid) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 38 with Grid

use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.

the class TestPencilGridStyle method testPickLineColourPencil.

@Test
public void testPickLineColourPencil() {
    Cmds.of(activatePencil, pencilCreatesGrid, updateIns).execute();
    final Color col = colourSubGrid.getValue();
    Cmds.of(pickcolourSubGrid).execute();
    assertEquals(colourSubGrid.getValue(), ((Grid) editing.createShapeInstance()).getSubGridColour().toJFX());
    assertNotEquals(col, colourSubGrid.getValue());
}
Also used : Color(javafx.scene.paint.Color) Grid(net.sf.latexdraw.model.api.shape.Grid) Test(org.junit.Test)

Example 39 with Grid

use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.

the class TestParsingPsgrid method testGridYUnitin.

@Test
public void testGridYUnitin() {
    parser("\\psgrid[yunit=20in](0,0)(0,0)(1,1)");
    final Grid grid = getShapeAt(0);
    assertEquals(1d, grid.getUnit(), 0.00001);
}
Also used : Grid(net.sf.latexdraw.model.api.shape.Grid) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 40 with Grid

use of net.sf.latexdraw.model.api.shape.Grid in project latexdraw by arnobl.

the class TestParsingPsgrid method testParse3CoordInverted.

@Test
public void testParse3CoordInverted() {
    parser("\\psgrid(0,-1)(3,4)(1,2)");
    final Grid 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);
    assertFalse(grid.isXLabelSouth());
    assertFalse(grid.isYLabelWest());
}
Also used : Grid(net.sf.latexdraw.model.api.shape.Grid) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Grid (net.sf.latexdraw.model.api.shape.Grid)41 Test (org.junit.jupiter.api.Test)28 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)26 Test (org.junit.Test)8 Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)5 Color (javafx.scene.paint.Color)4 HelperTest (net.sf.latexdraw.HelperTest)3 StandardGrid (net.sf.latexdraw.model.api.shape.StandardGrid)3 ValueSource (org.junit.jupiter.params.provider.ValueSource)3 Point2D (javafx.geometry.Point2D)1 Axes (net.sf.latexdraw.model.api.shape.Axes)1 BezierCurve (net.sf.latexdraw.model.api.shape.BezierCurve)1 Circle (net.sf.latexdraw.model.api.shape.Circle)1 CircleArc (net.sf.latexdraw.model.api.shape.CircleArc)1 Dot (net.sf.latexdraw.model.api.shape.Dot)1 Ellipse (net.sf.latexdraw.model.api.shape.Ellipse)1 Freehand (net.sf.latexdraw.model.api.shape.Freehand)1 Plot (net.sf.latexdraw.model.api.shape.Plot)1 Polygon (net.sf.latexdraw.model.api.shape.Polygon)1 Polyline (net.sf.latexdraw.model.api.shape.Polyline)1