use of org.freeplane.core.ui.menubuilders.generic.EntryPopupListenerCollection in project freeplane by freeplane.
the class ActionSelectListenerTest method activatesSelectOnPopup_forCheckSelectionOnPopup.
@Test
public void activatesSelectOnPopup_forCheckSelectionOnPopup() {
Entry menuEntry = new Entry();
Entry actionEntry = new Entry();
menuEntry.addChild(actionEntry);
final AFreeplaneAction someAction = Mockito.mock(AFreeplaneAction.class);
when(someAction.checkSelectionOnPopup()).thenReturn(true);
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).setSelected();
}
use of org.freeplane.core.ui.menubuilders.generic.EntryPopupListenerCollection 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();
}
Aggregations