Search in sources :

Example 1 with EntryPopupListenerCollection

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();
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) EntryPopupListenerCollection(org.freeplane.core.ui.menubuilders.generic.EntryPopupListenerCollection) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) Test(org.junit.Test)

Example 2 with EntryPopupListenerCollection

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();
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) EntryPopupListenerCollection(org.freeplane.core.ui.menubuilders.generic.EntryPopupListenerCollection) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor) Test(org.junit.Test)

Aggregations

AFreeplaneAction (org.freeplane.core.ui.AFreeplaneAction)2 Entry (org.freeplane.core.ui.menubuilders.generic.Entry)2 EntryAccessor (org.freeplane.core.ui.menubuilders.generic.EntryAccessor)2 EntryPopupListenerCollection (org.freeplane.core.ui.menubuilders.generic.EntryPopupListenerCollection)2 Test (org.junit.Test)2