mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-2897 Allow Diff with another open program within same tool. Modified
OpenVersionedFileDialog to faciltate the program selection.
This commit is contained in:
@@ -45,8 +45,7 @@ public class DiffScreenShots extends GhidraScreenShotGenerator {
|
||||
public void testSelectOtherProgram() throws Exception {
|
||||
addProgramsToProject();
|
||||
program = env.getProgram("WinHelloCPP.exe");
|
||||
performAction("Open/Close Program View", "ProgramDiffPlugin", false);
|
||||
performAction("Open/Close Program View", "ProgramDiffPlugin", false);
|
||||
performAction("Open/Close Diff View", "ProgramDiffPlugin", false);
|
||||
waitForSwing();
|
||||
DialogComponentProvider dialog = getDialog();
|
||||
captureDialog(dialog.getPreferredSize().width, 500);
|
||||
@@ -59,10 +58,10 @@ public class DiffScreenShots extends GhidraScreenShotGenerator {
|
||||
addProgramsToProject();
|
||||
createProgramVersions();
|
||||
waitForSwing();
|
||||
performAction("Open/Close Program View", "ProgramDiffPlugin", false);
|
||||
performAction("Open/Close Program View", "ProgramDiffPlugin", false);
|
||||
performAction("Open/Close Diff View", "ProgramDiffPlugin", false);
|
||||
waitForSwing();
|
||||
OpenVersionedFileDialog dialog = (OpenVersionedFileDialog) getDialog();
|
||||
@SuppressWarnings("unchecked")
|
||||
OpenVersionedFileDialog<Program> dialog = (OpenVersionedFileDialog<Program>) getDialog();
|
||||
DataTree dataTree = (DataTree) findComponentByName(dialog.getComponent(), "Data Tree");
|
||||
selectPath(dataTree, env.getProject().getName(), "WinHelloCpp.exe");
|
||||
JButton historyButton = findButtonByText(dialog.getComponent(), "History>>");
|
||||
@@ -70,13 +69,34 @@ public class DiffScreenShots extends GhidraScreenShotGenerator {
|
||||
captureDialog();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectOpenProgram() throws Exception {
|
||||
addProgramsToProject();
|
||||
createProgramVersions();
|
||||
runSwing(() -> {
|
||||
Project project = env.getProject();
|
||||
ProjectData projectData = project.getProjectData();
|
||||
DomainFile file = projectData.getRootFolder().getFile("OldWinHelloCpp.exe");
|
||||
ProgramManager pm = tool.getService(ProgramManager.class);
|
||||
pm.openProgram(file);
|
||||
});
|
||||
waitForSwing();
|
||||
performAction("Open/Close Diff View", "ProgramDiffPlugin", false);
|
||||
waitForSwing();
|
||||
@SuppressWarnings("unchecked")
|
||||
OpenVersionedFileDialog<Program> dialog = (OpenVersionedFileDialog<Program>) getDialog();
|
||||
JTabbedPane tabPane = (JTabbedPane) findComponentByName(dialog.getComponent(), "Tabs");
|
||||
runSwing(() -> tabPane.setSelectedIndex(1)); // select Open Programs tab
|
||||
captureDialog(dialog.getPreferredSize().width, 500);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDetermineDiffs() throws Exception {
|
||||
addProgramsToProject();
|
||||
performAction("Open/Close Program View", "ProgramDiffPlugin", false);
|
||||
performAction("Open/Close Program View", "ProgramDiffPlugin", false);
|
||||
performAction("Open/Close Diff View", "ProgramDiffPlugin", false);
|
||||
waitForSwing();
|
||||
OpenVersionedFileDialog dialog = (OpenVersionedFileDialog) getDialog();
|
||||
@SuppressWarnings("unchecked")
|
||||
OpenVersionedFileDialog<Program> dialog = (OpenVersionedFileDialog<Program>) getDialog();
|
||||
DataTree dataTree = (DataTree) findComponentByName(dialog.getComponent(), "Data Tree");
|
||||
selectPath(dataTree, env.getProject().getName(), "WinHelloCpp.exe");
|
||||
waitForSwing();
|
||||
@@ -89,10 +109,10 @@ public class DiffScreenShots extends GhidraScreenShotGenerator {
|
||||
public void testDiff() throws Exception {
|
||||
addProgramsToProject();
|
||||
createDifferences();
|
||||
performAction("Open/Close Program View", "ProgramDiffPlugin", false);
|
||||
performAction("Open/Close Program View", "ProgramDiffPlugin", false);
|
||||
performAction("Open/Close Diff View", "ProgramDiffPlugin", false);
|
||||
waitForSwing();
|
||||
OpenVersionedFileDialog dialog = (OpenVersionedFileDialog) getDialog();
|
||||
@SuppressWarnings("unchecked")
|
||||
OpenVersionedFileDialog<Program> dialog = (OpenVersionedFileDialog<Program>) getDialog();
|
||||
DataTree dataTree = (DataTree) findComponentByName(dialog.getComponent(), "Data Tree");
|
||||
selectPath(dataTree, env.getProject().getName(), "WinHelloCpp.exe");
|
||||
waitForSwing();
|
||||
@@ -111,10 +131,10 @@ public class DiffScreenShots extends GhidraScreenShotGenerator {
|
||||
public void testDiffApplySettings() throws Exception {
|
||||
addProgramsToProject();
|
||||
createDifferences();
|
||||
performAction("Open/Close Program View", "ProgramDiffPlugin", false);
|
||||
performAction("Open/Close Program View", "ProgramDiffPlugin", false);
|
||||
performAction("Open/Close Diff View", "ProgramDiffPlugin", false);
|
||||
waitForSwing();
|
||||
OpenVersionedFileDialog dialog = (OpenVersionedFileDialog) getDialog();
|
||||
@SuppressWarnings("unchecked")
|
||||
OpenVersionedFileDialog<Program> dialog = (OpenVersionedFileDialog<Program>) getDialog();
|
||||
DataTree dataTree = (DataTree) findComponentByName(dialog.getComponent(), "Data Tree");
|
||||
selectPath(dataTree, env.getProject().getName(), "WinHelloCpp.exe");
|
||||
waitForSwing();
|
||||
@@ -149,10 +169,10 @@ public class DiffScreenShots extends GhidraScreenShotGenerator {
|
||||
public void testDiffDetails() throws Exception {
|
||||
addProgramsToProject();
|
||||
createDifferencesAt401417();
|
||||
performAction("Open/Close Program View", "ProgramDiffPlugin", false);
|
||||
performAction("Open/Close Program View", "ProgramDiffPlugin", false);
|
||||
performAction("Open/Close Diff View", "ProgramDiffPlugin", false);
|
||||
waitForSwing();
|
||||
OpenVersionedFileDialog dialog = (OpenVersionedFileDialog) getDialog();
|
||||
@SuppressWarnings("unchecked")
|
||||
OpenVersionedFileDialog<Program> dialog = (OpenVersionedFileDialog<Program>) getDialog();
|
||||
DataTree dataTree = (DataTree) findComponentByName(dialog.getComponent(), "Data Tree");
|
||||
selectPath(dataTree, env.getProject().getName(), "WinHelloCpp.exe");
|
||||
waitForSwing();
|
||||
|
||||
Reference in New Issue
Block a user