Package com.eclipsesource.tabris.passepartout

Examples of com.eclipsesource.tabris.passepartout.Bounds


    new InstructionExtractor( null );
  }

  @Test
  public void testPicksComplientRule() {
    InstructionExtractor extractor = new InstructionExtractor( createEnvironment( new Bounds( 0, 0, 100, 100 ) ) );
    Instruction instruction = PassePartout.columns( 5 );
    Rule rule = PassePartout.when( PassePartout.minWidth( PassePartout.px( 90 ) ) ).then( instruction );
    List<Rule> rules = new ArrayList<Rule>();
    rules.add( rule );
View Full Code Here


    assertSame( instruction, instructions.get( 0 ) );
  }

  @Test
  public void testPicksComplientRuleWithMultipleRules() {
    InstructionExtractor extractor = new InstructionExtractor( createEnvironment( new Bounds( 0, 0, 100, 100 ) ) );
    Instruction instruction = PassePartout.columns( 5 );
    Rule rule = PassePartout.when( PassePartout.minWidth( PassePartout.px( 90 ) ) ).then( instruction );
    List<Rule> rules = new ArrayList<Rule>();
    rules.add( PassePartout.when( PassePartout.minWidth( PassePartout.px( 110 ) ) ).then( PassePartout.columns( 10 ) ) );
    rules.add( rule );
View Full Code Here

    assertSame( instruction, instructions.get( 0 ) );
  }

  @Test
  public void testPicksComplientRuleWithMultipleConditionsAndWithMultipleRules() {
    InstructionExtractor extractor = new InstructionExtractor( createEnvironment( new Bounds( 0, 0, 100, 100 ) ) );
    Instruction instruction = PassePartout.columns( 5 );
    Rule rule = PassePartout.when( PassePartout.minWidth( PassePartout.px( 90 ) ) ).and( maxWidth( PassePartout.px( 110 ) ) ).then( instruction );
    List<Rule> rules = new ArrayList<Rule>();
    rules.add( PassePartout.when( PassePartout.minWidth( PassePartout.px( 110 ) ) ).then( PassePartout.columns( 10 ) ) );
    rules.add( rule );
View Full Code Here

    assertSame( instruction, instructions.get( 0 ) );
  }

  @Test
  public void testPicksNoRuleWithMultipleOneNoComplientCondition() {
    InstructionExtractor extractor = new InstructionExtractor( createEnvironment( new Bounds( 0, 0, 100, 100 ) ) );
    Instruction instruction = PassePartout.columns( 5 );
    Rule rule = PassePartout.when( minWidth( px( 90 ) ) ).and( maxWidth( px( 99 ) ) ).then( instruction );
    List<Rule> rules = new ArrayList<Rule>();
    rules.add( rule );
View Full Code Here

    assertTrue( instructions.isEmpty() );
  }

  @Test
  public void testCombinesComplientRulesWithMultipleRules() {
    InstructionExtractor extractor = new InstructionExtractor( createEnvironment( new Bounds( 0, 0, 100, 100 ) ) );
    List<Rule> rules = new ArrayList<Rule>();
    Instruction instruction = PassePartout.columns( 5 );
    Instruction instruction2 = PassePartout.columns( 10 );
    rules.add( PassePartout.when( minWidth( px( 90 ) ) ).then( instruction ) );
    rules.add( PassePartout.when( minWidth( px( 95 ) ) ).then( instruction2 ) );
View Full Code Here

    assertSame( instruction2, instructions.get( 1 ) );
  }

  @Test
  public void testReturnsEmptyInstructionsWithoutComplientRule() {
    InstructionExtractor extractor = new InstructionExtractor( createEnvironment( new Bounds( 0, 0, 80, 100 ) ) );
    List<Rule> rules = new ArrayList<Rule>();
    Instruction instruction = PassePartout.columns( 5 );
    Instruction instruction2 = PassePartout.columns( 10 );
    rules.add( PassePartout.when( minWidth( px( 90 ) ) ).then( instruction ) );
    rules.add( PassePartout.when( minWidth( px( 95 ) ) ).then( instruction2 ) );
View Full Code Here

  public void testisAlwaysTrue() {
    AlwaysTrueContidtion contidtion = new AlwaysTrueContidtion();

    assertTrue( contidtion.compliesWith( null ) );
    assertTrue( contidtion.compliesWith( createEnvironment() ) );
    assertTrue( contidtion.compliesWith( createEnvironment( new Bounds( 100, 100, 100, 100 ) ) ) );
  }
View Full Code Here

  }

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

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

    assertFalse( complies );
  }
View Full Code Here

  }

  @Test
  public void testCompliesWithWidthSameThanMaxWidth() {
    MaxWidthCondition condition = new MaxWidthCondition( new Pixel( 100 ) );
    Bounds bounds = new Bounds( 10, 10, 100, 0 );

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

    assertTrue( complies );
  }
View Full Code Here

  }

  @Test
  public void testCompliesWithWidthSmallerThanMaxWidth() {
    MaxWidthCondition condition = new MaxWidthCondition( new Pixel( 100 ) );
    Bounds bounds = new Bounds( 10, 10, 90, 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.