Examples of DoubleDimension


Examples of org.tinyuml.draw.DoubleDimension

  /**
   * 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

Examples of org.tinyuml.draw.DoubleDimension

  /**
   * Simulates a dragging operation for resizing on the NE corner.
   */
  public void testDragResizeNe() {
    Point2D origin = new Point2D.Double(0, 0);
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the NW handle (322+, 5-)
    selection.startDragging(324, 3);
    assertTrue(selection.isDragging());
    // make it a little bigger
    mockNode.expects(atLeastOnce()).method("getMinimumSize").
      will(returnValue(minimumSize));
    selection.updatePosition(340.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(2.0), eq(-8.0), eq(336.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(2.0, -8.0)),
           eq(new DoubleDimension(336.0, 433.0)));
    selection.stopDragging(340.0, -10.0);
    assertFalse(selection.isDragging());
  }
View Full Code Here

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

Examples of org.tinyuml.draw.DoubleDimension

  /**
   * 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

Examples of org.tinyuml.draw.DoubleDimension

  /**
   * 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

Examples of org.tinyuml.draw.DoubleDimension

  /**
   * 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

Examples of org.tinyuml.draw.DoubleDimension

  /**
   * 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

Examples of org.tinyuml.draw.DoubleDimension

    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

Examples of org.tinyuml.draw.DoubleDimension

    // 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

Examples of org.tinyuml.draw.DoubleDimension

    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
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.