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

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


  }


  @Test
  public void testConstructor1() {
    IDot dot1 = ShapeFactory.createDot(ShapeFactory.createPoint());

    assertTrue(dot1.getDiametre()>0);
    assertNotNull(dot1.getDotStyle());
    assertNotNull(dot1.getPosition());
    HelperTest.assertEqualsDouble(0., dot1.getPosition().getX());
    HelperTest.assertEqualsDouble(0., dot1.getPosition().getY());
  }
View Full Code Here


  }


  @Test
  public void testConstructor3() {
    IDot dot1 = ShapeFactory.createDot(null);

    assertTrue(dot1.getDiametre()>0);
    assertNotNull(dot1.getDotStyle());
    assertNotNull(dot1.getPosition());
    HelperTest.assertEqualsDouble(0., dot1.getPosition().getX());
    HelperTest.assertEqualsDouble(0., dot1.getPosition().getY());

    dot1 = ShapeFactory.createDot(ShapeFactory.createPoint(-1, 2));
    HelperTest.assertEqualsDouble(-1., dot1.getPosition().getX());
    HelperTest.assertEqualsDouble(2., dot1.getPosition().getY());
  }
View Full Code Here

import org.junit.Ignore;
import org.junit.Test;

public class TestParsingPSdot extends TestParsingShape {
  @Test public void test_psset_unit_yunit() throws ParseException {
    IDot dot = (IDot)parser.parsePSTCode("\\psset{unit=2,yunit=3}\\psdot(1,1)").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals(2.*IShape.PPC, dot.getX(), 0.000001);
    assertEquals(-2.*3.*IShape.PPC, dot.getY(), 0.000001);
  }
View Full Code Here

    assertEquals(2.*IShape.PPC, dot.getX(), 0.000001);
    assertEquals(-2.*3.*IShape.PPC, dot.getY(), 0.000001);
  }

  @Test public void test_psset_unit_xunit() throws ParseException {
    IDot dot = (IDot)parser.parsePSTCode("\\psset{unit=2,xunit=3}\\psdot(1,1)").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals(2.*3.*IShape.PPC, dot.getX(), 0.000001);
    assertEquals(-2.*IShape.PPC, dot.getY(), 0.000001);
  }
View Full Code Here

  }

  @Test public void test_psset_dot_unit_dot() throws ParseException {
    IGroup gp = parser.parsePSTCode("\\psdot(1,1)\\psset{unit=2}\\psdot(1,1)").get(); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    IDot dot = (IDot)gp.getShapeAt(1);
    assertEquals(2.*IShape.PPC, dot.getX(), 0.000001);
    assertEquals(-2.*IShape.PPC, dot.getY(), 0.000001);
    dot = (IDot)gp.getShapeAt(0);
    assertEquals(IShape.PPC, dot.getX(), 0.000001);
    assertEquals(-IShape.PPC, dot.getY(), 0.000001);
  }
View Full Code Here

    assertEquals(IShape.PPC, dot.getX(), 0.000001);
    assertEquals(-IShape.PPC, dot.getY(), 0.000001);
  }

  @Test public void test_psset_unit() throws ParseException {
    IDot dot = (IDot)parser.parsePSTCode("\\psset{unit=2}\\psdot(1,1)").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals(2.*IShape.PPC, dot.getX(), 0.000001);
    assertEquals(-2.*IShape.PPC, dot.getY(), 0.000001);
  }
View Full Code Here

  }


  @Test
  public void testDotAngle() throws ParseException {
    IDot dot =  (IDot)parser.parsePSTCode("\\"+getCommandName()+"[dotangle=90]"+getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(Math.PI/2., dot.getRotationAngle(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testDotScale2num() throws ParseException {
    IDot dot1 =  (IDot)parser.parsePSTCode("\\"+getCommandName()+getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$
    IDot dot2 = (IDot)parser.parsePSTCode("\\"+getCommandName()+"[dotscale=2 3]"+getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(dot1.getDiametre()*2., dot2.getDiametre(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testDotScale1num() throws ParseException {
    IDot dot1 =  (IDot)parser.parsePSTCode("\\"+getCommandName()+getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$
    IDot dot2 = (IDot)parser.parsePSTCode("\\"+getCommandName()+"[dotscale=2]"+getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(dot1.getDiametre()*2., dot2.getDiametre(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testDotsizeNoUnit() throws ParseException {
    IDot dot =  (IDot)parser.parsePSTCode("\\"+getCommandName()+"[dotsize=1.5 2]"+getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(1.5*IShape.PPC+2.*PSTricksConstants.DEFAULT_LINE_WIDTH*IShape.PPC, dot.getDiametre(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

TOP

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

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.