Package com.eclipsesource.tabris.passepartout

Examples of com.eclipsesource.tabris.passepartout.Instruction


  }

  @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 );

    List<Instruction> instructions = extractor.extract( rules );
View Full Code Here


  }

  @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

  }

  @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

  }

  @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 );

    List<Instruction> instructions = extractor.extract( rules );
View Full Code Here

  @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 ) );

    List<Instruction> instructions = extractor.extract( rules );
View Full Code Here

  @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 ) );

    List<Instruction> instructions = extractor.extract( rules );
View Full Code Here

  }

  @Test
  public void testHasInstructions() {
    ArrayList<Instruction> instructions = new ArrayList<Instruction>();
    Instruction instruction = mock( Instruction.class );
    instructions.add( instruction );
    RuleImpl rule = new RuleImpl( new ArrayList<Condition>(), instructions );

    List<Instruction> actualInstructions = rule.getInstructions();
View Full Code Here

  }

  @Test
  public void testThenAddsInstruction() {
    QueryImpl query = new QueryImpl( mock( Condition.class ) );
    Instruction instruction = mock( Instruction.class );

    Rule rule = query.then( instruction );

    List<Instruction> instructions = rule.getInstructions();
    assertEquals( instructions.get( 0 ), instruction );
View Full Code Here

  }

  @Test
  public void testThenAddsAllInstructions() {
    QueryImpl query = new QueryImpl( mock( Condition.class ) );
    Instruction instruction = mock( Instruction.class );
    Instruction instruction2 = mock( Instruction.class );
    Instruction instruction3 = mock( Instruction.class );

    Rule rule = query.then( instruction, instruction2, instruction3 );

    List<Instruction> instructions = rule.getInstructions();
    assertEquals( instructions.get( 0 ), instruction );
View Full Code Here

TOP

Related Classes of com.eclipsesource.tabris.passepartout.Instruction

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.