Package com.eclipsesource.tabris.passepartout

Examples of com.eclipsesource.tabris.passepartout.Bounds


  }

  @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


  }

  @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

  }

  @Test
  public void testCompliesWithWidthSmallerThanMaxWidthPercentage() {
    MaxWidthCondition condition = new MaxWidthCondition( new Percentage( BigDecimal.valueOf( 50 ) ) );
    Bounds bounds = new Bounds( 10, 10, 100, 0 );
    Bounds referenceBounds = new Bounds( 10, 10, 200, 0 );

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

    assertTrue( complies );
  }
View Full Code Here

  }

  @Test
  public void testCompliesNotWithWidthBiggerThanMaxWidthPercentage() {
    MaxWidthCondition condition = new MaxWidthCondition( new Percentage( BigDecimal.valueOf( 40 ) ) );
    Bounds bounds = new Bounds( 10, 10, 100, 0 );
    Bounds referenceBounds = new Bounds( 10, 10, 200, 0 );

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

    assertFalse( complies );
  }
View Full Code Here

    QueryNotifier notifier = new QueryNotifier();
    QueryListener listener = mock( QueryListener.class );
    QueryImpl query = new QueryImpl( new AlwaysTrueContidtion() );
    notifier.addQueryListener( query, listener );

    notifier.notifyListeners( createEnvironment( new Bounds( 0, 0, 0, 0 ) ) );

    verify( listener ).activated( query );
  }
View Full Code Here

    QueryImpl query = new QueryImpl( new AlwaysTrueContidtion() );
    Query query2 = new QueryImpl( new AlwaysTrueContidtion() ).and( new MaxWidthCondition( px( 99 ) ) );
    notifier.addQueryListener( query, listener );
    notifier.addQueryListener( query2, listener2 );

    notifier.notifyListeners( createEnvironment( new Bounds( 0, 0, 90, 0 ) ) );

    verify( listener ).activated( query );
    verify( listener2 ).activated( query2 );
  }
View Full Code Here

    QueryNotifier notifier = new QueryNotifier();
    QueryListener listener = mock( QueryListener.class );
    QueryImpl query = new QueryImpl( new AlwaysTrueContidtion() );
    notifier.addQueryListener( query, listener );

    notifier.notifyListeners( createEnvironment( new Bounds( 0, 0, 0, 0 ) ) );
    notifier.notifyListeners( createEnvironment( new Bounds( 0, 0, 0, 0 ) ) );

    verify( listener, times( 1 ) ).activated( query );
  }
View Full Code Here

    QueryNotifier notifier = new QueryNotifier();
    QueryListener listener = mock( QueryListener.class );
    QueryImpl query = new QueryImpl( new MaxWidthCondition( px( 100 ) ) );
    notifier.addQueryListener( query, listener );

    notifier.notifyListeners( createEnvironment( new Bounds( 0, 0, 99, 0 ) ) );
    notifier.notifyListeners( createEnvironment( new Bounds( 0, 0, 199, 0 ) ) );

    InOrder order = inOrder( listener );
    order.verify( listener ).activated( query );
    order.verify( listener ).deactivated( query );
  }
View Full Code Here

    QueryImpl query = new QueryImpl( new MaxWidthCondition( px( 100 ) ) );
    QueryImpl query2 = new QueryImpl( new MinWidthCondition( px( 101 ) ) );
    notifier.addQueryListener( query, listener );
    notifier.addQueryListener( query2, listener2 );

    notifier.notifyListeners( createEnvironment( new Bounds( 0, 0, 99, 0 ) ) );
    notifier.notifyListeners( createEnvironment( new Bounds( 0, 0, 199, 0 ) ) );
    notifier.notifyListeners( createEnvironment( new Bounds( 0, 0, 99, 0 ) ) );

    InOrder order = inOrder( listener, listener2 );
    order.verify( listener ).activated( query );
    order.verify( listener ).deactivated( query );
    order.verify( listener2 ).activated( query2 );
View Full Code Here

  }

  @Test
  public void testCompliesWithWidthBiggerThanMinWidth() {
    MinWidthCondition condition = new MinWidthCondition( new Pixel( 100 ) );
    Bounds bounds = new Bounds( 10, 10, 110, 0 );

    boolean complies = condition.compliesWith( createEnvironment( bounds ) );

    assertTrue( complies );
  }
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.