Package org.tinyuml.draw

Examples of org.tinyuml.draw.DoubleDimension


      .with(eq(mockDrawingContext.proxy()));
    // drawing the icon
    mockParent.expects(once()).method("getAbsoluteX1").will(returnValue(100.0));
    mockParent.expects(once()).method("getAbsoluteY1").will(returnValue(50.0));
    mockCompartment.expects(atLeastOnce()).method("getSize")
      .will(returnValue(new DoubleDimension(100, 50)));
    mockDrawingContext.expects(atLeastOnce()).method("drawRectangle");
    mockedElement.draw((DrawingContext) mockDrawingContext.proxy());
  }
View Full Code Here


  // *************************************************************************
  // ******** Resizing operations
  // ***************************************
 
  private void doRecalculateSizeExpectations() {
    Dimension2D mainsize = new DoubleDimension(50, 30);
    Dimension2D opsize = new DoubleDimension(35, 10);
    Dimension2D mainminsize = new DoubleDimension(50, 30);
    Dimension2D opminsize = new DoubleDimension(35, 10);
    mockMainCompartment.expects(once()).method("recalculateSize")
      .with(eq(mockDrawingContext.proxy()));
    mockOpCompartment.expects(once()).method("recalculateSize")
      .with(eq(mockDrawingContext.proxy()));
    mockMainCompartment.expects(atLeastOnce()).method("getSize")
View Full Code Here

  /**
   * Tests the recalculateSize() method without labels.
   */
  public void testRecalculateSizeNoLabels() {
    mockParent.expects(once()).method("getSize")
      .will(returnValue(new DoubleDimension(10, 4)));
    compartment.recalculateSize((DrawingContext) mockDrawingContext.proxy());
    assertEquals(new DoubleDimension(MIN_WIDTH, MIN_HEIGHT),
      compartment.getSize());
    assertTrue(compartment.isValid());
  }
View Full Code Here

  /**
   * Parent is wider than the compartment, width will follow.
   */
  public void testRecalculateSizeNoLabelsLargerParent() {
    mockParent.expects(atLeastOnce()).method("getSize")
      .will(returnValue(new DoubleDimension(200, 80)));
    compartment.recalculateSize((DrawingContext) mockDrawingContext.proxy());
    assertEquals(new DoubleDimension(200, MIN_HEIGHT),
      compartment.getSize());   
    assertTrue(compartment.isValid());
  }
View Full Code Here

    mockLabel.expects(atLeastOnce()).method("getOrigin")
      .will(returnValue(new Point2D.Double(0.0, 0.0)));
    mockLabel.expects(atLeastOnce()).method("setOrigin")
      .with(eq(0.0), eq(5.0));
    mockLabel.expects(atLeastOnce()).method("getSize")
      .will(returnValue(new DoubleDimension(80.0, 12.0)));
  }
View Full Code Here

    // Sets a size larger than the minimum
    mockLabel.expects(once()).method("invalidate");
    compartment.setSize(120, 40);
   
    // parent width is smaller even than minimum
    setRecalculateSizeWithOneLabelExpectations(new DoubleDimension(10, 4));
    compartment.recalculateSize((DrawingContext) mockDrawingContext.proxy());
    assertEquals(120.0, compartment.getSize().getWidth());
  }
View Full Code Here

    mockLabel.expects(atLeastOnce()).method("invalidate");
    compartment.setSize(120, 40);

    // parent width is smaller than compartment width, but larger than
    // minimum
    setRecalculateSizeWithOneLabelExpectations(new DoubleDimension(90, 4));
    compartment.recalculateSize((DrawingContext) mockDrawingContext.proxy());
    assertEquals(90.0, compartment.getSize().getWidth());
  }
View Full Code Here

    // Sets a size larger than the minimum
    mockLabel.expects(atLeastOnce()).method("invalidate");
    compartment.setSize(120, 40);

    // parent width is greater than compartment width
    setRecalculateSizeWithOneLabelExpectations(new DoubleDimension(150, 4));
    compartment.recalculateSize((DrawingContext) mockDrawingContext.proxy());
    assertEquals(150.0, compartment.getSize().getWidth());
  }
View Full Code Here

   * Tests the draw() method.
   */
  public void testDraw() {
    setAddLabelExpectations();
    compartment.addLabel((Label) mockLabel.proxy());
    Dimension2D parentSize = new DoubleDimension(10, 4);
    setRecalculateSizeWithOneLabelExpectations(parentSize);
    Constraint[] rectParams = { eq(0.0), eq(0.0), eq(90.0), eq(22.0),
      eq(Color.WHITE) };
    mockParent.expects(once()).method("getAbsoluteX1").will(returnValue(0.0));
    mockParent.expects(once()).method("getAbsoluteY1").will(returnValue(0.0));
View Full Code Here

    mockCompartment.expects(once()).method("isValid").will(returnValue(false));
    assertFalse(lifeline.isValid());
    mockCompartment.expects(once()).method("recalculateSize")
      .with(eq(mockDrawingContext.proxy()));
    lifeline.recalculateSize((DrawingContext) mockDrawingContext.proxy());
    Dimension2D minsize = new DoubleDimension(20.0, 30.0);
    mockCompartment.expects(once()).method("getMinimumSize")
      .will(returnValue(minsize));
    assertEquals(minsize, lifeline.getMinimumSize());
    mockCompartment.expects(once()).method("setMinimumSize")
      .with(eq(10.0), eq(20.0));
    lifeline.setMinimumSize(10.0, 20.0);
    Dimension2D size = new DoubleDimension(22.0, 32.0);
    mockCompartment.expects(once()).method("getSize")
      .will(returnValue(size));
    assertEquals(size, lifeline.getSize());
    mockCompartment.expects(once()).method("setSize").with(eq(10.0), eq(20.0));
    lifeline.setSize(10.0, 20.0);
View Full Code Here

TOP

Related Classes of org.tinyuml.draw.DoubleDimension

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.