use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class XmlEntryStructureBuilderTest method givenXmlWithChildEntryWithTrue_createsBooleanObject.
@Test
public void givenXmlWithChildEntryWithTrue_createsBooleanObject() {
String xmlWithoutContent = "<FreeplaneUIEntries><Entry builderSpecificAttribute='true'/></FreeplaneUIEntries>";
Entry builtMenuStructure = XmlEntryStructureBuilder.buildMenuStructure(xmlWithoutContent);
Entry menuStructureWithChildEntry = new Entry();
final Entry childEntry = new Entry();
childEntry.setAttribute("builderSpecificAttribute", true);
menuStructureWithChildEntry.addChild(childEntry);
assertThat(builtMenuStructure, equalTo(menuStructureWithChildEntry));
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class XmlEntryStructureBuilderTest method givenXmlWithourContent_createsEmptyStructure.
@Test
public void givenXmlWithourContent_createsEmptyStructure() {
String xmlWithoutContent = "<FreeplaneUIEntries/>";
Entry builtMenuStructure = XmlEntryStructureBuilder.buildMenuStructure(xmlWithoutContent);
Entry menuStructureWithChildEntry = new Entry();
assertThat(builtMenuStructure, equalTo(menuStructureWithChildEntry));
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class XmlEntryStructureBuilderTest method givenXmlWithChildEntryWithTwoBuilders_createsStructureWithChildEntry.
@Test
public void givenXmlWithChildEntryWithTwoBuilders_createsStructureWithChildEntry() {
String xmlWithoutContent = "<FreeplaneUIEntries><Entry builder='builder1, builder2'/></FreeplaneUIEntries>";
Entry builtMenuStructure = XmlEntryStructureBuilder.buildMenuStructure(xmlWithoutContent);
Entry menuStructureWithChildEntry = new Entry();
final Entry childEntry = new Entry();
childEntry.setBuilders(asList("builder1", "builder2"));
menuStructureWithChildEntry.addChild(childEntry);
assertThat(builtMenuStructure, equalTo(menuStructureWithChildEntry));
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class AcceleratorBuilderTest method setsDefaultAcceleratorForAction.
@Test
public void setsDefaultAcceleratorForAction() {
Entry actionEntry = new Entry();
String actionKey = "actionKey";
actionEntry.setName(actionKey);
String keyStroke = KeyStroke.getKeyStroke('A', InputEvent.CTRL_MASK).toString();
actionEntry.setAttribute("accelerator", keyStroke);
final AFreeplaneAction action = mock(AFreeplaneAction.class);
new EntryAccessor().setAction(actionEntry, action);
IAcceleratorMap map = mock(IAcceleratorMap.class);
final AcceleratorBuilder acceleratorBuilder = new AcceleratorBuilder(map, mock(IEntriesForAction.class));
acceleratorBuilder.visit(actionEntry);
Mockito.verify(map).setDefaultAccelerator(action, keyStroke);
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class AcceleratorBuilderTest method givenEntryWithoutAccelerator_doesNotSetOwnDefaultAccelerator.
@Test
public void givenEntryWithoutAccelerator_doesNotSetOwnDefaultAccelerator() {
Entry actionEntry = new Entry();
final AFreeplaneAction action = mock(AFreeplaneAction.class);
new EntryAccessor().setAction(actionEntry, action);
IAcceleratorMap map = mock(IAcceleratorMap.class);
final AcceleratorBuilder acceleratorBuilder = new AcceleratorBuilder(map, mock(IEntriesForAction.class));
acceleratorBuilder.visit(actionEntry);
Mockito.verify(map, never()).setDefaultAccelerator(Mockito.<AFreeplaneAction>any(), anyString());
}
Aggregations