use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class AcceleratorDestroyerTest method unregistersEntryWithAction.
@Test
public void unregistersEntryWithAction() {
Entry actionEntry = new Entry();
final AFreeplaneAction action = mock(AFreeplaneAction.class);
new EntryAccessor().setAction(actionEntry, action);
IEntriesForAction entries = mock(IEntriesForAction.class);
final AcceleratorDestroyer acceleratorDestroyer = new AcceleratorDestroyer(entries);
acceleratorDestroyer.visit(actionEntry);
Mockito.verify(entries).unregisterEntry(action, actionEntry);
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class ActionFinderTest method attachesSetBooleanPropertyAction.
@Test
public void attachesSetBooleanPropertyAction() {
FreeplaneActions freeplaneActions = mock(FreeplaneActions.class);
final SetBooleanPropertyAction setBooleanPropertyAction = Mockito.mock(SetBooleanPropertyAction.class);
Entry entry = new Entry();
final String propertyActionName = "SetBooleanPropertyAction.property";
entry.setName(propertyActionName);
when(freeplaneActions.getAction(propertyActionName)).thenReturn(null);
final ActionFinder actionFinder = new ActionFinder(freeplaneActions) {
@Override
protected AFreeplaneAction createAction(Class<? extends AFreeplaneAction> actionClass, String propertyName) {
return setBooleanPropertyAction;
}
};
actionFinder.visit(entry);
Mockito.verify(freeplaneActions).addAction(setBooleanPropertyAction);
assertThat(new EntryAccessor().getAction(entry), CoreMatchers.<Object>equalTo(setBooleanPropertyAction));
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class ActionSelectListenerTest method dontActivateSelectOnPopup_forNotCheckSelectionOnPopup.
@Test
public void dontActivateSelectOnPopup_forNotCheckSelectionOnPopup() {
Entry menuEntry = new Entry();
Entry actionEntry = new Entry();
menuEntry.addChild(actionEntry);
final AFreeplaneAction someAction = Mockito.mock(AFreeplaneAction.class);
when(someAction.checkSelectionOnPopup()).thenReturn(false);
when(someAction.isEnabled()).thenReturn(true);
new EntryAccessor().setAction(actionEntry, someAction);
final EntryPopupListenerCollection entryPopupListenerCollection = new EntryPopupListenerCollection();
final ActionSelectListener actionSelectListener = new ActionSelectListener();
entryPopupListenerCollection.addEntryPopupListener(actionSelectListener);
entryPopupListenerCollection.childEntriesWillBecomeVisible(menuEntry);
verify(someAction, never()).setSelected();
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class EntriesForActionTest method returnsEmptyListIfNoActionWasUnregistered.
@Test
public void returnsEmptyListIfNoActionWasUnregistered() throws Exception {
final EntriesForAction entriesForAction = new EntriesForAction();
AFreeplaneAction action = mock(AFreeplaneAction.class);
final Entry actionEntry = new Entry();
entriesForAction.registerEntry(action, actionEntry);
entriesForAction.unregisterEntry(action, actionEntry);
Collection<Entry> entries = entriesForAction.entries(action);
assertThat(entries.isEmpty(), equalTo(true));
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class EntriesForActionTest method returnsListWithTwoRegisteredActions.
@Test
public void returnsListWithTwoRegisteredActions() throws Exception {
final EntriesForAction entriesForAction = new EntriesForAction();
AFreeplaneAction action = mock(AFreeplaneAction.class);
final Entry actionEntry1 = new Entry();
final Entry actionEntry2 = new Entry();
entriesForAction.registerEntry(action, actionEntry1);
entriesForAction.registerEntry(action, actionEntry2);
Collection<Entry> entries = entriesForAction.entries(action);
assertThat(entries, equalTo((Collection<Entry>) asList(actionEntry1, actionEntry2)));
}
Aggregations