MyCompositeNode node = new MyCompositeNode();
node.setParent(parent);
node.setOrigin(0, 0);
node.setSize(100, 100);
// test parent assignment
CompositeNode child = new MyCompositeNode();
child.setOrigin(5, 5);
child.setSize(80, 80);
node.addChild(child);
Node childchild = new MyCompositeNode();
childchild.setOrigin(5, 5);
childchild.setSize(70, 70);
child.addChild(childchild);
// retrieve childchild
assertEquals(childchild, node.getChildAt(15, 20));
assertEquals(node, child.getParent());
assertEquals(child, childchild.getParent());
assertTrue(childchild.isAncestor(child));
assertTrue(childchild.isAncestor(parent));
assertTrue(child.isAncestor(parent));
assertFalse(parent.isAncestor(child));
assertFalse(child.isAncestor(childchild));
}