Examples of ISquare


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

  }


  @Test
  public void testConstructors() {
    ISquare sq = ShapeFactory.createSquare();
    assertEquals(4, sq.getNbPoints());

    try {
      sq = ShapeFactory.createSquare(null, 10);
      fail();
    }catch(IllegalArgumentException ex) { /* */ }
    try {
      sq = ShapeFactory.createSquare(ShapeFactory.createPoint(Double.NaN, 0), 10);
      fail();
    }catch(IllegalArgumentException ex) { /* */ }
    try {
      sq = ShapeFactory.createSquare(ShapeFactory.createPoint(), 0);
      fail();
    }catch(IllegalArgumentException ex) { /* */ }
    try {
      sq = ShapeFactory.createSquare(ShapeFactory.createPoint(), -10);
      fail();
    }catch(IllegalArgumentException ex) { /* */ }
    try {
      sq = ShapeFactory.createSquare(ShapeFactory.createPoint(), Double.NaN);
      fail();
    }catch(IllegalArgumentException ex) { /* */ }
    try {
      sq = ShapeFactory.createSquare(ShapeFactory.createPoint(), Double.POSITIVE_INFINITY);
      fail();
    }catch(IllegalArgumentException ex) { /* */ }
    try {
      sq = ShapeFactory.createSquare(ShapeFactory.createPoint(), Double.NEGATIVE_INFINITY);
      fail();
    }catch(IllegalArgumentException ex) { /* */ }

    sq = ShapeFactory.createSquare(ShapeFactory.createPoint(20, 26), 11);
    HelperTest.assertEqualsDouble(20., sq.getPosition().getX());
    HelperTest.assertEqualsDouble(26., sq.getPosition().getY());
    HelperTest.assertEqualsDouble(11., sq.getWidth());
    HelperTest.assertEqualsDouble(11., sq.getHeight());
  }
View Full Code Here

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

    Interactor<?,?,?> link = getLink("DnD2AddShape"); //$NON-NLS-1$

    assertTrue(link.getAction() instanceof AddShape);
    assertTrue(((AddShape)link.getAction()).shape().get() instanceof ISquare);

    ISquare square = (ISquare) ((AddShape)link.getAction()).shape().get();
    checkShape(square);
    HelperTest.assertEqualsDouble(100., square.getGravityCentre().getX());
    HelperTest.assertEqualsDouble(300., square.getGravityCentre().getY());
    assertTrue(square.getWidth()>0);
    assertTrue(square.getHeight()>0);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.