Package net.sf.latexdraw.glib.models.interfaces.shape

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IGrid


  }


  @Test
  public void testConstructors() {
    IGrid grid = ShapeFactory.createGrid(ShapeFactory.createPoint());
    assertTrue(grid.getGridEndX()>=grid.getGridStartX());
    assertTrue(grid.getGridEndY()>=grid.getGridStartY());
    HelperTest.assertEqualsDouble(0., grid.getPosition().getX());
    HelperTest.assertEqualsDouble(0., grid.getPosition().getY());
  }
View Full Code Here


import org.junit.Test;

public class TestParsingPsgrid extends TestPSTParser {
  @Test
  public void testGridXUnit() throws ParseException {
    IGrid grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[xunit=20in]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(1., grid.getUnit(), 0.00001);
    grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[xunit=0.3]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(1., grid.getUnit(), 0.00001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testGridYUnit() throws ParseException {
    IGrid grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[yunit=20in]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(1., grid.getUnit(), 0.00001);
    grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[yunit=0.3]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(1., grid.getUnit(), 0.00001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testGridUnit() throws ParseException {
    IGrid grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[unit=20in]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(20./PSTricksConstants.INCH_VAL_CM, grid.getUnit(), 0.00001);
    grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[unit=0.3]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(0.3, grid.getUnit(), 0.00001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testGridSubGridWidth() throws ParseException {
    IGrid grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[subgridwidth=20in]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(20.*IShape.PPC/PSTricksConstants.INCH_VAL_CM, grid.getSubGridWidth(), 0.00001);
    grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[subgridwidth=0.3]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(0.3*IShape.PPC, grid.getSubGridWidth(), 0.00001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testGridLabels() throws ParseException {
    IGrid grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[gridlabels=20in]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals((int)(20.*IShape.PPC/PSTricksConstants.INCH_VAL_CM), grid.getLabelsSize());
    grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[gridlabels=0.3]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals((int)(0.3*IShape.PPC), grid.getLabelsSize());
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testGridSubGridDiv() throws ParseException {
    IGrid grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[subgriddiv=3]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(3, grid.getSubGridDiv());
    grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[subgriddiv=0]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(0, grid.getSubGridDiv());
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testSubGridDots() throws ParseException {
    IGrid grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[subgriddots=3]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(3, grid.getSubGridDots());
    grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[subgriddots=0]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(0, grid.getSubGridDots());
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testGridDots() throws ParseException {
    IGrid grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[griddots=3]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(3, grid.getGridDots());
    grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[griddots=0]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(0, grid.getGridDots());
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testSubGridLabelColor() throws ParseException {
    IGrid grid = (IGrid)parser.parsePSTCode("\\"+getCommandName()+"[subgridcolor=green]" +getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(Color.GREEN, grid.getSubGridColour());
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

TOP

Related Classes of net.sf.latexdraw.glib.models.interfaces.shape.IGrid

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.