Package limelight.util

Examples of limelight.util.Box


{
  public void testReturnsPixles() throws Exception
  {
    assertEquals(50, new StaticPixelsValue(50).pixelsFor(100));
    assertEquals(66, new StaticPixelsValue(66).pixelsFor(100));
    assertEquals(50, new StaticPixelsValue(50).pixelsFor(new Box(0, 0, 100, 200)));
    assertEquals(66, new StaticPixelsValue(66).pixelsFor(new Box(0, 0, 100, 200)));
  }
View Full Code Here


    center = new AlignedXCoordinateValue(HorizontalAlignment.CENTER);
  }

  public void testGetX() throws Exception
  {
    assertEquals(25, center.getX(50, new Box(0, 0, 100, 100)));
  }
View Full Code Here

  }

  @Test
  public void shouldRactanglesAreCached() throws Exception
  {
    Box rectangle = panel.getBounds();

    assertSame(rectangle, panel.getBounds());

    panel.setSize(123, 456);
View Full Code Here

  }

  @Test
  public void shouldAbsoluteBoundsChangesWhenLocationChanges() throws Exception
  {
    Box bounds = panel.getAbsoluteBounds();

    panel.setLocation(123, 456);

    assertNotSame(bounds, panel.getAbsoluteBounds());
    assertEquals(123, panel.getAbsoluteBounds().x);
View Full Code Here

  }

  @Test
  public void shouldAbsoluteBoundsChangesWhenSizeChanges() throws Exception
  {
    Box bounds = panel.getAbsoluteBounds();

    assertSame(bounds, panel.getAbsoluteBounds());

    panel.setSize(123, 456);
View Full Code Here

  @Test
  public void shouldClearingCacheIsRecursive() throws Exception
  {
    panel.setLocation(20, 21);
    Box parentBounds = panel.getAbsoluteBounds();
    MockPanel child = new MockPanel();
    panel.add(child);
    child.setLocation(10, 11);
    Box childBounds = child.getAbsoluteBounds();

    panel.setLocation(30, 31);

    assertNotSame(parentBounds, panel.getAbsoluteBounds());
    assertNotSame(childBounds, child.getAbsoluteBounds());
View Full Code Here

    return index;
  }

  public Box getCaretShape(int caretIndex)
  {
    return new Box(caretIndex * CHAR_WIDTH, 0, 1, CHAR_HEIGHT);
  }
View Full Code Here

    assertEquals(67, new PercentagePixelsValue(66.6).pixelsFor(100));
  }

  public void testReturnsPercentageOfMinDimension() throws Exception
  {
    assertEquals(50, new PercentagePixelsValue(50.0).pixelsFor(new Box(0, 0, 100, 200)));
    assertEquals(67, new PercentagePixelsValue(66.6).pixelsFor(new Box(0, 0, 100, 200)));
  }
View Full Code Here

    assertEquals(false, top.equals(null));
  }

  public void testStartingY() throws Exception
  {
    Box area = new Box(0, 0, 100, 100);
    assertEquals(0, top.getY(100, area));
    assertEquals(0, top.getY(1, area));

    assertEquals(0, center.getY(100, area));
    assertEquals(25, center.getY(50, area));
View Full Code Here

    assertEquals(false, left.equals(null));
  }

  public void testStartingX() throws Exception
  {
    Box area = new Box(0, 0, 100, 100);
    assertEquals(0, left.getX(100, area));
    assertEquals(0, left.getX(1, area));

    assertEquals(0, center.getX(100, area));
    assertEquals(25, center.getX(50, area));
View Full Code Here

TOP

Related Classes of limelight.util.Box

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.