Merge remote-tracking branch 'origin/GP-0-dragonmacher-test-fixes-8-14-24'

This commit is contained in:
Ryan Kurtz 2024-08-15 06:02:06 -04:00
commit 3b175b9bf9
3 changed files with 19 additions and 14 deletions

View File

@ -148,7 +148,7 @@ public class ProgramTreePlugin extends ProgramPlugin
private void initOptions(ToolOptions options) {
isReplaceViewMode = options.getBoolean(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);
}

View File

@ -29,8 +29,7 @@ import javax.swing.tree.TreePath;
import org.junit.Test;
import docking.DefaultActionContext;
import docking.DialogComponentProvider;
import docking.*;
import docking.action.DockingActionIf;
import docking.widgets.fieldpanel.FieldPanel;
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.program.database.ProgramBuilder;
import ghidra.program.database.ProgramDB;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSet;
import ghidra.program.model.data.ArrayDataType;
import ghidra.program.model.data.WordDataType;
@ -549,7 +549,8 @@ public class DiffTest extends DiffTestAdapter {
openDiff(diffTestP1, diffTestP2);
JTree tree = getProgramTree();
selectTreeNodeByText(tree, "DiffTestPgm1");
performAction(removeView, true);
ActionContext context = runSwing(() -> programTreeProvider.getActionContext(null));
performAction(removeView, context, true);
AddressSet viewSet = new AddressSet();
assertEquals(viewSet, cb.getView());
topOfFile(fp1);
@ -823,27 +824,31 @@ public class DiffTest extends DiffTestAdapter {
Data data = diffTestP1.getListing().getDataAt(addr("0x00000106"));
ListingModel listingModel = cb.getListingModel();
cb.goToField(addr("0x00000106"), "+", 0, 0);
goTo(addr("0x00000106"), "+");
assertTrue(cb.getCurrentField() instanceof OpenCloseField);
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());
cb.goToField(addr("0x00000106"), "Address", 0, 0);
goTo(addr("0x00000106"), "Address");
assertEquals("00000106", cb.getCurrentFieldText());
cb.goToField(addr("0x00000106"), "+", 0, 0);
goTo(addr("0x00000106"), "+");
click(cb, 1);
waitForSwing();
assertTrue("Array failed to open.", listingModel.isOpen(data));
cb.goToField(addr("0x00000106"), "+", 0, 0);
goTo(addr("0x00000106"), "+");
click(cb, 1);
waitForSwing();
cb.goToField(addr("0x00000120"), "Address", 0, 0);
cb.goToField(addr("0x00000106"), "Address", 0, 0);
goTo(addr("0x00000120"), "Address");
goTo(addr("0x00000106"), "Address");
assertEquals("00000106", cb.getCurrentFieldText());
assertFalse("Array failed to close.", listingModel.isOpen(data));
}
private void goTo(Address a, String fieldName) {
cb.goToField(a, fieldName, 0, 0);
waitForSwing();
}
//==================================================================================================

View File

@ -27,8 +27,7 @@ import javax.swing.tree.TreePath;
import org.junit.Test;
import docking.DefaultActionContext;
import docking.DialogComponentProvider;
import docking.*;
import docking.widgets.MultiLineLabel;
import docking.widgets.fieldpanel.LayoutModel;
import ghidra.app.cmd.label.AddLabelCmd;
@ -403,7 +402,8 @@ public class DualProgramTest extends DiffTestAdapter {
setView();
selectTreeNodeByText(tree, ".rsrc");
performAction(goToView, true);
ActionContext context = runSwing(() -> programTreeProvider.getActionContext(null));
performAction(goToView, context, true);
topOfFile(fp1);
assertEquals(addr("1008000"), cb.getCurrentAddress());