Package org.tinyuml.draw

Examples of org.tinyuml.draw.DoubleDimension


  /**
   * Simulates a dragging operation for resizing with truncation, NW corner.
   */
  public void testDragResizeNeWithTruncation() {
    // At NE resize, the position is < 22 and > (425 - 20)
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the NW handle (2-, 5-)
    selection.startDragging(324, 3);
    assertTrue(selection.isDragging());
    // make it a little smaller, dragging it to the lower left
    mockNode.expects(atLeastOnce()).method("getMinimumSize").
View Full Code Here


  /**
   * Simulates a dragging operation for resizing on the SW corner.
   */
  public void testDragResizeSw() {
    Point2D origin = new Point2D.Double(0, 0);
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the SW handle (2-, 425+)
    selection.startDragging(1, 427);
    assertTrue(selection.isDragging());
    // make it a little bigger
    mockNode.expects(atLeastOnce()).method("getMinimumSize").
      will(returnValue(minimumSize));
    selection.updatePosition(-10.0, 440.0);
    // and draw it
    Mock mockDrawingContext = mock(DrawingContext.class);
    // don't forget that sizes are truncated to the local system'
    Constraint[] params = {eq(-9.0), eq(5.0), eq(331.0), eq(433.0), NULL};
    mockDrawingContext.expects(once()).method("drawRectangle").
      with(params);
    selection.draw((DrawingContext) mockDrawingContext.proxy());
    // stop dragging
    mockOperations.expects(once()).method("resizeElement").
      with(eq(selection.getElement()), eq(new Point2D.Double(-9.0, 5.0)),
           eq(new DoubleDimension(331.0, 433.0)));
    selection.stopDragging(-10.0, 440.0);
    assertFalse(selection.isDragging());
  }
View Full Code Here

  /**
   * Simulates a dragging operation for resizing with truncation, SW corner.
   */
  public void testDragResizeSwWithTruncation() {
    // At SW resize, the position is x > (322 - 20) and y < 22
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the SW handle (2-, 425+)
    selection.startDragging(1, 427);
    assertTrue(selection.isDragging());
    // make it a little smaller, dragging it to the lower left
    mockNode.expects(atLeastOnce()).method("getMinimumSize").
View Full Code Here

   */
  protected void setUp() {
    mockNode.expects(atLeastOnce()).method("getAbsoluteX").will(returnValue(x));
    mockNode.expects(atLeastOnce()).method("getAbsoluteY").will(returnValue(y));
    mockNode.expects(atLeastOnce()).method("getSize").
      will(returnValue(new DoubleDimension(width, height)));
    selection.setElement(node);   
  }
View Full Code Here

  // *****************************************
  /**
   * Simulates a dragging operation for resizing.
   */
  public void testDragResizeSe() {
    Dimension2D minimumSize = new DoubleDimension(10, 10);
    // start dragging somewhere in the SE handle (322+, 425+)
    selection.startDragging(324.0, 427.0);
    assertTrue(selection.isDragging());
    // make it a little bigger
    mockNode.expects(atLeastOnce()).method("getMinimumSize").
      will(returnValue(minimumSize));
    selection.updatePosition(330.0, 450.0);
    // and draw it
    Mock mockDrawingContext = mock(DrawingContext.class);
    // don't forget that sizes are truncated to the local system'
    Constraint[] params = {eq(2.0), eq(5.0), eq(326.0), eq(443.0), NULL};
    mockDrawingContext.expects(once()).method("drawRectangle").
      with(params);
    selection.draw((DrawingContext) mockDrawingContext.proxy());
    // stop dragging
    mockOperations.expects(once()).method("resizeElement").
      with(eq(selection.getElement()), eq(new Point2D.Double(2.0, 5.0)),
           eq(new DoubleDimension(326.0, 443.0)));
    selection.stopDragging(330.0, 450.0);
    assertFalse(selection.isDragging());
  }
View Full Code Here

  /**
   * Simulates a dragging operation for resizing with truncation.
   */
  public void testDragResizeSeWithTruncation() {
    // At SE resize, the position is < 22 and 25
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the SE handle (322+, 425+)
    selection.startDragging(324.0, 427.0);
    assertTrue(selection.isDragging());
    // make it a little smaller
    mockNode.expects(atLeastOnce()).method("getMinimumSize").
View Full Code Here

  /**
   * Simulates a dragging operation for resizing on the NW corner.
   */
  public void testDragResizeNw() {
    Point2D origin = new Point2D.Double(0, 0);
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the NW handle (2-, 5-)
    selection.startDragging(1, 3);
    assertTrue(selection.isDragging());
    // make it a little bigger
    mockNode.expects(atLeastOnce()).method("getMinimumSize").
      will(returnValue(minimumSize));
    selection.updatePosition(-10.0, -10.0);
    // and draw it
    Mock mockDrawingContext = mock(DrawingContext.class);
    // don't forget that sizes are truncated to the local system'
    Constraint[] params = {eq(-9.0), eq(-8.0), eq(331.0), eq(433.0), NULL};
    mockDrawingContext.expects(once()).method("drawRectangle").
      with(params);
    selection.draw((DrawingContext) mockDrawingContext.proxy());
    // stop dragging
    mockOperations.expects(once()).method("resizeElement").
      with(eq(selection.getElement()), eq(new Point2D.Double(-9.0, -8.0)),
           eq(new DoubleDimension(331.0, 433.0)));
    selection.stopDragging(-10.0, -10.0);
    assertFalse(selection.isDragging());
  }
View Full Code Here

  /**
   * Simulates a dragging operation for resizing with truncation, NW corner.
   */
  public void testDragResizeNwWithTruncation() {
    // At NW resize, the position is > (322 - 20) and (425 - 20)
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the NW handle (2-, 5-)
    selection.startDragging(1.0, 3.0);
    assertTrue(selection.isDragging());
    // make it a little smaller, dragging it to the lower right
    mockNode.expects(atLeastOnce()).method("getMinimumSize").
View Full Code Here

  // *************************************************************************
  // ******** Resizing operations
  // ***************************************
 
  private void doRecalculateSizeExpectations(double mainwidth) {
    Dimension2D mainsize = new DoubleDimension(mainwidth, 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()));
    mockAttrCompartment.expects(once()).method("recalculateSize")
      .with(eq(mockDrawingContext.proxy()));
    mockOpCompartment.expects(once()).method("recalculateSize")
View Full Code Here

    mockCompartment.expects(once()).method("setSize").with(eq(1.0), eq(2.0));
    mockedElement.setSize(1.0, 2.0);
    mockCompartment.expects(once()).method("setMinimumSize")
      .with(eq(3.0), eq(4.0));
    mockedElement.setMinimumSize(3.0, 4.0);
    Dimension2D minsize = new DoubleDimension(11.0, 12.0);
    Dimension2D size = new DoubleDimension(15.0, 18.0);
    mockCompartment.expects(once()).method("getSize").will(returnValue(size));
    assertEquals(size, mockedElement.getSize());
    mockCompartment.expects(once()).method("getMinimumSize")
      .will(returnValue(minsize));
    assertEquals(minsize, mockedElement.getMinimumSize());
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.