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

View file

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