Package com.eclipsesource.tabris.internal.ui

Examples of com.eclipsesource.tabris.internal.ui.TestAction


  @Test
  public void testSelectionEvent_executeAction() {
    mockUI( mock( ActionListener.class ) );
    control.notifyListeners( SWT.Selection, new Event() );

    TestAction action = ( TestAction )actionDescriptor.getAction();
    assertTrue( action.wasExecuted() );
  }
View Full Code Here


    ActionListener listener = mock( ActionListener.class );
    mockUI( listener );

    control.notifyListeners( SWT.Selection, new Event() );

    TestAction action = ( TestAction )actionDescriptor.getAction();
    verify( listener ).executed( ui, action );
  }
View Full Code Here

    when( ui.getConfiguration() ).thenReturn( configuration );
  }

  private ActionDescriptor mockDescriptor() {
    ActionDescriptor descriptor = mock( ActionDescriptor.class );
    when( descriptor.getAction() ).thenReturn( new TestAction() );
    InputStream image = RemoteActionTest.class.getResourceAsStream( "testImage.png" );
    when( descriptor.getImage() ).thenReturn( ImageUtil.getBytes( image ) );
    when( descriptor.getTitle() ).thenReturn( "bar" );
    doReturn( Boolean.FALSE ).when( descriptor ).isEnabled();
    doReturn( Boolean.FALSE ).when( descriptor ).isVisible();
View Full Code Here

  }

  @Test
  public void testUpdateCreatesNewActionsCallsActionCreateUi() {
    List<ActionDescriptor> actions = new ArrayList<ActionDescriptor>();
    actions.add( new ActionDescriptor( "actionFoo", new TestAction() ) );
    when( descriptor.getActions() ).thenReturn( actions );
    webPage.createActions( WebRendererFactory.getInstance(), shell );
    actions.add( new ActionDescriptor( "actionFoo2", new TestAction() ) );

    webPage.update( descriptor, WebRendererFactory.getInstance(), shell );

    List<ActionRenderer> renderers = webPage.getActionRenderers();
    assertEquals( 2, renderers.size() );
View Full Code Here

  }

  @Test
  public void testUpdateDestroysOldActionsIfDeleted() {
    List<ActionDescriptor> actions = new ArrayList<ActionDescriptor>();
    actions.add( new ActionDescriptor( "actionFoo", new TestAction() ) );
    actions.add( new ActionDescriptor( "actionFoo2", new TestAction() ) );
    when( descriptor.getActions() ).thenReturn( actions );
    webPage.createActions( WebRendererFactory.getInstance(), shell );
    webPage.createActions( RemoteRendererFactory.getInstance(), shell );
    descriptor.getActions().remove( 1 );
View Full Code Here

    when( descriptor.getId() ).thenReturn( "foo" );
    when( descriptor.getTitle() ).thenReturn( "bar" );
    doReturn( Boolean.TRUE ).when( descriptor ).isTopLevel();
    when( descriptor.getPageStyle() ).thenReturn( new PageStyle[] { PageStyle.DEFAULT } );
    List<ActionDescriptor> actions = new ArrayList<ActionDescriptor>();
    actions.add( new ActionDescriptor( "actionFoo", new TestAction() ) );
    when( descriptor.getActions() ).thenReturn( actions );
    when( descriptor.getImage() ).thenReturn( UITestUtil.getImageBytes() );
    doReturn( TestPage.class ).when( descriptor ).getPageType();
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.tabris.internal.ui.TestAction

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.