Search in sources :

Example 1 with CCodeBookmarkTableModel

use of com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel in project binnavi by google.

the class CCodeBookmarkTableModelTest method test5getValueAtFail.

@Test
public void test5getValueAtFail() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
    bookmarkManager.addBookmark(bookmark);
    try {
        tableModel.getValueAt(0, 4);
        fail();
    } catch (final IllegalArgumentException e) {
    }
}
Also used : CCodeBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark) CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Example 2 with CCodeBookmarkTableModel

use of com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel in project binnavi by google.

the class CCodeBookmarkTableModelTest method test2setValueAtWorking.

@Test
public void test2setValueAtWorking() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
    bookmarkManager.addBookmark(bookmark);
    assertEquals("burzel", tableModel.getValueAt(0, 2));
    tableModel.setValueAt("working", 0, 2);
    assertEquals(1, tableModel.getRowCount());
    assertEquals("working", tableModel.getValueAt(0, 2));
}
Also used : CCodeBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark) CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Example 3 with CCodeBookmarkTableModel

use of com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel in project binnavi by google.

the class CCodeBookmarkTableModelTest method test8checkEditable.

@Test
public void test8checkEditable() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
    bookmarkManager.addBookmark(bookmark);
    assertFalse(tableModel.isCellEditable(0, 0));
    assertFalse(tableModel.isCellEditable(0, 1));
    assertTrue(tableModel.isCellEditable(0, 2));
}
Also used : CCodeBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark) CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Example 4 with CCodeBookmarkTableModel

use of com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel in project binnavi by google.

the class CCodeBookmarkTableModelTest method test1Simple.

@Test
public void test1Simple() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    assertEquals(3, tableModel.getColumnCount());
    assertEquals(0, tableModel.getRowCount());
}
Also used : CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) Test(org.junit.Test)

Example 5 with CCodeBookmarkTableModel

use of com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel in project binnavi by google.

the class CCodeBookmarkTableModelTest method test9checkRemoveListeners.

@Test
public void test9checkRemoveListeners() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    final LinkedHashSet<?> m_daListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(bookmarkManager, "m_listeners"), "m_listeners");
    assertEquals(1, m_daListeners.size());
    final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
    bookmarkManager.addBookmark(bookmark);
    final LinkedHashSet<?> m_bmListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(bookmark, "m_listeners"), "m_listeners");
    assertEquals(1, m_bmListeners.size());
    tableModel.dispose();
    assertTrue(m_daListeners.isEmpty());
    assertTrue(m_bmListeners.isEmpty());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) CCodeBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark) CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Aggregations

CCodeBookmarkTableModel (com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel)9 CCodeBookmarkManager (com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager)9 Test (org.junit.Test)9 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)8 CCodeBookmark (com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark)8 MockAddress (com.google.security.zynamics.zylib.disassembly.MockAddress)8 LinkedHashSet (java.util.LinkedHashSet)1