mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 09:05:33 +08:00
GP-0 Corrected test failures related to recent changes.
This commit is contained in:
+2
@@ -374,9 +374,11 @@ public class ProgramManagerPlugin extends Plugin implements ProgramManager, Opti
|
||||
for (Program p : openPrograms) {
|
||||
if (ignoreChanges) {
|
||||
toRemove.add(p);
|
||||
continue;
|
||||
}
|
||||
else if (p.isClosed()) {
|
||||
toRemove.add(p);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!tool.canCloseDomainObject(p)) {
|
||||
|
||||
+5
-2
@@ -34,6 +34,7 @@ import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import docking.widgets.fieldpanel.support.FieldSelection;
|
||||
import ghidra.app.cmd.data.CreateDataCmd;
|
||||
import ghidra.app.cmd.data.CreateStructureCmd;
|
||||
import ghidra.app.events.OpenProgramPluginEvent;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
import ghidra.app.services.ProgramManager;
|
||||
import ghidra.app.util.viewer.field.*;
|
||||
@@ -382,6 +383,9 @@ public class CodeBrowserScreenMovementTest extends AbstractProgramBasedTest {
|
||||
|
||||
env.connectTools(tool, tool2);
|
||||
|
||||
// open same program in second tool - cannot rely on tool connection for this
|
||||
tool2.firePluginEvent(new OpenProgramPluginEvent("Test", program));
|
||||
|
||||
codeBrowser.goToField(addr("0x1006420"), "Address", 0, 0);
|
||||
assertEquals("01006420", cb2.getCurrentFieldText());
|
||||
|
||||
@@ -795,8 +799,7 @@ public class CodeBrowserScreenMovementTest extends AbstractProgramBasedTest {
|
||||
private void resetFormatOptions(CodeBrowserPlugin plugin) {
|
||||
Options fieldOptions = plugin.getFormatManager().getFieldOptions();
|
||||
List<String> names = fieldOptions.getOptionNames();
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
String name = names.get(i);
|
||||
for (String name : names) {
|
||||
if (!name.startsWith("Format Code")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
+4
@@ -33,6 +33,7 @@ import docking.widgets.fieldpanel.field.Field;
|
||||
import docking.widgets.fieldpanel.support.*;
|
||||
import docking.widgets.table.GTable;
|
||||
import ghidra.app.cmd.data.CreateDataCmd;
|
||||
import ghidra.app.events.OpenProgramPluginEvent;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
import ghidra.app.plugin.core.codebrowser.SelectEndpointsAction.RangeEndpoint;
|
||||
import ghidra.app.plugin.core.navigation.NextPrevAddressPlugin;
|
||||
@@ -382,6 +383,9 @@ public class CodeBrowserTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
env.connectTools(tool, tool2);
|
||||
|
||||
// open same program in second tool - cannot rely on tool connection for this
|
||||
tool2.firePluginEvent(new OpenProgramPluginEvent("Test", program));
|
||||
|
||||
cb.goToField(addr("0x1003a50"), "Bytes", 0, 4);
|
||||
Point p1 = getCursorPoint();
|
||||
cb.goToField(addr("0x1003a5e"), "Mnemonic", 0, 0, 2, false);
|
||||
|
||||
+5
-1
@@ -31,6 +31,7 @@ import docking.widgets.table.threaded.GThreadedTablePanel;
|
||||
import generic.test.TestUtils;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.cmd.data.CreateDataCmd;
|
||||
import ghidra.app.events.OpenProgramPluginEvent;
|
||||
import ghidra.app.events.ProgramLocationPluginEvent;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||
import ghidra.app.plugin.core.navigation.GoToAddressLabelPlugin;
|
||||
@@ -231,7 +232,10 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
env.connectTools(tool, tool2);
|
||||
env.connectTools(tool2, tool);
|
||||
env.open(program); // do this again now that the tools are in-sync
|
||||
env.open(program);
|
||||
|
||||
// open same program in second tool - cannot rely on tool connection for this
|
||||
tool2.firePluginEvent(new OpenProgramPluginEvent("Test", program));
|
||||
|
||||
Address addr = addr(0x01006420);
|
||||
sendProgramLocation(addr, CodeUnit.EOL_COMMENT);
|
||||
|
||||
+22
-1
@@ -136,6 +136,13 @@ public class MultiTabPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
assertNotNull(iconLabel);
|
||||
Point p = iconLabel.getLocationOnScreen();
|
||||
clickMouse(iconLabel, MouseEvent.BUTTON1, p.x + 1, p.y + 1, 1, 0);
|
||||
|
||||
JDialog dlg = waitForJDialog("Program Changed");
|
||||
JButton button = findButtonByText(dlg, "Continue");
|
||||
pressButton(button);
|
||||
|
||||
waitForSwing();
|
||||
|
||||
assertEquals(2, panel.getTabCount());
|
||||
}
|
||||
|
||||
@@ -160,9 +167,23 @@ public class MultiTabPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
JLabel iconLabel = (JLabel) findComponentByName(tab, "Close");
|
||||
Point p = iconLabel.getLocationOnScreen();
|
||||
clickMouse(iconLabel, MouseEvent.BUTTON1, p.x + 1, p.y + 1, 1, 0);
|
||||
|
||||
JDialog dlg = waitForJDialog("Program Changed");
|
||||
JButton button = findButtonByText(dlg, "Continue");
|
||||
pressButton(button);
|
||||
}
|
||||
|
||||
runSwing(() -> panel.removeProgram(programs[programs.length - 1]));
|
||||
// Last program does not have a tab
|
||||
ProgramManagerPlugin programMgr = env.getPlugin(ProgramManagerPlugin.class);
|
||||
runSwingLater(() -> programMgr.closeProgram());
|
||||
|
||||
waitForSwing();
|
||||
|
||||
JDialog dlg = waitForJDialog("Program Changed");
|
||||
JButton button = findButtonByText(dlg, "Continue");
|
||||
pressButton(button);
|
||||
|
||||
waitForSwing();
|
||||
|
||||
assertEquals(0, panel.getTabCount());
|
||||
}
|
||||
|
||||
+10
-2
@@ -27,6 +27,7 @@ import org.junit.*;
|
||||
import docking.DefaultActionContext;
|
||||
import docking.action.ToggleDockingAction;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import ghidra.app.events.OpenProgramPluginEvent;
|
||||
import ghidra.app.plugin.core.format.*;
|
||||
import ghidra.app.plugin.core.navigation.NavigationHistoryPlugin;
|
||||
import ghidra.app.plugin.core.navigation.NextPrevAddressPlugin;
|
||||
@@ -70,6 +71,13 @@ public class ByteViewerConnectedToolBehaviorTest extends AbstractGhidraHeadedInt
|
||||
env.connectTools(toolOne, tool2);
|
||||
|
||||
program = buildNotepad();
|
||||
|
||||
// open program in toolOne
|
||||
env.open(program);
|
||||
|
||||
// open same program in second tool - cannot rely on tool connection for this
|
||||
tool2.firePluginEvent(new OpenProgramPluginEvent("Test", program));
|
||||
|
||||
final ProgramManager pm = toolOne.getService(ProgramManager.class);
|
||||
runSwing(() -> pm.openProgram(program.getDomainFile()));
|
||||
}
|
||||
@@ -223,8 +231,8 @@ public class ByteViewerConnectedToolBehaviorTest extends AbstractGhidraHeadedInt
|
||||
}
|
||||
|
||||
private Address convertToAddr(ByteViewerPlugin plugin, ByteBlockInfo info) {
|
||||
return ((ProgramByteBlockSet) plugin.getProvider().getByteBlockSet()).getAddress(
|
||||
info.getBlock(), info.getOffset());
|
||||
return ((ProgramByteBlockSet) plugin.getProvider().getByteBlockSet())
|
||||
.getAddress(info.getBlock(), info.getOffset());
|
||||
}
|
||||
|
||||
private boolean byteBlockSelectionEquals(ByteBlockSelection b1, ByteBlockSelection b2) {
|
||||
|
||||
Reference in New Issue
Block a user