Package com.eclipsesource.tabris.passepartout.internal.unit

Examples of com.eclipsesource.tabris.passepartout.internal.unit.Em


    assertTrue( complies );
  }

  @Test
  public void testCompliesWithWidthSmallerThanMaxWidthEm() {
    MaxWidthCondition condition = new MaxWidthCondition( new Em( BigDecimal.TEN ) );
    Bounds bounds = new Bounds( 10, 10, 90, 0 );

    boolean complies = condition.compliesWith( new UIEnvironmentImpl( bounds, new Bounds( 0, 0, 0, 0 ), 16 ) );

    assertTrue( complies );
View Full Code Here


    assertTrue( complies );
  }

  @Test
  public void testCompliesNotWithWidthBiggerThanMaxWidthEm() {
    MaxWidthCondition condition = new MaxWidthCondition( new Em( BigDecimal.valueOf( 100 ) ) );
    Bounds bounds = new Bounds( 10, 10, 90, 0 );

    boolean complies = condition.compliesWith( new UIEnvironmentImpl( bounds, new Bounds( 0, 0, 0, 0 ), 16 ) );

    assertTrue( complies );
View Full Code Here

    assertFalse( complies );
  }

  @Test
  public void testCompliesWithWidthBiggerThanMinWidthInEm() {
    MinWidthCondition condition = new MinWidthCondition( new Em( BigDecimal.valueOf( 3 ) ) );
    Bounds bounds = new Bounds( 10, 10, 100, 0 );

    boolean complies = condition.compliesWith( new UIEnvironmentImpl( bounds, mock( Bounds.class ), 16 ) );

    assertTrue( complies );
View Full Code Here

    assertTrue( complies );
  }

  @Test
  public void testCompliesWithWidthSameThanMinWidthInEm() {
    MinWidthCondition condition = new MinWidthCondition( new Em( BigDecimal.valueOf( 10 ) ) );
    Bounds bounds = new Bounds( 10, 10, 160, 0 );

    boolean complies = condition.compliesWith( new UIEnvironmentImpl( bounds, mock( Bounds.class ), 16 ) );

    assertTrue( complies );
View Full Code Here

    assertTrue( complies );
  }

  @Test
  public void testCompliesNotWithWidthSmallerThanMinWidthInEm() {
    MinWidthCondition condition = new MinWidthCondition( new Em( BigDecimal.valueOf( 10 ) ) );
    Bounds bounds = new Bounds( 10, 10, 100, 0 );

    boolean complies = condition.compliesWith( new UIEnvironmentImpl( bounds, mock( Bounds.class ), 16 ) );

    assertFalse( complies );
View Full Code Here

    assertEquals( 90, bounds.getHeight() );
  }

  @Test
  public void testUsesEmToComputeMargins() {
    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() );
View Full Code Here

  }

  @Test
  public void testUsesMixedUnitsToComputeMargins() {
    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 );
View Full Code Here

    assertEquals( 23, height );
  }

  @Test
  public void testCalculatesHeightWithEm() {
    Em height = new Em( BigDecimal.valueOf( 1.5 ) );
    HeightInstruction instruction = new HeightInstruction( height );

    int actualHeight = instruction.computeHeight( mock( Bounds.class ), 100 );

    assertEquals( 150, actualHeight );
View Full Code Here

    UnitUtil.percentageToPixel( new Pixel( 23 ), 100 );
  }

  @Test
  public void testCalculatesEm() {
    int pixel = UnitUtil.emToPixel( new Em( BigDecimal.TEN ), 10 );

    assertEquals( 100, pixel );
  }
View Full Code Here

    assertEquals( 100, pixel );
  }

  @Test( expected = IllegalArgumentException.class )
  public void testCalculatesEmFailsWithNegativeFontSize() {
    UnitUtil.emToPixel( new Em( BigDecimal.TEN ), -10 );
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.tabris.passepartout.internal.unit.Em

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.