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

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


  }


  @Test
  public void testConstructors() {
    ICircle circle = ShapeFactory.createCircle();

    assertEquals(4, circle.getNbPoints());
    HelperTest.assertEqualsDouble(circle.getWidth(), circle.getHeight());
    assertTrue(circle.getHeight()>0);
  }
View Full Code Here


  }


  @Test
  public void testConstructors2() {
    ICircle circle = ShapeFactory.createCircle();

    HelperTest.assertEqualsDouble(4, circle.getNbPoints());
    HelperTest.assertEqualsDouble(circle.getWidth(), circle.getHeight());
    assertTrue(circle.getHeight()>0);
  }
View Full Code Here

  }


  @Test
  public void testConstructors3() {
    ICircle circle;

    try {
      circle = ShapeFactory.createCircle(null, 10.);
      fail();
    }catch(IllegalArgumentException e) {/* */}

    try {
      circle = ShapeFactory.createCircle(ShapeFactory.createPoint(Double.NaN, 1), 10.);
      fail();
    }catch(IllegalArgumentException e) {/* */}

    try {
      circle = ShapeFactory.createCircle(ShapeFactory.createPoint(1, Double.NEGATIVE_INFINITY), 10.);
      fail();
    }catch(IllegalArgumentException e) {/* */}

    try {
      circle = ShapeFactory.createCircle(ShapeFactory.createPoint(1, 1), -10.);
      fail();
    }catch(IllegalArgumentException e) {/* */}

    try {
      circle = ShapeFactory.createCircle(ShapeFactory.createPoint(1, 1), 0.);
      fail();
    }catch(IllegalArgumentException e) {/* */}

    circle = ShapeFactory.createCircle(ShapeFactory.createPoint(1, 2), 10.);

    HelperTest.assertEqualsDouble(6., circle.getGravityCentre().getX());
    HelperTest.assertEqualsDouble(-3., circle.getGravityCentre().getY());
    HelperTest.assertEqualsDouble(10., circle.getWidth());
    assertEquals(4, circle.getNbPoints());
    HelperTest.assertEqualsDouble(circle.getWidth(), circle.getHeight());
  }
View Full Code Here

  @Test public void testShape0() {
    assertTrue(group.getShapeAt(0) instanceof IGroup);
    final IGroup gp = (IGroup) group.getShapeAt(0);
    assertEquals(2, gp.size());
    final ICircle circle = (ICircle) gp.getShapeAt(0);
    final IGroup gp2 = (IGroup) gp.getShapeAt(1);
    assertEquals(2, gp2.size());
    final IText txt1 = (IText) gp2.getShapeAt(0);
    final IText txt2 = (IText) gp2.getShapeAt(1);

    assertEquals(Color.BLACK, circle.getLineColour());
    assertTrue(circle.isFilled());
    assertEquals(Color.WHITE, circle.getFillingCol());
    assertEquals(60., circle.getWidth(),0.0001);
    assertEquals(580., circle.getPosition().getX(),0.0001);
    assertEquals(180., circle.getPosition().getY(),0.0001);
    assertEquals(2., circle.getThickness(),0.0001);
    assertEquals(LineStyle.SOLID, circle.getLineStyle());
    assertEquals(BorderPos.INTO, circle.getBordersPosition());
    assertEquals(0., circle.getRotationAngle(),0.0001);
    assertFalse(circle.hasShadow());
    assertFalse(circle.hasDbleBord());
    assertEquals("\\normalsize{State}", txt1.getText()); //$NON-NLS-1$
    assertEquals("\\normalsize{2}", txt2.getText()); //$NON-NLS-1$
    assertEquals(Color.BLACK, txt1.getLineColour());
    assertEquals(Color.BLACK, txt2.getLineColour());
    assertEquals(591.7, txt1.getPosition().getX(), 0.1);
View Full Code Here



  @Test
  public void testLineColourIsFillColour() throws ParseException {
    ICircle cir =  (ICircle)parser.parsePSTCode("\\psset{linecolor=green}\\"+getCommandName()+"(35pt,20pt){10pt}").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(Color.GREEN, cir.getFillingCol());
    assertEquals(Color.GREEN, cir.getLineColour());
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testLineStylePlain() throws ParseException {
    ICircle cir =  (ICircle)parser.parsePSTCode("\\psset{linestyle=dotted}\\"+getCommandName()+"(35pt,20pt){10pt}").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(LineStyle.SOLID, cir.getLineStyle());
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testNoDbleBord() throws ParseException {
    ICircle cir =  (ICircle)parser.parsePSTCode("\\psset{doubleline=true}\\"+getCommandName()+"(35pt,20pt){10pt}").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertFalse(cir.hasDbleBord());
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here



  @Test
  public void testNoShadow() throws ParseException {
    ICircle cir =  (ICircle)parser.parsePSTCode("\\psset{shadow=true}\\"+getCommandName()+"(35pt,20pt){10pt}").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertFalse(cir.hasShadow());
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here



  @Test
  public void testBorderMustBeInto() throws ParseException {
    ICircle cir =  (ICircle)parser.parsePSTCode("\\psset{dimen=middle}\\"+getCommandName()+"(35pt,20pt){10pt}").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(BorderPos.INTO, cir.getBordersPosition());
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testMustBeFilled() throws ParseException {
    ICircle cir =  (ICircle)parser.parsePSTCode("\\"+getCommandName()+"(35pt,20pt){10pt}").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(FillingStyle.PLAIN, cir.getFillingStyle());
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

TOP

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

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.