Search in sources :

Example 1 with CCachedSelectionCriterium

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Selection.CCachedSelectionCriterium in project binnavi by google.

the class CCriteriumExecuterTest method testSingleSelectionCriterionUnselected.

@Test
public void testSingleSelectionCriterionUnselected() {
    assertEquals(0, m_graph.getSelectedNodes().size());
    m_graph.getRawView().getGraph().getNodes().get(1).setSelected(true);
    assertEquals(1, m_graph.getSelectedNodes().size());
    final CCachedSelectionCriterium criterium = new CCachedSelectionCriterium(SelectionState.UNSELECTED);
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
    CCachedExpressionTreeNode.append(m_tree.getRoot(), node);
    assertEquals(1, m_graph.getSelectedNodes().size());
    CCriteriumExecuter.execute(m_tree, m_graph);
    assertEquals(m_graph.getNodes().size() - 1, m_graph.getSelectedNodes().size());
    assertFalse(m_graph.getRawView().getGraph().getNodes().get(1).isSelected());
}
Also used : CCachedSelectionCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Selection.CCachedSelectionCriterium) CCachedExpressionTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode) Test(org.junit.Test)

Example 2 with CCachedSelectionCriterium

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Selection.CCachedSelectionCriterium in project binnavi by google.

the class CCriteriumExecuterTest method testSingleSelectionCriterionSelected.

/**
   * This test checks if a node that is selected also is selected after criterium executer has been
   * run.
   */
@Test
public void testSingleSelectionCriterionSelected() {
    assertEquals(0, m_graph.getSelectedNodes().size());
    m_graph.getRawView().getGraph().getNodes().get(1).setSelected(true);
    assertEquals(1, m_graph.getSelectedNodes().size());
    final CCachedSelectionCriterium criterium = new CCachedSelectionCriterium(SelectionState.SELECTED);
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
    CCachedExpressionTreeNode.append(m_tree.getRoot(), node);
    assertEquals(1, m_graph.getSelectedNodes().size());
    CCriteriumExecuter.execute(m_tree, m_graph);
    assertEquals(1, m_graph.getSelectedNodes().size());
    assertTrue(m_graph.getRawView().getGraph().getNodes().get(1).isSelected());
}
Also used : CCachedSelectionCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Selection.CCachedSelectionCriterium) CCachedExpressionTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode) Test(org.junit.Test)

Aggregations

CCachedSelectionCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Selection.CCachedSelectionCriterium)2 CCachedExpressionTreeNode (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode)2 Test (org.junit.Test)2