use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class ActionFinderTest method attachesExistingFreeplaneAction.
@Test
public void attachesExistingFreeplaneAction() {
FreeplaneActions freeplaneActions = mock(FreeplaneActions.class);
Entry entry = new Entry();
entry.setName("action");
final AFreeplaneAction someAction = Mockito.mock(AFreeplaneAction.class);
when(freeplaneActions.getAction("action")).thenReturn(someAction);
final ActionFinder actionFinder = new ActionFinder(freeplaneActions);
actionFinder.visit(entry);
assertThat((AFreeplaneAction) new EntryAccessor().getAction(entry), CoreMatchers.equalTo(someAction));
}
use of org.freeplane.core.ui.menubuilders.generic.Entry 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.Entry in project freeplane by freeplane.
the class ComponentBuilderTest method testName.
@Test
public void testName() throws Exception {
final Entry entry = new Entry();
final Component testComponent = new JPanel();
final ComponentBuilder builder = new ComponentBuilder(new ComponentProvider() {
@Override
public Component createComponent(Entry entry) {
return testComponent;
}
});
builder.visit(entry);
Assert.assertThat(new EntryAccessor().getComponent(entry), CoreMatchers.<Object>equalTo(testComponent));
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class EntriesForActionTest method returnsEmptyListIfNoActionWasRegistered.
@Test
public void returnsEmptyListIfNoActionWasRegistered() throws Exception {
final EntriesForAction entriesForAction = new EntriesForAction();
AFreeplaneAction action = mock(AFreeplaneAction.class);
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 returnsListWithRegisteredAction.
@Test
public void returnsListWithRegisteredAction() throws Exception {
final EntriesForAction entriesForAction = new EntriesForAction();
AFreeplaneAction action = mock(AFreeplaneAction.class);
final Entry actionEntry = new Entry();
entriesForAction.registerEntry(action, actionEntry);
Collection<Entry> entries = entriesForAction.entries(action);
assertThat(entries, equalTo((Collection<Entry>) asList(actionEntry)));
}
Aggregations