Package com.eclipsesource.tabris.passepartout

Examples of com.eclipsesource.tabris.passepartout.Bounds


    new Stacker( null );
  }

  @Test
  public void testStacksTwoRectanglesHorizontal() {
    Stacker stacker = new Stacker( new Bounds( 0, 0, 200, 600 ) );

    Bounds bounds1 = stacker.stack( 100, 100 );
    Bounds bounds2 = stacker.stack( 100, 100 );

    assertPosition( bounds1, 0, 0 );
    assertPosition( bounds2, 100, 0 );
  }
View Full Code Here


    assertPosition( bounds2, 100, 0 );
  }

  @Test
  public void testStacksThreeRectanglesWithLineBreak() {
    Stacker stacker = new Stacker( new Bounds( 0, 0, 200, 600 ) );

    Bounds bounds1 = stacker.stack( 100, 100 );
    Bounds bounds2 = stacker.stack( 100, 100 );
    Bounds bounds3 = stacker.stack( 100, 100 );

    assertPosition( bounds1, 0, 0 );
    assertPosition( bounds2, 100, 0 );
    assertPosition( bounds3, 0, 100 );
  }
View Full Code Here

    assertPosition( bounds3, 0, 100 );
  }

  @Test
  public void testStacksFourRectanglesWithLineBreak() {
    Stacker stacker = new Stacker( new Bounds( 0, 0, 200, 600 ) );

    Bounds bounds1 = stacker.stack( 100, 100 );
    Bounds bounds2 = stacker.stack( 100, 100 );
    Bounds bounds3 = stacker.stack( 100, 100 );
    Bounds bounds4 = stacker.stack( 100, 100 );

    assertPosition( bounds1, 0, 0 );
    assertPosition( bounds2, 100, 0 );
    assertPosition( bounds3, 0, 100 );
    assertPosition( bounds4, 100, 100 );
View Full Code Here

    assertPosition( bounds4, 100, 100 );
  }

  @Test
  public void testStacksFourRectanglesWithLineBreakAndUsesBiggestHeightAsY() {
    Stacker stacker = new Stacker( new Bounds( 0, 0, 200, 600 ) );

    Bounds bounds1 = stacker.stack( 100, 200 );
    Bounds bounds2 = stacker.stack( 100, 100 );
    Bounds bounds3 = stacker.stack( 100, 100 );
    Bounds bounds4 = stacker.stack( 100, 100 );

    assertPosition( bounds1, 0, 0 );
    assertPosition( bounds2, 100, 0 );
    assertPosition( bounds3, 0, 200 );
    assertPosition( bounds4, 100, 200 );
View Full Code Here

    assertPosition( bounds4, 100, 200 );
  }

  @Test
  public void testCorrectsWidthUpLeftOverPixel() {
    Stacker stacker = new Stacker( new Bounds( 0, 0, 604, 300 ) );

    Bounds bounds1 = stacker.stack( 201, 100 );
    Bounds bounds2 = stacker.stack( 201, 100 );
    Bounds bounds3 = stacker.stack( 201, 100 );

    assertPosition( bounds1, 0, 0 );
    assertPosition( bounds2, 201, 0 );
    assertBounds( bounds3, 402, 0, 202, 100 );
  }
View Full Code Here

    assertBounds( bounds3, 402, 0, 202, 100 );
  }

  @Test
  public void testCorrectsWidthDownLeftOverPixel() {
    Stacker stacker = new Stacker( new Bounds( 0, 0, 604, 300 ) );

    Bounds bounds1 = stacker.stack( 202, 100 );
    Bounds bounds2 = stacker.stack( 202, 100 );
    Bounds bounds3 = stacker.stack( 202, 100 );

    assertPosition( bounds1, 0, 0 );
    assertPosition( bounds2, 202, 0 );
    assertBounds( bounds3, 404, 0, 200, 100 );
  }
View Full Code Here

public class BoundsUtil {

  public static Bounds getBounds( Rectangle rectangle ) {
    whenNull( rectangle ).throwIllegalArgument( "Rectangle must not be null" );
    return new Bounds( rectangle.x, rectangle.y, rectangle.width, rectangle.height );
  }
View Full Code Here

    return new Bounds( rectangle.x, rectangle.y, rectangle.width, rectangle.height );
  }

  public static Bounds getBounds( Point point ) {
    whenNull( point ).throwIllegalArgument( "Point must not be null" );
    return new Bounds( 0, 0, point.x, point.y );
  }
View Full Code Here

  public Bounds computeBounds( Bounds originalBounds, int parentFontSize ) {
    int x = getX( originalBounds, parentFontSize );
    int y = getY( originalBounds, parentFontSize );
    int width = getWidth( originalBounds, parentFontSize );
    int height = getHeight( originalBounds, parentFontSize );
    return new Bounds( x, y, width, height );
  }
View Full Code Here

    this.stacker = new Stacker( this.environment.getParentBounds() );
  }

  public Bounds computeBounds( Bounds preferedBounds, List<Instruction> instructions ) {
    if( isExcluded( instructions ) ) {
      return new Bounds( 0, 0, 0, 0 );
    }
    return calculateBounds( preferedBounds, instructions );
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.tabris.passepartout.Bounds

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.