Package com.eclipsesource.tabris.passepartout

Examples of com.eclipsesource.tabris.passepartout.Bounds


    MarginInstruction instruction = new MarginInstruction( new Em( BigDecimal.ONE ),
                                                                     new Em( BigDecimal.ONE ),
                                                                     new Em( BigDecimal.ONE ),
                                                                     new Em( BigDecimal.ONE ) );

    Bounds bounds = instruction.computeBounds( new Bounds( 0, 0, 100, 100 ), 10 );

    assertEquals( 10, bounds.getX() );
    assertEquals( 10, bounds.getY() );
    assertEquals( 80, bounds.getWidth() );
    assertEquals( 80, bounds.getHeight() );
  }
View Full Code Here


    MarginInstruction instruction = new MarginInstruction( new Percentage( BigDecimal.valueOf( 10 ) ),
                                                                     new Percentage( BigDecimal.valueOf( 10 ) ),
                                                                     new Percentage( BigDecimal.valueOf( 10 ) ),
                                                                     new Percentage( BigDecimal.valueOf( 10 ) ) );

    Bounds bounds = instruction.computeBounds( new Bounds( 0, 0, 100, 100 ), 16 );

    assertEquals( 10, bounds.getX() );
    assertEquals( 10, bounds.getY() );
    assertEquals( 80, bounds.getWidth() );
    assertEquals( 80, bounds.getHeight() );
  }
View Full Code Here

    MarginInstruction instruction = new MarginInstruction( new Percentage( BigDecimal.valueOf( 10 ) ),
                                                                     new Em( BigDecimal.ONE ),
                                                                     new Percentage( BigDecimal.valueOf( 10 ) ),
                                                                     new Pixel( 10 ) );

    Bounds bounds = instruction.computeBounds( new Bounds( 0, 0, 100, 100 ), 10 );

    assertEquals( 10, bounds.getX() );
    assertEquals( 10, bounds.getY() );
    assertEquals( 80, bounds.getWidth() );
    assertEquals( 80, bounds.getHeight() );
  }
View Full Code Here

  @Test
  public void testCalculatesHeightWithPercentage() {
    HeightInstruction instruction = new HeightInstruction( new Percentage( BigDecimal.valueOf( 50 ) ) );

    int height = instruction.computeHeight( new Bounds( 0, 0, 100, 100 ), 16 );

    assertEquals( 50, height );
  }
View Full Code Here

  @Test
  public void testCalculatesHeightWithPercentageAndZeroParentBounds() {
    HeightInstruction instruction = new HeightInstruction( new Percentage( BigDecimal.valueOf( 50 ) ) );

    int height = instruction.computeHeight( new Bounds( 0, 0, 0, 0 ), 16 );

    assertEquals( 0, height );
  }
View Full Code Here

  @Test
  public void testUsesDefaultHeightForUnsuportedBounds() {
    HeightInstruction instruction = new HeightInstruction( mock( Unit.class ) );

    int height = instruction.computeHeight( new Bounds( 0, 0, 100, 100 ), 16 );

    assertEquals( 0, height );
  }
View Full Code Here

  @Test
  public void testUsesDisplayAsReferenceForShell() {
    UIEnvironment environment = UIEnvironmentFactory.createEnvironment( shell );

    Bounds referenceBounds = environment.getReferenceBounds();

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

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

    Bounds referenceBounds = environment.getReferenceBounds();

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

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

    Bounds referenceBounds = environment.getReferenceBounds();

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

  @Test
  public void testUsesDisplayAsParentForShell() {
    UIEnvironment environment = UIEnvironmentFactory.createEnvironment( shell );

    Bounds parentBounds = environment.getParentBounds();

    assertEquals( BoundsUtil.getBounds( shell.getDisplay().getBounds() ), parentBounds );
  }
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.