mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
Test fixes
This commit is contained in:
parent
be305db930
commit
93bbe03eee
3 changed files with 19 additions and 14 deletions
|
@ -148,7 +148,7 @@ public class ProgramTreePlugin extends ProgramPlugin
|
||||||
private void initOptions(ToolOptions options) {
|
private void initOptions(ToolOptions options) {
|
||||||
isReplaceViewMode = options.getBoolean(REPLACE_VIEW_OPTION_NAME, isReplaceViewMode);
|
isReplaceViewMode = options.getBoolean(REPLACE_VIEW_OPTION_NAME, isReplaceViewMode);
|
||||||
options.registerOption(REPLACE_VIEW_OPTION_NAME, isReplaceViewMode,
|
options.registerOption(REPLACE_VIEW_OPTION_NAME, isReplaceViewMode,
|
||||||
new HelpLocation(getName(), "Replace_View"), REPLACE_VIEW_OPTION_DESCRIPTION);
|
new HelpLocation(getName(), "Set_View"), REPLACE_VIEW_OPTION_DESCRIPTION);
|
||||||
|
|
||||||
options.addOptionsChangeListener(this);
|
options.addOptionsChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,7 @@ import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import docking.DefaultActionContext;
|
import docking.*;
|
||||||
import docking.DialogComponentProvider;
|
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.fieldpanel.FieldPanel;
|
import docking.widgets.fieldpanel.FieldPanel;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
@ -43,6 +42,7 @@ import ghidra.app.util.viewer.field.OpenCloseField;
|
||||||
import ghidra.app.util.viewer.listingpanel.ListingModel;
|
import ghidra.app.util.viewer.listingpanel.ListingModel;
|
||||||
import ghidra.program.database.ProgramBuilder;
|
import ghidra.program.database.ProgramBuilder;
|
||||||
import ghidra.program.database.ProgramDB;
|
import ghidra.program.database.ProgramDB;
|
||||||
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.program.model.address.AddressSet;
|
import ghidra.program.model.address.AddressSet;
|
||||||
import ghidra.program.model.data.ArrayDataType;
|
import ghidra.program.model.data.ArrayDataType;
|
||||||
import ghidra.program.model.data.WordDataType;
|
import ghidra.program.model.data.WordDataType;
|
||||||
|
@ -549,7 +549,8 @@ public class DiffTest extends DiffTestAdapter {
|
||||||
openDiff(diffTestP1, diffTestP2);
|
openDiff(diffTestP1, diffTestP2);
|
||||||
JTree tree = getProgramTree();
|
JTree tree = getProgramTree();
|
||||||
selectTreeNodeByText(tree, "DiffTestPgm1");
|
selectTreeNodeByText(tree, "DiffTestPgm1");
|
||||||
performAction(removeView, true);
|
ActionContext context = runSwing(() -> programTreeProvider.getActionContext(null));
|
||||||
|
performAction(removeView, context, true);
|
||||||
AddressSet viewSet = new AddressSet();
|
AddressSet viewSet = new AddressSet();
|
||||||
assertEquals(viewSet, cb.getView());
|
assertEquals(viewSet, cb.getView());
|
||||||
topOfFile(fp1);
|
topOfFile(fp1);
|
||||||
|
@ -823,27 +824,31 @@ public class DiffTest extends DiffTestAdapter {
|
||||||
|
|
||||||
Data data = diffTestP1.getListing().getDataAt(addr("0x00000106"));
|
Data data = diffTestP1.getListing().getDataAt(addr("0x00000106"));
|
||||||
ListingModel listingModel = cb.getListingModel();
|
ListingModel listingModel = cb.getListingModel();
|
||||||
cb.goToField(addr("0x00000106"), "+", 0, 0);
|
goTo(addr("0x00000106"), "+");
|
||||||
assertTrue(cb.getCurrentField() instanceof OpenCloseField);
|
assertTrue(cb.getCurrentField() instanceof OpenCloseField);
|
||||||
assertFalse("Array is not closed as expected.", listingModel.isOpen(data));
|
assertFalse("Array is not closed as expected.", listingModel.isOpen(data));
|
||||||
cb.goToField(addr("0x00000120"), "Address", 0, 0);
|
goTo(addr("0x00000120"), "Address");
|
||||||
assertEquals("00000120", cb.getCurrentFieldText());
|
assertEquals("00000120", cb.getCurrentFieldText());
|
||||||
cb.goToField(addr("0x00000106"), "Address", 0, 0);
|
goTo(addr("0x00000106"), "Address");
|
||||||
assertEquals("00000106", cb.getCurrentFieldText());
|
assertEquals("00000106", cb.getCurrentFieldText());
|
||||||
|
|
||||||
cb.goToField(addr("0x00000106"), "+", 0, 0);
|
goTo(addr("0x00000106"), "+");
|
||||||
click(cb, 1);
|
click(cb, 1);
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
assertTrue("Array failed to open.", listingModel.isOpen(data));
|
assertTrue("Array failed to open.", listingModel.isOpen(data));
|
||||||
|
|
||||||
cb.goToField(addr("0x00000106"), "+", 0, 0);
|
goTo(addr("0x00000106"), "+");
|
||||||
click(cb, 1);
|
click(cb, 1);
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
cb.goToField(addr("0x00000120"), "Address", 0, 0);
|
goTo(addr("0x00000120"), "Address");
|
||||||
cb.goToField(addr("0x00000106"), "Address", 0, 0);
|
goTo(addr("0x00000106"), "Address");
|
||||||
assertEquals("00000106", cb.getCurrentFieldText());
|
assertEquals("00000106", cb.getCurrentFieldText());
|
||||||
assertFalse("Array failed to close.", listingModel.isOpen(data));
|
assertFalse("Array failed to close.", listingModel.isOpen(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void goTo(Address a, String fieldName) {
|
||||||
|
cb.goToField(a, fieldName, 0, 0);
|
||||||
|
waitForSwing();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|
|
@ -27,8 +27,7 @@ import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import docking.DefaultActionContext;
|
import docking.*;
|
||||||
import docking.DialogComponentProvider;
|
|
||||||
import docking.widgets.MultiLineLabel;
|
import docking.widgets.MultiLineLabel;
|
||||||
import docking.widgets.fieldpanel.LayoutModel;
|
import docking.widgets.fieldpanel.LayoutModel;
|
||||||
import ghidra.app.cmd.label.AddLabelCmd;
|
import ghidra.app.cmd.label.AddLabelCmd;
|
||||||
|
@ -403,7 +402,8 @@ public class DualProgramTest extends DiffTestAdapter {
|
||||||
setView();
|
setView();
|
||||||
selectTreeNodeByText(tree, ".rsrc");
|
selectTreeNodeByText(tree, ".rsrc");
|
||||||
|
|
||||||
performAction(goToView, true);
|
ActionContext context = runSwing(() -> programTreeProvider.getActionContext(null));
|
||||||
|
performAction(goToView, context, true);
|
||||||
|
|
||||||
topOfFile(fp1);
|
topOfFile(fp1);
|
||||||
assertEquals(addr("1008000"), cb.getCurrentAddress());
|
assertEquals(addr("1008000"), cb.getCurrentAddress());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue