Examples of DoubleDimension


Examples of org.tinyuml.draw.DoubleDimension

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

Examples of org.tinyuml.draw.DoubleDimension

   * 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

Examples of org.tinyuml.draw.DoubleDimension

    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

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

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

Examples of org.tinyuml.draw.DoubleDimension

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