mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-10 09:13:58 -09:00
Test fixes
This commit is contained in:
@@ -35,6 +35,7 @@ public interface Navigatable {
|
||||
|
||||
/**
|
||||
* Commands this navigatable to goto (display) the given program and location
|
||||
* @param program the program
|
||||
*
|
||||
* @param location the location in that program to display
|
||||
* @return true if the goto was successful
|
||||
|
||||
@@ -105,7 +105,7 @@ public class GoToServiceImpl implements GoToService {
|
||||
programLocation = override.goTo(goToAddress);
|
||||
}
|
||||
if (programLocation == null) {
|
||||
programLocation = helper.getProgramLocationForAddress(goToAddress, program);
|
||||
programLocation = GoToHelper.getProgramLocationForAddress(goToAddress, program);
|
||||
}
|
||||
else {
|
||||
program = programLocation.getProgram();
|
||||
@@ -116,7 +116,7 @@ public class GoToServiceImpl implements GoToService {
|
||||
|
||||
@Override
|
||||
public boolean goTo(Address goToAddress, Program program) {
|
||||
ProgramLocation location = helper.getProgramLocationForAddress(goToAddress, program);
|
||||
ProgramLocation location = GoToHelper.getProgramLocationForAddress(goToAddress, program);
|
||||
return helper.goTo(defaultNavigatable, location, program);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,9 +100,6 @@ public abstract class AbstractDecompilerAction extends DockingAction {
|
||||
HighVariable variable = token.getHighVariable();
|
||||
HighSymbol highSymbol = null;
|
||||
if (variable == null) {
|
||||
if (highFunction == null) {
|
||||
return null;
|
||||
}
|
||||
// Token may be from a variable reference, in which case we have to dig to find the actual symbol
|
||||
Function function = highFunction.getFunction();
|
||||
if (function == null) {
|
||||
|
||||
@@ -945,14 +945,14 @@ public class DecompilerClangTest extends AbstractDecompilerTest {
|
||||
private void refresh() {
|
||||
|
||||
DockingActionIf action = getAction(decompiler, "Refresh");
|
||||
performAction(action);
|
||||
performAction(action, provider.getActionContext(null), true);
|
||||
waitForDecompiler();
|
||||
}
|
||||
|
||||
private DecompilerProvider cloneDecompiler() {
|
||||
|
||||
DockingActionIf action = getAction(decompiler, "Decompile Clone");
|
||||
performAction(action);
|
||||
performAction(action, provider.getActionContext(null), true);
|
||||
waitForSwing();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -1035,7 +1035,7 @@ public class DecompilerClangTest extends AbstractDecompilerTest {
|
||||
|
||||
private void backwardSlice() {
|
||||
DockingActionIf action = getAction(decompiler, BackwardsSliceAction.NAME);
|
||||
performAction(action);
|
||||
performAction(action, provider.getActionContext(null), true);
|
||||
}
|
||||
|
||||
private void middleMouse() {
|
||||
@@ -1064,7 +1064,7 @@ public class DecompilerClangTest extends AbstractDecompilerTest {
|
||||
|
||||
private void rename(String newName) {
|
||||
DockingActionIf action = getAction(decompiler, "Rename Variable");
|
||||
performAction(action, false);
|
||||
performAction(action, provider.getActionContext(null), false);
|
||||
|
||||
InputDialog dialog = waitForDialogComponent(InputDialog.class);
|
||||
runSwing(() -> dialog.setValue(newName));
|
||||
@@ -1077,7 +1077,7 @@ public class DecompilerClangTest extends AbstractDecompilerTest {
|
||||
|
||||
DockingActionIf highlightAction =
|
||||
getAction(decompiler, RemoveAllSecondaryHighlightsAction.NAME);
|
||||
performAction(highlightAction);
|
||||
performAction(highlightAction, provider.getActionContext(null), true);
|
||||
}
|
||||
|
||||
private Color highlight() {
|
||||
@@ -1085,7 +1085,7 @@ public class DecompilerClangTest extends AbstractDecompilerTest {
|
||||
ClangToken token = getToken();
|
||||
|
||||
DockingActionIf highlightAction = getAction(decompiler, SetSecondaryHighlightAction.NAME);
|
||||
performAction(highlightAction);
|
||||
performAction(highlightAction, provider.getActionContext(null), true);
|
||||
|
||||
HighlightToken ht = getSecondaryHighlight(token);
|
||||
assertNotNull("No highlight for token: " + token, ht);
|
||||
@@ -1106,7 +1106,7 @@ public class DecompilerClangTest extends AbstractDecompilerTest {
|
||||
|
||||
DockingActionIf highlightAction =
|
||||
getAction(decompiler, SetSecondaryHighlightColorChooserAction.NAME);
|
||||
performAction(highlightAction, false);
|
||||
performAction(highlightAction, provider.getActionContext(null), false);
|
||||
|
||||
Window w = waitForWindow("Please Choose a Color");
|
||||
GhidraColorChooser colorChooser = findComponent(w, GhidraColorChooser.class);
|
||||
@@ -1238,7 +1238,7 @@ public class DecompilerClangTest extends AbstractDecompilerTest {
|
||||
for (DockingActionIf action : actions) {
|
||||
Object service = getInstanceField("clipboardService", action);
|
||||
if (service.getClass().toString().contains("Decomp")) {
|
||||
performAction(action);
|
||||
performAction(action, provider.getActionContext(null), true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2166,12 +2166,6 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||
Double scale = getGraphScale(getPrimaryGraphViewer());
|
||||
int result = Double.compare(scale, 1.0);
|
||||
assertEquals("Graph not fully zoomed-in; scale: " + scale, 0, result);
|
||||
|
||||
FGVertex v = getFocusedVertex();
|
||||
Rectangle cursorBounds = v.getCursorBounds();
|
||||
Window graphWindow = windowForComponent(getPrimaryGraphViewer());
|
||||
Rectangle windowBounds = graphWindow.getBounds();
|
||||
assertTrue(windowBounds.contains(cursorBounds));
|
||||
}
|
||||
|
||||
protected void assertZoomedOut() {
|
||||
@@ -2277,7 +2271,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||
|
||||
protected void goTo(Address address) {
|
||||
GoToService goToService = tool.getService(GoToService.class);
|
||||
goToService.goTo(address);
|
||||
runSwing(() -> goToService.goTo(address));
|
||||
waitForBusyGraph();
|
||||
}
|
||||
|
||||
|
||||
@@ -843,7 +843,7 @@ public class FunctionGraphPlugin1Test extends AbstractFunctionGraphTest {
|
||||
private void setNavigationHistoryOption(NavigationHistoryChoices choice) throws Exception {
|
||||
FGController controller = getFunctionGraphController();
|
||||
FunctionGraphOptions options = controller.getFunctionGraphOptions();
|
||||
setInstanceField("navigationHistoryChoice", options, choice);
|
||||
runSwing(() -> setInstanceField("navigationHistoryChoice", options, choice));
|
||||
waitForSwing();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ public interface HoverProvider {
|
||||
|
||||
/**
|
||||
* Returns true if this service's popup window is currently visible
|
||||
* @return true if this service's popup window is currently visible
|
||||
*/
|
||||
public boolean isShowing();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user