Search in sources :

Example 16 with MockInstruction

use of com.google.security.zynamics.binnavi.disassembly.MockInstruction in project binnavi by google.

the class ZyGraphTest method testAddedCodeNode.

@Test
public void testAddedCodeNode() {
    assertEquals(7, m_graph.visibleNodeCount());
    assertEquals(89, NodeFunctions.getInvisibleNodes(m_graph).size());
    assertEquals(96, m_graph.getRawView().getNodeCount());
    final MockFunction function = new MockFunction(m_provider);
    final List<INaviInstruction> instructions = Lists.newArrayList((INaviInstruction) new MockInstruction(new CAddress(0x123456), "mov", new ArrayList<COperandTree>(), null, m_module));
    final CCodeNode codeNode = m_graph.getRawView().getContent().createCodeNode(function, instructions);
    assertEquals(8, m_graph.visibleNodeCount());
    assertEquals(89, NodeFunctions.getInvisibleNodes(m_graph).size());
    assertEquals(97, m_graph.getRawView().getNodeCount());
    final List<NaviNode> nodes = GraphHelpers.getNodes(m_graph);
    final NaviNode cnn = searchNode(nodes, codeNode);
    assertEquals(codeNode, cnn.getRawNode());
    assertTrue(codeNode.isVisible());
    assertEquals(codeNode.isVisible(), cnn.isVisible());
    codeNode.setVisible(false);
    assertFalse(codeNode.isVisible());
    assertEquals(codeNode.isVisible(), cnn.isVisible());
    codeNode.setVisible(true);
    assertTrue(codeNode.isVisible());
    assertEquals(codeNode.isVisible(), cnn.isVisible());
    assertFalse(codeNode.isSelected());
    assertEquals(codeNode.isSelected(), cnn.isSelected());
    codeNode.setSelected(false);
    assertFalse(codeNode.isSelected());
    assertEquals(codeNode.isSelected(), cnn.isSelected());
    codeNode.setSelected(true);
    assertTrue(codeNode.isSelected());
    assertEquals(codeNode.isSelected(), cnn.isSelected());
    assertEquals(codeNode.getColor(), cnn.getRealizer().getFillColor());
    codeNode.setColor(Color.GREEN);
    assertEquals(Color.GREEN, codeNode.getColor());
    assertEquals(codeNode.getColor(), cnn.getRealizer().getFillColor());
    codeNode.setX(100);
    assertEquals(100, codeNode.getX(), 0.1);
    assertEquals(codeNode.getX(), cnn.getX(), 0.1);
    codeNode.setY(200);
    assertEquals(200, codeNode.getY(), 0.1);
    assertEquals(codeNode.getY(), cnn.getY(), 0.1);
}
Also used : MockFunction(com.google.security.zynamics.binnavi.disassembly.MockFunction) MockInstruction(com.google.security.zynamics.binnavi.disassembly.MockInstruction) CCodeNode(com.google.security.zynamics.binnavi.disassembly.CCodeNode) COperandTree(com.google.security.zynamics.binnavi.disassembly.COperandTree) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction) Test(org.junit.Test)

Aggregations

MockInstruction (com.google.security.zynamics.binnavi.disassembly.MockInstruction)16 Test (org.junit.Test)15 MockView (com.google.security.zynamics.binnavi.disassembly.MockView)11 CCodeNode (com.google.security.zynamics.binnavi.disassembly.CCodeNode)9 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)8 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)8 Date (java.util.Date)8 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)7 CFunction (com.google.security.zynamics.binnavi.disassembly.CFunction)7 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)7 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)7 INaviEdge (com.google.security.zynamics.binnavi.disassembly.INaviEdge)6 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)6 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)6 MockFunction (com.google.security.zynamics.binnavi.disassembly.MockFunction)6 ArrayList (java.util.ArrayList)6 CNaviViewEdge (com.google.security.zynamics.binnavi.disassembly.CNaviViewEdge)5 INaviCodeNode (com.google.security.zynamics.binnavi.disassembly.INaviCodeNode)5 CBasicBlock (com.google.security.zynamics.binnavi.disassembly.CBasicBlock)4 CBlockNode (com.google.security.zynamics.binnavi.disassembly.CBlockNode)4