Search in sources :

Example 31 with Grid

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

the class TestParsingPsgrid method testGridLabels.

@Test
public void testGridLabels() {
    parser("\\psgrid[gridlabels=0.3](0,0)(0,0)(1,1)");
    final Grid grid = getShapeAt(0);
    assertEquals((int) (0.3 * Shape.PPC), grid.getLabelsSize());
}
Also used : Grid(net.sf.latexdraw.model.api.shape.Grid) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 32 with Grid

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

the class TestParsingPsgrid method testSubGridLabelColor.

@Test
public void testSubGridLabelColor() {
    parser("\\psgrid[subgridcolor=green](0,0)(0,0)(1,1)");
    final Grid grid = getShapeAt(0);
    assertEquals(DviPsColors.GREEN, grid.getSubGridColour());
}
Also used : Grid(net.sf.latexdraw.model.api.shape.Grid) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 33 with Grid

use of net.sf.latexdraw.model.api.shape.Grid 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 Grid grid = getShapeAt(0);
    assertEquals(0.3 * Shape.PPC, grid.getSubGridWidth(), 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 34 with Grid

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

the class TestParsingPsgrid method testGridSubGridDiv.

@ParameterizedTest
@ValueSource(ints = { 0, 3 })
public void testGridSubGridDiv(final int div) {
    parser("\\psgrid[subgriddiv=" + div + "](0,0)(0,0)(1,1)");
    final Grid grid = getShapeAt(0);
    assertEquals(div, grid.getSubGridDiv());
}
Also used : Grid(net.sf.latexdraw.model.api.shape.Grid) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 35 with Grid

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

the class TestParsingPsgrid method testParse2CoordInverted.

@Test
public void testParse2CoordInverted() {
    parser("\\psgrid(3,4)(1,2)");
    final Grid grid = getShapeAt(0);
    assertEquals(3d, grid.getOriginX(), 0.0001);
    assertEquals(4d, 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);
    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