Package rabbit.ui.internal.util

Examples of rabbit.ui.internal.util.ICategory


  public Image getImage(Object element) {
    if (images.containsKey(element)) {
      return images.get(element);
    }

    ICategory category = (ICategory) element;
    ImageDescriptor des = category.getImageDescriptor();
    Image image = (des != null) ? des.createImage() : null;
    images.put(category, image);
    return image;
  }
View Full Code Here


    action.run();
  }

  @Test
  public void shouldSetTheImageOfTheActionToBeTheSameAsTheImageOfTheFirstCategory() {
    ICategory first = mock(ICategory.class);
    ImageDescriptor firstImage = mock(ImageDescriptor.class);
    given(first.getImageDescriptor()).willReturn(firstImage);

    ICategory second = mock(ICategory.class);
    ImageDescriptor secondImage = mock(ImageDescriptor.class);
    given(second.getImageDescriptor()).willReturn(secondImage);

    ICategory[] categories = {first, second};
    IAction action = create(mock(ICategoryProvider.class), categories);
    assertThat(action.getImageDescriptor(), sameInstance(first.getImageDescriptor()));
  }
View Full Code Here

    assertThat(action.getImageDescriptor(), sameInstance(first.getImageDescriptor()));
  }

  @Test
  public void shouldSetTheTextOfTheActionToBeTheSameAsTheTextOfTheFirstCategory() {
    ICategory first = mock(ICategory.class);
    given(first.getText()).willReturn("First");

    ICategory second = mock(ICategory.class);
    given(second.getText()).willReturn("Second");

    ICategory[] categories = {first, second};
    IAction action = create(mock(ICategoryProvider.class), categories);
    assertThat(action.getText(), equalTo(first.getText()));
  }
View Full Code Here

  @Test
  public void runShouldSetTheProvidersPaintCategory() {
    @SuppressWarnings("serial")
    class MyException extends RuntimeException {}
    ICategory category = mock(ICategory.class);
    IVisualProvider provider = mock(IVisualProvider.class);
    doThrow(new MyException()).when(provider).setVisualCategory(category);

    IAction action = create(category, provider);
    thrown.expect(MyException.class);
View Full Code Here

    action.run();
  }

  @Test
  public void shouldSetTheImageOfTheActionToBeTheSameAsTheImageOfTheCategory() {
    ICategory category = mock(ICategory.class);
    ImageDescriptor image = mock(ImageDescriptor.class);
    given(category.getImageDescriptor()).willReturn(image);

    IAction action = create(category);
    assertThat(action.getImageDescriptor(),
        equalTo(category.getImageDescriptor()));
  }
View Full Code Here

        equalTo(category.getImageDescriptor()));
  }

  @Test
  public void shouldSetTheTextOfTheActionToBeTheSameAsTheTextOfTheCategory() {
    ICategory category = mock(ICategory.class);
    given(category.getText()).willReturn("Hello");

    IAction action = create(category);
    assertThat(action.getText(), equalTo(category.getText()));
  }
View Full Code Here

TOP

Related Classes of rabbit.ui.internal.util.ICategory

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.