Search in sources :

Example 1 with CCodeBookmarkManager

use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager 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 CCodeBookmarkManager

use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager 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 CCodeBookmarkManager

use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager 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 CCodeBookmarkManager

use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager in project binnavi by google.

the class CBookmarkFunctionsTest method test4DeleteBookmarksNoRows.

@Test
public void test4DeleteBookmarksNoRows() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final MockAddress mockAddress = new MockAddress();
    final MockModule mockModule = new MockModule();
    CBookmarkFunctions.addBookmark(bookmarkManager, mockModule, mockAddress);
    try {
        CBookmarkFunctions.deleteBookmarks(bookmarkManager, null);
        fail();
    } catch (final NullPointerException e) {
    }
}
Also used : 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 5 with CCodeBookmarkManager

use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager in project binnavi by google.

the class CBookmarkFunctionsTest method test2DeleteBookmarks.

@Test
public void test2DeleteBookmarks() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final MockAddress mockAddress = new MockAddress();
    final MockModule mockModule = new MockModule();
    CBookmarkFunctions.addBookmark(bookmarkManager, mockModule, mockAddress);
    CBookmarkFunctions.addBookmark(bookmarkManager, mockModule, mockAddress);
    CBookmarkFunctions.addBookmark(bookmarkManager, mockModule, mockAddress);
    CBookmarkFunctions.addBookmark(bookmarkManager, mockModule, mockAddress);
    CBookmarkFunctions.addBookmark(bookmarkManager, mockModule, mockAddress);
    CBookmarkFunctions.addBookmark(bookmarkManager, mockModule, mockAddress);
    CBookmarkFunctions.addBookmark(bookmarkManager, mockModule, mockAddress);
    CBookmarkFunctions.addBookmark(bookmarkManager, mockModule, mockAddress);
    assertEquals(8, bookmarkManager.size());
    final int[] rows = { 1, 2, 3, 4, 5, 6, 7 };
    CBookmarkFunctions.deleteBookmarks(bookmarkManager, rows);
    assertEquals(1, bookmarkManager.size());
}
Also used : 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

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