Examples of AlwaysTrueContidtion


Examples of com.eclipsesource.tabris.passepartout.internal.condition.AlwaysTrueContidtion

  }

  @Test
  public void testAppliesBackgroundImage() {
    Image image = environment.getTestImage();
    Rule rule = PassePartout.when( new AlwaysTrueContidtion() ).then( new BackgroundImageInstruction( image ) );
    ResourceImpl resource = new ResourceImpl( rule );

    resource.bindTo( shell );

    assertEquals( image, shell.getBackgroundImage() );
View Full Code Here

Examples of com.eclipsesource.tabris.passepartout.internal.condition.AlwaysTrueContidtion

  @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

Examples of com.eclipsesource.tabris.passepartout.internal.condition.AlwaysTrueContidtion

  @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

Examples of com.eclipsesource.tabris.passepartout.internal.condition.AlwaysTrueContidtion

  @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

Examples of com.eclipsesource.tabris.passepartout.internal.condition.AlwaysTrueContidtion

  }

  @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

Examples of com.eclipsesource.tabris.passepartout.internal.condition.AlwaysTrueContidtion

  @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

Examples of com.eclipsesource.tabris.passepartout.internal.condition.AlwaysTrueContidtion

  public void testUsesChildrenSizeWhenComputeSize() {
    shell.setSize( 500, 500 );
    Composite composite = new Composite( shell, SWT.NONE );
    FluidGridLayout layout = new FluidGridLayout( new FluidGridConfiguration( LayoutMode.NONE, 100, 200 ) );
    Composite child = new Composite( composite, SWT.NONE );
    child.setLayoutData( createFluidGridData( when( new AlwaysTrueContidtion() ).then( height( px( 100 ) ) ) ) );

    Point size = layout.computeSize( composite, SWT.DEFAULT, SWT.DEFAULT, true );

    assertEquals( 500, size.x );
    assertEquals( 100, size.y );
View Full Code Here

Examples of com.eclipsesource.tabris.passepartout.internal.condition.AlwaysTrueContidtion

  public void testUsesAllChildrenSizeWhenComputeSize() {
    shell.setSize( 500, 500 );
    Composite composite = new Composite( shell, SWT.NONE );
    FluidGridLayout layout = new FluidGridLayout( new FluidGridConfiguration( LayoutMode.NONE, 700, 1700 ) );
    Composite child = new Composite( composite, SWT.NONE );
    child.setLayoutData( createFluidGridData( when( new AlwaysTrueContidtion() ).then( height( px( 100 ) ), columns( 4 ) ) ) );
    Composite child2 = new Composite( composite, SWT.NONE );
    child2.setLayoutData( createFluidGridData( when( new AlwaysTrueContidtion() ).then( height( px( 50 ) ) ) ) );

    Point size = layout.computeSize( composite, SWT.DEFAULT, SWT.DEFAULT, true );

    assertEquals( 500, size.x );
    assertEquals( 150, size.y );
View Full Code Here

Examples of com.eclipsesource.tabris.passepartout.internal.condition.AlwaysTrueContidtion

  public void testRespectsChildrenColumnsWhenComputeSizeAndUsesHighestChild() {
    shell.setSize( 500, 500 );
    Composite composite = new Composite( shell, SWT.NONE );
    FluidGridLayout layout = new FluidGridLayout( new FluidGridConfiguration( LayoutMode.NONE, 700, 1700 ) );
    Composite child = new Composite( composite, SWT.NONE );
    child.setLayoutData( createFluidGridData( when( new AlwaysTrueContidtion() ).then( height( px( 100 ) ), columns( 2 ) ) ) );
    Composite child2 = new Composite( composite, SWT.NONE );
    child2.setLayoutData( createFluidGridData( when( new AlwaysTrueContidtion() ).then( height( px( 50 ) ) ) ) );

    Point size = layout.computeSize( composite, SWT.DEFAULT, SWT.DEFAULT, true );

    assertEquals( 500, size.x );
    assertEquals( 100, size.y );
View Full Code Here

Examples of com.eclipsesource.tabris.passepartout.internal.condition.AlwaysTrueContidtion

  @Test
  public void testNotifiesQueryListener() {
    QueryListener listener = mock( QueryListener.class );
    FluidGridLayout layout = new FluidGridLayout( new FluidGridConfiguration( LayoutMode.NONE, 100, 200 ) );
    Query query = PassePartout.when( new AlwaysTrueContidtion() );
    layout.addQueryListener( query, listener );

    layout.layout( shell, false );

    verify( listener ).activated( query );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.