Package com.eclipsesource.tabris.passepartout

Examples of com.eclipsesource.tabris.passepartout.Rule


  @Test
  public void testAppliesImageOnLabel() {
    Label label = new Label( shell, SWT.NONE );
    Image image = environment.getTestImage();
    Rule rule = PassePartout.when( new AlwaysTrueContidtion() ).then( new ImageInstruction( image ) );
    ResourceImpl resource = new ResourceImpl( rule );

    resource.bindTo( label );

    assertEquals( image, label.getImage() );
View Full Code Here


  @Test
  public void testAppliesImageOnButton() {
    Button button = new Button( shell, SWT.PUSH );
    Image image = environment.getTestImage();
    Rule rule = PassePartout.when( new AlwaysTrueContidtion() ).then( new ImageInstruction( image ) );
    ResourceImpl resource = new ResourceImpl( rule );

    resource.bindTo( button );

    assertEquals( image, button.getImage() );
View Full Code Here

  @Test
  public void testAppliesImageOnItem() {
    ToolBar toolBar = new ToolBar( shell, SWT.NONE );
    ToolItem toolItem = new ToolItem( toolBar, SWT.NONE );
    Image image = environment.getTestImage();
    Rule rule = PassePartout.when( new AlwaysTrueContidtion() ).then( new ImageInstruction( image ) );
    ResourceImpl resource = new ResourceImpl( rule );
    shell.open();

    resource.bindTo( toolItem );
View Full Code Here

  }

  @Test
  public void testRegistersItselfAsResizeListener() {
    Color color = shell.getDisplay().getSystemColor( SWT.COLOR_BLUE );
    Rule rule = PassePartout.when( new AlwaysTrueContidtion() ).then( new ForegroundInstruction( color ) );
    ResourceImpl resource = new ResourceImpl( rule );

    resource.bindTo( shell );

    boolean hasListener = hasResizeListener( resource );
View Full Code Here

  @Test
  public void testRegistersItselfAsResizeListenerWithItem() {
    ToolBar toolBar = new ToolBar( shell, SWT.NONE );
    ToolItem toolItem = new ToolItem( toolBar, SWT.NONE );
    Color color = shell.getDisplay().getSystemColor( SWT.COLOR_BLUE );
    Rule rule = PassePartout.when( new AlwaysTrueContidtion() ).then( new ForegroundInstruction( color ) );
    ResourceImpl resource = new ResourceImpl( rule );

    resource.bindTo( toolItem );

    boolean hasListener = hasResizeListener( resource );
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

    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 );
    assertEquals( instructions.get( 1 ), instruction2 );
    assertEquals( instructions.get( 2 ), instruction3 );
  }
View Full Code Here

TOP

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

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.