Package com.eclipsesource.tabris.passepartout

Examples of com.eclipsesource.tabris.passepartout.Bounds


  @Test
  public void testUsesParentAsParentForControl() {
    Composite composite = new Composite( shell, SWT.NONE );
    UIEnvironment environment = UIEnvironmentFactory.createEnvironment( composite );

    Bounds parentBounds = environment.getParentBounds();

    assertEquals( BoundsUtil.getBounds( shell.getBounds() ), parentBounds );
  }
View Full Code Here


  public void testUsesShellAsReferenceForItem() {
    ToolBar toolBar = new ToolBar( shell, SWT.NONE );
    ToolItem item = new ToolItem( toolBar, SWT.NONE );
    UIEnvironment environment = UIEnvironmentFactory.createEnvironment( item );

    Bounds parentBounds = environment.getParentBounds();

    assertEquals( BoundsUtil.getBounds( shell.getBounds() ), parentBounds );
  }
View Full Code Here


public class PassPartoutTestUtil {

  public static UIEnvironment createEnvironment() {
    return createEnvironment( new Bounds( 0, 0, 0, 0 ) );
  }
View Full Code Here

    new Layouter( PassPartoutTestUtil.createEnvironment(), null );
  }

  @Test
  public void testHas16ColumnsForWidth_1872() {
    Layouter layouter = new Layouter( createEnvironment( new Bounds( 0, 0, 1872, 100 ) ), createConfig() );

    int columns = layouter.getColumns();

    assertEquals( 16, columns );
  }
View Full Code Here

    assertEquals( 16, columns );
  }

  @Test
  public void testHas8ColumnsForWidth_720() {
    Layouter layouter = new Layouter( createEnvironment( new Bounds( 0, 0, 720, 100 ) ), createConfig() );

    int columns = layouter.getColumns();

    assertEquals( 8, columns );
  }
View Full Code Here

    assertEquals( 8, columns );
  }

  @Test
  public void testHas4ColumnsForWidthSmaller_720() {
    Layouter layouter = new Layouter( createEnvironment( new Bounds( 0, 0, 719, 100 ) ), createConfig() );

    int columns = layouter.getColumns();

    assertEquals( 4, columns );
  }
View Full Code Here

    assertEquals( 4, columns );
  }

  @Test
  public void testComputesBoundsWithoutInstrutions() {
    Layouter layouter = new Layouter( createEnvironment( new Bounds( 0, 0, 600, 200 ) ), createConfig() );

    Bounds bounds = layouter.computeBounds( new Bounds( 0, 0, 100, 100 ), new ArrayList<Instruction>() );

    assertEquals( new Bounds( 0, 0, 150, 100 ), bounds );
  }
View Full Code Here

    assertEquals( new Bounds( 0, 0, 150, 100 ), bounds );
  }

  @Test
  public void testComputesBoundsWithoutColumnInstrutions() {
    Layouter layouter = new Layouter( createEnvironment( new Bounds( 0, 0, 600, 200 ) ), createConfig() );
    ArrayList<Instruction> instructions = new ArrayList<Instruction>();
    instructions.add( new ColumnsInstruction( 2 ) );

    Bounds bounds = layouter.computeBounds( new Bounds( 0, 0, 100, 100 ), instructions );

    assertEquals( new Bounds( 0, 0, 300, 100 ), bounds );
  }
View Full Code Here

    assertEquals( new Bounds( 0, 0, 300, 100 ), bounds );
  }

  @Test
  public void testComputesBoundsWithoutHeightInstrutions() {
    Layouter layouter = new Layouter( createEnvironment( new Bounds( 0, 0, 600, 200 ) ), createConfig() );
    ArrayList<Instruction> instructions = new ArrayList<Instruction>();
    instructions.add( new HeightInstruction( PassePartout.px( 300 ) ) );

    Bounds bounds = layouter.computeBounds( new Bounds( 0, 0, 100, 100 ), instructions );

    assertEquals( new Bounds( 0, 0, 150, 300 ), bounds );
  }
View Full Code Here

    assertEquals( new Bounds( 0, 0, 150, 300 ), bounds );
  }

  @Test
  public void testComputesBoundsWithMarginInstrutions() {
    Layouter layouter = new Layouter( createEnvironment( new Bounds( 0, 0, 600, 200 ) ), createConfig() );
    ArrayList<Instruction> instructions = new ArrayList<Instruction>();
    instructions.add( new MarginInstruction( px( 5 ), px( 10 ), px( 20 ), px( 30 ) ) );

    Bounds bounds = layouter.computeBounds( new Bounds( 0, 0, 100, 100 ), instructions );

    assertEquals( new Bounds( 30, 5, 110, 75 ), bounds );
  }
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.