Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/GP-0-dragonmacher-test-fixes-8-1…
Browse files Browse the repository at this point in the history
…4-24'
  • Loading branch information
ryanmkurtz committed Aug 15, 2024
2 parents 040af66 + 93bbe03 commit 3b175b9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void serviceRemoved(Class<?> interfaceClass, Object service) {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@

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;
Expand All @@ -43,6 +42,7 @@
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;
Expand Down Expand Up @@ -549,7 +549,8 @@ public void testEmptyViewDiff() throws Exception {
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);
Expand Down Expand Up @@ -823,27 +824,31 @@ public void testOpenCloseArrayWithDiffShowing() throws Exception {

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();
}

//==================================================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@

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;
Expand Down Expand Up @@ -403,7 +402,8 @@ public void testMultipleFragmentsDiff() throws Exception {
setView();
selectTreeNodeByText(tree, ".rsrc");

performAction(goToView, true);
ActionContext context = runSwing(() -> programTreeProvider.getActionContext(null));
performAction(goToView, context, true);

topOfFile(fp1);
assertEquals(addr("1008000"), cb.getCurrentAddress());
Expand Down

0 comments on commit 3b175b9

Please sign in to comment.