Examples of IRectangle


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

  }


  @Test
  public void test2CoordinatesIntOppositeY() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"(10,50)(35,20)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(10.*IShape.PPC, rec.getPosition().getX(), 0.001);
    assertEquals(20.*-IShape.PPC, rec.getPosition().getY(), 0.001);
    assertEquals(25.*IShape.PPC, rec.getWidth(), 0.001);
    assertEquals(30.*IShape.PPC, rec.getHeight(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

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

  @Override
  public void testGetTopRightPoint() {
    assertTrue(Double.isNaN(shape.getTopRightPoint().getX()));
    assertTrue(Double.isNaN(shape.getTopRightPoint().getY()));
    IRectangle rec1 = setRectangle(5, 10, 6, 20);
    shape.addShape(rec1);
    assertEquals(ShapeFactory.createPoint(11, -10), shape.getTopRightPoint());

    IRectangle rec2 = setRectangle(90, 40, 10, 21);

    shape.addShape(rec2);
    assertEquals(ShapeFactory.createPoint(100, -10), shape.getTopRightPoint());
  }
View Full Code Here

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

  @Override
  @Test
  public void testGetGravityCentre() {
    assertEquals(ShapeFactory.createPoint(0, 0), shape.getGravityCentre());

    IRectangle rec1 = setRectangle(100, 2, 924, 12);
    IRectangle rec2 = setRectangle(200, 828, 17, 87);

    shape.addShape(rec1);
    shape.addShape(rec2);
    assertEquals(ShapeFactory.createPoint((100+100+924)/2., (828+2-12)/2.), shape.getGravityCentre());
  }
View Full Code Here

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


  @Override
  @Test
  public void testSetHasHatchings() {
    IRectangle rec1 = ShapeFactory.createRectangle();
    IRectangle rec2 = ShapeFactory.createRectangle();

    shape.addShape(rec1);
    shape.addShape(rec2);
    assertFalse(shape.hasHatchings());

    rec2.setFillingStyle(FillingStyle.HLINES);
    assertTrue(shape.hasHatchings());

    rec1.setFillingStyle(FillingStyle.HLINES);
    rec2.setFillingStyle(FillingStyle.GRAD);
    assertTrue(shape.hasHatchings());

    rec1.setFillingStyle(FillingStyle.HLINES);
    rec2.setFillingStyle(FillingStyle.VLINES);
    assertTrue(shape.hasHatchings());

    rec1.setFillingStyle(FillingStyle.PLAIN);
    rec2.setFillingStyle(FillingStyle.GRAD);
    assertFalse(shape.hasHatchings());
  }
View Full Code Here

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



  @Test
  public void test2CoordinatesInt() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"(10,20)(35,50)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(10.*IShape.PPC, rec.getPosition().getX(), 0.001);
    assertEquals(20.*-IShape.PPC, rec.getPosition().getY(), 0.001);
    assertEquals(25.*IShape.PPC, rec.getWidth(), 0.001);
    assertEquals(30.*IShape.PPC, rec.getHeight(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

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

  }


  @Test
  public void test2CoordinatesFloatSigns2() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"(-+.5,+-5)(+++35.5,--50.5)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(-.5*IShape.PPC, rec.getPosition().getX(), 0.001);
    assertEquals(-5.*-IShape.PPC, rec.getPosition().getY(), 0.001);
    assertEquals(36.*IShape.PPC, rec.getWidth(), 0.001);
    assertEquals(55.5*IShape.PPC, rec.getHeight(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

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

    assertFalse(shape.hasHatchings());
    grid.setFillingStyle(FillingStyle.CLINES_PLAIN);
    assertFalse(shape.hasHatchings());

    IRectangle rec1 = ShapeFactory.createRectangle();
    shape.addShape(rec1);
    assertFalse(shape.hasHatchings());

    rec1.setFillingStyle(FillingStyle.HLINES);
    assertTrue(shape.hasHatchings());
  }
View Full Code Here

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

    assertFalse(shape.hasGradient());
    grid.setFillingStyle(FillingStyle.GRAD);
    assertFalse(shape.hasGradient());

    IRectangle rec1 = ShapeFactory.createRectangle();
    shape.addShape(rec1);
    assertFalse(shape.hasGradient());

    rec1.setFillingStyle(FillingStyle.VLINES_PLAIN);
    assertFalse(shape.hasGradient());

    rec1.setFillingStyle(FillingStyle.GRAD);
    assertTrue(shape.hasGradient());
  }
View Full Code Here

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

  }


  @Test
  public void test2CoordinatesFloatSigns() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"(-+-.5,+--.5)(+++35.5,--50.5)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(.5*IShape.PPC, rec.getPosition().getX(), 0.001);
    assertEquals(.5*-IShape.PPC, rec.getPosition().getY(), 0.001);
    assertEquals(35.*IShape.PPC, rec.getWidth(), 0.001);
    assertEquals(50.*IShape.PPC, rec.getHeight(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

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


  @Override
  @Test
  public void testGetSetGradColEnd() {
    IRectangle rec1 = ShapeFactory.createRectangle();
    IRectangle rec2 = ShapeFactory.createRectangle();

    // The test is useful only if the shape is stylable.
    assertTrue(rec1.isInteriorStylable());

    shape.addShape(rec1);
    shape.addShape(rec2);

    shape.setGradColEnd(Color.CYAN);
    assertEquals(Color.CYAN, rec1.getGradColEnd());
    assertEquals(Color.CYAN, rec2.getGradColEnd());
  }
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.