Test fixes

This commit is contained in:
dragonmacher 2025-09-23 16:53:02 -04:00
parent cc4a4e5ed2
commit 9e9de7c4f5
2 changed files with 14 additions and 13 deletions

View file

@ -15,13 +15,13 @@
*/ */
package ghidra.app.plugin.core.codebrowser; package ghidra.app.plugin.core.codebrowser;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;
import org.junit.*; import org.junit.*;
import docking.ActionContext; import docking.ActionContext;
import docking.action.DockingActionIf; import docking.action.DockingActionIf;
import docking.action.MenuData;
import ghidra.app.context.ProgramLocationActionContext; import ghidra.app.context.ProgramLocationActionContext;
import ghidra.app.services.ProgramManager; import ghidra.app.services.ProgramManager;
import ghidra.app.util.viewer.listingpanel.ListingModel; import ghidra.app.util.viewer.listingpanel.ListingModel;
@ -217,13 +217,18 @@ public class ExpandCollapseDataActionsTest extends AbstractGhidraHeadedIntegrati
public void testExpandAllInSelectionEnablement() { public void testExpandAllInSelectionEnablement() {
// Expand All In Selection is enabled whenever there is a selection // Expand All In Selection is enabled whenever there is a selection
ProgramSelection selection = new ProgramSelection(addr(0), addr(10)); ProgramSelection selection = new ProgramSelection(addr(0), addr(10));
assertTrue(!expandAll.isEnabledForContext(getContext(addr(0x0), null))); ActionContext context = getContext(addr(0x0), null);
assertEquals("Expand All Data", expandAll.getPopupMenuData().getMenuPath()[0]); assertTrue(!expandAll.isEnabledForContext(context));
MenuData menuData = expandAll.getPopupMenuData();
String[] menuPath = menuData.getMenuPath();
assertArrayEquals(menuPath, new String[] { "Data", "Expand All Data" });
assertTrue( context = getContextWithSelection(addr(STRUCT_1), selection);
expandAll.isEnabledForContext(getContextWithSelection(addr(STRUCT_1), selection))); assertTrue(expandAll.isEnabledForContext(context));
// When there is a selection, the pop-up menu changes // When there is a selection, the pop-up menu changes
assertEquals("Expand All Data In Selection", expandAll.getPopupMenuData().getMenuPath()[0]); menuData = expandAll.getPopupMenuData();
menuPath = menuData.getMenuPath();
assertArrayEquals(menuPath, new String[] { "Data", "Expand All Data In Selection" });
} }
@Test @Test

View file

@ -224,10 +224,6 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
assertKeyFieldText(ks); assertKeyFieldText(ks);
apply(); apply();
assertEquals(ks, getKeyStroke(action1)); assertEquals(ks, getKeyStroke(action1));
// verify the additional binding for 'Alt Graph'
action = (Action) TestUtils.invokeInstanceMethod("getActionForKeyStroke", dwm, keyStroke);
assertNotNull(action);
} }
@Test @Test