use of org.freeplane.plugin.script.proxy.Proxy.Node in project freeplane by freeplane.
the class ScriptApiTest method test_NodeRO_getNote.
public void test_NodeRO_getNote() {
map = c.newMap();
final Node root = map.getRoot();
root.setNote(" xxx ");
// in Groovy also assert HtmlUtils.plainToHTML(" xxx ") == root.note would be OK
assertEquals("", HtmlUtils.plainToHTML(" xxx "), root.getNote().getText());
assertEquals("", HtmlUtils.plainToHTML(" xxx "), root.getNoteText());
root.setNote(" x\nxx ");
// in Groovy also assert HtmlUtils.plainToHTML(" xxx ") == root.note would be OK
assertEquals("", HtmlUtils.plainToHTML(" x\nxx "), root.getNote().getText());
assertEquals("", HtmlUtils.plainToHTML(" x\nxx "), root.getNoteText());
}
use of org.freeplane.plugin.script.proxy.Proxy.Node in project freeplane by freeplane.
the class ScriptApiTest method test_Controller_selectBranch_Node_branchRoot.
public void test_Controller_selectBranch_Node_branchRoot() {
map = c.newMap();
final Node child1 = map.getRoot().createChild("child 1");
final Node child2 = map.getRoot().createChild("child 2");
final Node grandchild1 = child1.createChild("child 1.1");
final Node grandchild2 = child1.createChild("child 1.2");
final Node grandGrandChild = child1.createChild("child 1.1.1");
c.selectBranch(child1);
assertEquals("all node of the branch should be selected", set(child1, grandchild1, grandchild2, grandGrandChild), set(c.getSelecteds()));
c.selectBranch(child2);
assertEquals("one node should be selected", set(child2), set(c.getSelecteds()));
}
use of org.freeplane.plugin.script.proxy.Proxy.Node in project freeplane by freeplane.
the class ScriptApiTest method test_Node_moveTo_Node_parentNode.
public void test_Node_moveTo_Node_parentNode() {
map = c.newMap();
final Node root = map.getRoot();
final Node child1 = root.createChild("child 1");
final Node child2 = root.createChild("child 2");
final Node grandchild = child1.createChild("grandchild");
assertEquals("child2 should have no children", 0, child2.getChildren().size());
grandchild.moveTo(child2);
assertEquals("grandchild should be a child of child2 now", child2, grandchild.getParent());
}
use of org.freeplane.plugin.script.proxy.Proxy.Node in project freeplane by freeplane.
the class ScriptApiTest method test_NodeRO_getNodeLevel_boolean_countHidden.
public void test_NodeRO_getNodeLevel_boolean_countHidden() {
createTestMap();
assertEquals("root is level 0", 0, map.getRoot().getNodeLevel(true));
final Node child = firstChild();
assertEquals("children are at level 1", 1, child.getNodeLevel(false));
final Node grandchild = child.createChild();
assertEquals("grandchildren are at level 2", 2, grandchild.getNodeLevel(false));
assertEquals(//
"grandchildren are at level 2 - countHidden only matters if there are hidden nodes", 2, grandchild.getNodeLevel(true));
// seems that the countHidden flag isn't testable here since it's not possible to filter nodes (and it
// doesn't make sense to extent the API for that), right?
}
use of org.freeplane.plugin.script.proxy.Proxy.Node in project freeplane by freeplane.
the class ScriptApiTest method test_NodeRO_getChildPosition_Node_childNode.
public void test_NodeRO_getChildPosition_Node_childNode() {
map = c.newMap();
final Node child1 = map.getRoot().createChild("child 1");
final Node child2 = map.getRoot().createChild("child 2");
assertEquals("wrong position", 0, map.getRoot().getChildPosition(child1));
assertEquals("wrong position", 1, map.getRoot().getChildPosition(child2));
}
Aggregations