use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree in project binnavi by google.
the class CCriteriumFunctionsTest method testAppendOne.
@Test
public void testAppendOne() {
final CCriteriumTree cCriteriumTree = new CCriteriumTree();
final CCriteriumTreeNode child = new CCriteriumTreeNode(new CColorCriterium(m_graph));
cCriteriumTree.appendNode(cCriteriumTree.getRoot(), child);
CCriteriumFunctions.appendCriterium(cCriteriumTree, cCriteriumTree.getRoot().getChildren().get(0), new CAndCriterium());
assertTrue(cCriteriumTree.getRoot().getChildren().get(0).getChildren().get(0).getCriterium() instanceof CAndCriterium);
}
use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree in project binnavi by google.
the class CCriteriumFunctionsTest method findNode.
@Test
public void findNode() {
final CCriteriumTree cCriteriumTree = new CCriteriumTree();
final CCriteriaFactory cCriteriaFactory = new CCriteriaFactory(m_graph, null, null);
final List<ICriteriumCreator> criteria = cCriteriaFactory.getConditions();
final CConditionBox box = new CConditionBox(criteria);
final JCriteriumTree jtree = new JCriteriumTree(cCriteriumTree, criteria);
final CColorCriterium colorado = new CColorCriterium(m_graph);
final CCriteriumTreeNode child = new CCriteriumTreeNode(colorado);
cCriteriumTree.appendNode(cCriteriumTree.getRoot(), child);
final TreePath path = new TreePath(((JCriteriumTreeNode) jtree.getModel().getRoot()).getFirstChild());
jtree.setSelectionPath(path);
box.setSelectedIndex(6);
CCriteriumFunctions.appendCriterium(jtree, cCriteriumTree, box);
assertEquals(null, CCriteriumFunctions.findNode(cCriteriumTree.getRoot(), new CTextCriterium()));
assertEquals(child, CCriteriumFunctions.findNode(cCriteriumTree.getRoot(), colorado));
}
use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree in project binnavi by google.
the class CCriteriumFunctionsTest method testRemove.
@Test
public void testRemove() {
final CCriteriumTree cCriteriumTree = new CCriteriumTree();
final CCriteriumTreeNode child = new CCriteriumTreeNode(new CColorCriterium(m_graph));
cCriteriumTree.appendNode(cCriteriumTree.getRoot(), child);
final CCriteriumTreeNode child2 = new CCriteriumTreeNode(new COrCriterium());
cCriteriumTree.appendNode(child, child2);
CCriteriumFunctions.remove(cCriteriumTree, child);
assertEquals(0, cCriteriumTree.getRoot().getChildren().size());
}
use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree in project binnavi by google.
the class CCriteriumFunctionsTest method testAppendTwoNoPath.
@Test
public void testAppendTwoNoPath() {
final CCriteriumTree cCriteriumTree = new CCriteriumTree();
final CCriteriaFactory cCriteriaFactory = new CCriteriaFactory(m_graph, null, null);
final List<ICriteriumCreator> criteria = cCriteriaFactory.getConditions();
final CConditionBox box = new CConditionBox(criteria);
final JCriteriumTree jtree = new JCriteriumTree(cCriteriumTree, criteria);
final CCriteriumTreeNode child = new CCriteriumTreeNode(new CColorCriterium(m_graph));
cCriteriumTree.appendNode(cCriteriumTree.getRoot(), child);
final TreePath path = new TreePath(((JCriteriumTreeNode) jtree.getModel().getRoot()).getFirstChild());
jtree.setSelectionPath(path);
box.setSelectedIndex(6);
CCriteriumFunctions.appendCriterium(jtree, cCriteriumTree, box);
assertTrue(cCriteriumTree.getRoot().getChildren().get(0).getChildren().get(0).getCriterium() instanceof CSelectionCriterium);
assertFalse(cCriteriumTree.getRoot().getChildren().get(0).getChildren().get(0).getCriterium() instanceof CTagCriterium);
}
use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree in project binnavi by google.
the class SetupCriteriaGraphTest method setUp.
public void setUp() throws CouldntLoadDataException, LoadCancelledException, FileReadException, CouldntSaveDataException {
final ZyGraph graph = ZyGraphFactory.generateTestGraph();
final CCriteriaFactory criteriaFactory = new CCriteriaFactory(graph, null, null);
final List<ICriteriumCreator> criteria = criteriaFactory.getConditions();
final CCriteriumTree m_ctree = new CCriteriumTree();
final JCriteriumTree jtree = new JCriteriumTree(m_ctree, criteria);
jtree.getModel().setRoot(new JCriteriumTreeNode(m_ctree, m_ctree.getRoot().getCriterium(), criteria));
final CCriteriumTreeNode parent = new CCriteriumTreeNode(null);
final CCriteriumTreeNode child = new CCriteriumTreeNode(null);
m_ctree.appendNode(parent, child);
}
Aggregations