Search in sources :

Example 1 with AccelerateableAction

use of org.freeplane.core.ui.AccelerateableAction in project freeplane by freeplane.

the class JMenuItemBuilderTest method createsMenuItemWithSelectableAction.

@Test
public void createsMenuItemWithSelectableAction() {
    menuEntry.addChild(actionEntry);
    when(action.isSelectable()).thenReturn(true);
    new EntryAccessor().setComponent(menuEntry, menu);
    menuActionGroupBuilder.visit(actionEntry);
    JAutoCheckBoxMenuItem item = (JAutoCheckBoxMenuItem) new EntryAccessor().getComponent(actionEntry);
    final AccelerateableAction itemAction = (AccelerateableAction) item.getAction();
    assertThat(itemAction.getOriginalAction(), CoreMatchers.<Action>equalTo(action));
    assertThat(item.getParent(), CoreMatchers.<Container>equalTo(menu.getPopupMenu()));
}
Also used : EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) JAutoCheckBoxMenuItem(org.freeplane.core.ui.components.JAutoCheckBoxMenuItem) AccelerateableAction(org.freeplane.core.ui.AccelerateableAction) Test(org.junit.Test)

Example 2 with AccelerateableAction

use of org.freeplane.core.ui.AccelerateableAction in project freeplane by freeplane.

the class JMenuItemBuilderTest method assertThatMenuItemHasCorrectAction.

private void assertThatMenuItemHasCorrectAction(final JMenuItem menuItem) {
    final AccelerateableAction itemAction = (AccelerateableAction) menuItem.getAction();
    assertThat(itemAction.getOriginalAction(), CoreMatchers.<Action>equalTo(action));
}
Also used : AccelerateableAction(org.freeplane.core.ui.AccelerateableAction)

Aggregations

AccelerateableAction (org.freeplane.core.ui.AccelerateableAction)2 JAutoCheckBoxMenuItem (org.freeplane.core.ui.components.JAutoCheckBoxMenuItem)1 EntryAccessor (org.freeplane.core.ui.menubuilders.generic.EntryAccessor)1 Test (org.junit.Test)1