Search in sources :

Example 16 with CModuleContainer

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

the class CModuleNodeTest method testUnloaded.

@Test
public void testUnloaded() throws CouldntLoadDataException, CouldntDeleteException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, LoadCancelledException {
    final CModuleNode node = new CModuleNode(m_tree, new DefaultMutableTreeNode(), m_database, m_module, new CModuleContainer(m_database, m_module));
    assertEquals("Name (55/66)", node.toString());
    m_module.load();
    assertEquals("Name (1/0)", node.toString());
    final CView view = m_module.getContent().getViewContainer().createView("Foo", "Bar");
    assertEquals("Name (1/1)", node.toString());
    m_module.getContent().getViewContainer().deleteView(view);
    assertEquals("Name (1/0)", node.toString());
    node.dispose();
    final LinkedHashSet<?> viewListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(view, "m_listeners"), "m_listeners");
    assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
    assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_module, "m_listeners"), "m_listeners")).isEmpty());
    assertTrue(viewListeners.isEmpty());
}
Also used : CView(com.google.security.zynamics.binnavi.disassembly.views.CView) LinkedHashSet(java.util.LinkedHashSet) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CModuleContainer(com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer) CModuleNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.CModuleNode) Test(org.junit.Test)

Aggregations

CModuleContainer (com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer)16 Test (org.junit.Test)7 CModuleNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.CModuleNode)5 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)5 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)5 ZyGraph (com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph)5 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)5 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)4 Module (com.google.security.zynamics.binnavi.API.disassembly.Module)3 Project (com.google.security.zynamics.binnavi.API.disassembly.Project)3 ViewContainer (com.google.security.zynamics.binnavi.API.disassembly.ViewContainer)3 CProjectContainer (com.google.security.zynamics.binnavi.disassembly.CProjectContainer)3 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)3 CView (com.google.security.zynamics.binnavi.disassembly.views.CView)3 IViewContainer (com.google.security.zynamics.binnavi.disassembly.views.IViewContainer)3 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)2 CComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.CComment)2 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)2 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)2 Date (java.util.Date)2