use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class XmlEntryStructureBuilderTest method givenXmlWithChildEntryWithFalse_createsBooleanObject.
@Test
public void givenXmlWithChildEntryWithFalse_createsBooleanObject() {
String xmlWithoutContent = "<FreeplaneUIEntries><Entry builderSpecificAttribute='FAlse'/></FreeplaneUIEntries>";
Entry builtMenuStructure = XmlEntryStructureBuilder.buildMenuStructure(xmlWithoutContent);
Entry menuStructureWithChildEntry = new Entry();
final Entry childEntry = new Entry();
childEntry.setAttribute("builderSpecificAttribute", false);
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 givenXmlWithSameChildLevels_createsStructure.
@Test
public void givenXmlWithSameChildLevels_createsStructure() {
String xmlWithoutContent = "<FreeplaneUIEntries><Entry name='level1'/>" + "<Entry name='level2'/>" + "</FreeplaneUIEntries>";
Entry builtMenuStructure = XmlEntryStructureBuilder.buildMenuStructure(xmlWithoutContent);
Entry menuStructureWithChildEntry = new Entry();
final Entry childEntry = new Entry();
childEntry.setName("level1");
menuStructureWithChildEntry.addChild(childEntry);
final Entry child2Entry = new Entry();
child2Entry.setName("level2");
menuStructureWithChildEntry.addChild(child2Entry);
assertThat(builtMenuStructure, equalTo(menuStructureWithChildEntry));
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class AcceleratorBuilderTest method registersEntryWithAction.
@Test
public void registersEntryWithAction() {
Entry actionEntry = new Entry();
final AFreeplaneAction action = mock(AFreeplaneAction.class);
new EntryAccessor().setAction(actionEntry, action);
IAcceleratorMap map = mock(IAcceleratorMap.class);
IEntriesForAction entries = mock(IEntriesForAction.class);
final AcceleratorBuilder acceleratorBuilder = new AcceleratorBuilder(map, entries);
acceleratorBuilder.visit(actionEntry);
Mockito.verify(entries).registerEntry(action, actionEntry);
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class AcceleratorBuilderTest method ignoresEntryWithoutAction.
@Test
public void ignoresEntryWithoutAction() {
Entry actionEntry = new Entry();
String actionKey = "actionKey";
actionEntry.setName(actionKey);
String keyStroke = "CONTROL A";
actionEntry.setAttribute("accelerator", keyStroke);
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(), Mockito.<String>any());
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class AcceleratorBuilderTest method givenEntryWithoutAccelerator_setsUserDefinedAccelerator.
@Test
public void givenEntryWithoutAccelerator_setsUserDefinedAccelerator() {
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).setUserDefinedAccelerator(action);
}
Aggregations