mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
Test fixes
This commit is contained in:
parent
33867f718b
commit
4ee2d81c49
6 changed files with 38 additions and 46 deletions
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -428,7 +428,7 @@ public class DiffTest extends DiffTestAdapter {
|
|||
|
||||
// Replace view with .data
|
||||
selectTreeNodeByText(tree, ".data");
|
||||
invokeAndWait(replaceView);
|
||||
setView();
|
||||
topOfFile(fp1);
|
||||
assertEquals(addr("1008000"), cb.getCurrentAddress());
|
||||
bottomOfFile(fp1);
|
||||
|
@ -436,7 +436,7 @@ public class DiffTest extends DiffTestAdapter {
|
|||
|
||||
// Replace with program view
|
||||
selectTreeNodeByText(tree, "DiffTestPgm1");
|
||||
invokeAndWait(replaceView);
|
||||
setView();
|
||||
topOfFile(fp1);
|
||||
assertEquals(addr("100"), cb.getCurrentAddress());
|
||||
bottomOfFile(fp1);
|
||||
|
@ -455,8 +455,7 @@ public class DiffTest extends DiffTestAdapter {
|
|||
openDiff(diffTestP1, diffTestP2);
|
||||
JTree tree = getProgramTree();
|
||||
selectTreeNodeByText(tree, ".data");
|
||||
|
||||
runSwing(() -> replaceView.actionPerformed(new DefaultActionContext()));
|
||||
setView();
|
||||
|
||||
topOfFile(fp1);
|
||||
assertEquals(addr("1008000"), cb.getCurrentAddress());
|
||||
|
@ -482,11 +481,11 @@ public class DiffTest extends DiffTestAdapter {
|
|||
JTree tree = getProgramTree();
|
||||
selectTreeNodeByText(tree, ".data");
|
||||
|
||||
runSwing(() -> replaceView.actionPerformed(new DefaultActionContext()));
|
||||
runSwing(() -> setView.actionPerformed(programTreeProvider.getActionContext(null)));
|
||||
|
||||
selectTreeNodeByText(tree, ".rsrc");
|
||||
|
||||
runSwing(() -> goToView.actionPerformed(new DefaultActionContext()));
|
||||
runSwing(() -> goToView.actionPerformed(programTreeProvider.getActionContext(null)));
|
||||
|
||||
topOfFile(fp1);
|
||||
assertEquals(addr("1008000"), cb.getCurrentAddress());
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -111,7 +111,7 @@ public class DiffTestAdapter extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
ProgramTreePlugin pt;
|
||||
ComponentProvider programTreeProvider;
|
||||
DockingActionIf replaceView;
|
||||
DockingActionIf setView;
|
||||
DockingActionIf goToView;
|
||||
DockingActionIf removeView;
|
||||
|
||||
|
@ -484,8 +484,8 @@ public class DiffTestAdapter extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
tool.addPlugin(ProgramTreePlugin.class.getName());
|
||||
pt = env.getPlugin(ProgramTreePlugin.class);
|
||||
showProgramTree();
|
||||
replaceView = getAction(pt, "Replace View");
|
||||
programTreeProvider = showProvider(tool, "Program Tree");
|
||||
setView = getAction(pt, "Set View");
|
||||
goToView = getAction(pt, "Go To start of folder/fragment in View");
|
||||
removeView = getAction(pt, "Remove folder/fragment from View");
|
||||
|
||||
|
@ -511,6 +511,11 @@ public class DiffTestAdapter extends AbstractGhidraHeadedIntegrationTest {
|
|||
env.dispose();
|
||||
}
|
||||
|
||||
protected void setView() {
|
||||
ActionContext context = runSwing(() -> programTreeProvider.getActionContext(null));
|
||||
performAction(setView, context, true);
|
||||
}
|
||||
|
||||
void closeDiff() throws Exception {
|
||||
|
||||
closeDiffByAction();
|
||||
|
@ -1134,13 +1139,6 @@ public class DiffTestAdapter extends AbstractGhidraHeadedIntegrationTest {
|
|||
assertEquals(expectedSelection, currentSelection);
|
||||
}
|
||||
|
||||
private void showProgramTree() {
|
||||
|
||||
ProgramTreePlugin ptree = env.getPlugin(ProgramTreePlugin.class);
|
||||
programTreeProvider = (ComponentProvider) getInstanceField("viewProvider", ptree);
|
||||
tool.showComponentProvider(programTreeProvider, true);
|
||||
}
|
||||
|
||||
JTree getProgramTree() {
|
||||
JTree tree = findComponent(programTreeProvider.getComponent(), JTree.class);
|
||||
return tree;
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -36,6 +36,7 @@ import ghidra.app.services.ProgramManager;
|
|||
import ghidra.framework.cmd.CompoundCmd;
|
||||
import ghidra.program.database.ProgramBuilder;
|
||||
import ghidra.program.database.ProgramDB;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.symbol.SourceType;
|
||||
|
||||
public class DualProgramTest extends DiffTestAdapter {
|
||||
|
@ -349,7 +350,7 @@ public class DualProgramTest extends DiffTestAdapter {
|
|||
|
||||
// Modify the active program.
|
||||
setLocation("100f3ff");
|
||||
CompoundCmd cmd = new CompoundCmd("test");
|
||||
CompoundCmd<Program> cmd = new CompoundCmd<>("test");
|
||||
cmd.add(new AddLabelCmd(addr("100f3ff"), "TestLabel", false, SourceType.USER_DEFINED));
|
||||
cmd.add(
|
||||
new AddLabelCmd(addr("100f3ff"), "AnotherTestLabel", false, SourceType.USER_DEFINED));
|
||||
|
@ -375,7 +376,7 @@ public class DualProgramTest extends DiffTestAdapter {
|
|||
openSecondProgram(diffTestP1, diffTestP2);
|
||||
JTree tree = findComponent(tool.getToolFrame(), JTree.class);
|
||||
selectTreeNodeByText(tree, "DiffTestPgm1");
|
||||
performAction(replaceView, true);
|
||||
setView();
|
||||
topOfFile(fp1);
|
||||
assertEquals(addr("00000100"), cb.getCurrentAddress());
|
||||
bottomOfFile(fp1);
|
||||
|
@ -387,7 +388,7 @@ public class DualProgramTest extends DiffTestAdapter {
|
|||
openSecondProgram(diffTestP1, diffTestP2);
|
||||
JTree tree = findComponent(tool.getToolFrame(), JTree.class);
|
||||
selectTreeNodeByText(tree, ".data");
|
||||
performAction(replaceView, true);
|
||||
setView();
|
||||
topOfFile(fp1);
|
||||
assertEquals(addr("1008000"), cb.getCurrentAddress());
|
||||
bottomOfFile(fp1);
|
||||
|
@ -399,7 +400,7 @@ public class DualProgramTest extends DiffTestAdapter {
|
|||
openSecondProgram(diffTestP1, diffTestP2);
|
||||
JTree tree = findComponent(tool.getToolFrame(), JTree.class);
|
||||
selectTreeNodeByText(tree, ".data");
|
||||
performAction(replaceView, true);
|
||||
setView();
|
||||
selectTreeNodeByText(tree, ".rsrc");
|
||||
|
||||
performAction(goToView, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue