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
051a0b3405
commit
33b9315c18
10 changed files with 61 additions and 46 deletions
|
@ -30,7 +30,6 @@ import org.junit.Test;
|
|||
|
||||
import docking.test.AbstractDockingTest;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
import ghidra.test.DummyTool;
|
||||
|
||||
public class DockingWindowManagerTest extends AbstractDockingTest {
|
||||
|
@ -597,12 +596,12 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||
}
|
||||
}
|
||||
|
||||
class MyProvider extends ComponentProviderAdapter {
|
||||
private class MyProvider extends ComponentProvider {
|
||||
JLabel label = new GDLabel();
|
||||
|
||||
public MyProvider(String owner, String name, String group, String title,
|
||||
WindowPosition defaultWindowPosition) {
|
||||
super(null, name, owner);
|
||||
super(DockingWindowManagerTest.this.tool, name, owner);
|
||||
setWindowGroup(group);
|
||||
setDefaultWindowPosition(defaultWindowPosition);
|
||||
setTitle(title);
|
||||
|
|
|
@ -51,8 +51,9 @@ public class GhidraTableFilterTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
filteredModel = filterPanel.getTableFilterModel();
|
||||
table.setAutoLookupColumn(4);
|
||||
|
||||
winMgr = new DockingWindowManager(new DummyTool(), null);
|
||||
winMgr.addComponent(new TestTableComponentProvider());
|
||||
DummyTool tool = new DummyTool();
|
||||
winMgr = new DockingWindowManager(tool, null);
|
||||
winMgr.addComponent(new TestTableComponentProvider(tool));
|
||||
winMgr.setVisible(true);
|
||||
}
|
||||
|
||||
|
@ -421,8 +422,8 @@ public class GhidraTableFilterTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
private class TestTableComponentProvider extends ComponentProvider {
|
||||
|
||||
public TestTableComponentProvider() {
|
||||
super(null, "Test", "Test");
|
||||
public TestTableComponentProvider(DummyTool tool) {
|
||||
super(tool, "Test", "Test");
|
||||
setDefaultWindowPosition(WindowPosition.STACK);
|
||||
setTabText("Test");
|
||||
}
|
||||
|
|
|
@ -44,8 +44,9 @@ public class GTreeEventTest extends AbstractDockingTest {
|
|||
gTree = new GTree(root);
|
||||
gTree.getModel().addTreeModelListener(new TestTreeModelListener());
|
||||
|
||||
DockingWindowManager winMgr = new DockingWindowManager(new DummyTool(), null);
|
||||
winMgr.addComponent(new TestTreeComponentProvider(gTree));
|
||||
DummyTool tool = new DummyTool();
|
||||
DockingWindowManager winMgr = new DockingWindowManager(tool, null);
|
||||
winMgr.addComponent(new TestTreeComponentProvider(tool, gTree));
|
||||
winMgr.setVisible(true);
|
||||
|
||||
waitForTree();
|
||||
|
|
|
@ -43,8 +43,9 @@ public class GTreeFilterTest extends AbstractDockingTest {
|
|||
|
||||
filterField = (FilterTextField) gTree.getFilterField();
|
||||
|
||||
winMgr = new DockingWindowManager(new DummyTool(), null);
|
||||
winMgr.addComponent(new TestTreeComponentProvider(gTree));
|
||||
DummyTool tool = new DummyTool();
|
||||
winMgr = new DockingWindowManager(tool, null);
|
||||
winMgr.addComponent(new TestTreeComponentProvider(tool, gTree));
|
||||
winMgr.setVisible(true);
|
||||
|
||||
waitForTree();
|
||||
|
|
|
@ -17,15 +17,14 @@ package docking.widgets.tree;
|
|||
|
||||
import javax.swing.JComponent;
|
||||
|
||||
import docking.ComponentProvider;
|
||||
import docking.WindowPosition;
|
||||
import docking.*;
|
||||
|
||||
class TestTreeComponentProvider extends ComponentProvider {
|
||||
|
||||
private GTree gTree;
|
||||
|
||||
public TestTreeComponentProvider(GTree gTree) {
|
||||
super(null, "Test", "Test");
|
||||
public TestTreeComponentProvider(Tool tool, GTree gTree) {
|
||||
super(tool, "Test", "Test");
|
||||
this.gTree = gTree;
|
||||
setDefaultWindowPosition(WindowPosition.STACK);
|
||||
setTabText("Test");
|
||||
|
|
|
@ -17,6 +17,9 @@ package ghidra.app.plugin.core.decompile;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -232,11 +235,17 @@ public class DecompilerNavigationTest extends AbstractDecompilerTest {
|
|||
codeBrowser.updateNow();
|
||||
waitForSwing();
|
||||
|
||||
waitForCondition(() -> {
|
||||
BooleanSupplier success = () -> {
|
||||
ProgramLocation loc = codeBrowser.getCurrentLocation();
|
||||
Address actual = loc.getAddress();
|
||||
return expected.equals(actual);
|
||||
}, "Listing is not at the expected address");
|
||||
};
|
||||
|
||||
Supplier<String> failureMessage =
|
||||
() -> "Listing is not at the expected address. Current location: " +
|
||||
codeBrowser.getCurrentLocation();
|
||||
|
||||
waitForCondition(success, failureMessage);
|
||||
}
|
||||
|
||||
private void focusDecompiler() {
|
||||
|
|
|
@ -33,7 +33,7 @@ import ghidra.util.exception.InvalidInputException;
|
|||
public class DiffApplyMergeTest extends DiffApplyTestAdapter {
|
||||
|
||||
@Override
|
||||
public void tearDown() {
|
||||
public void tearDown() throws Exception {
|
||||
|
||||
closeAllWindows();
|
||||
super.tearDown();
|
||||
|
|
|
@ -501,13 +501,15 @@ public class DiffTestAdapter extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
public void tearDown() throws Exception {
|
||||
|
||||
Window win = getWindow("Select Other Program");
|
||||
if (win != null) {
|
||||
pressButton(win, "Cancel");
|
||||
}
|
||||
|
||||
closeDiff();
|
||||
|
||||
env.dispose();
|
||||
}
|
||||
|
||||
|
@ -516,8 +518,16 @@ public class DiffTestAdapter extends AbstractGhidraHeadedIntegrationTest {
|
|||
performAction(setView, context, true);
|
||||
}
|
||||
|
||||
protected boolean isDiffActive() {
|
||||
return runSwing(() -> diffPlugin.isDiffActive());
|
||||
}
|
||||
|
||||
void closeDiff() throws Exception {
|
||||
|
||||
if (!isDiffActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
closeDiffByAction();
|
||||
DialogComponentProvider dialogProvider = waitForDialogComponent("Close Diff Session");
|
||||
assertNotNull("Did not get confirmation dialog", dialogProvider);
|
||||
|
|
|
@ -230,9 +230,6 @@ public class DualProgramTest extends DiffTestAdapter {
|
|||
ProgramDB otherProgram = otherBuilder.getProgram();
|
||||
otherBuilder.createMemory(".stuff", "0x1004000", 0x300);
|
||||
|
||||
Window win;
|
||||
Component comp;
|
||||
//InfoWindow.showSplashScreen();
|
||||
showTool(frontEndTool);
|
||||
env.showTool();
|
||||
|
||||
|
@ -241,9 +238,9 @@ public class DualProgramTest extends DiffTestAdapter {
|
|||
|
||||
launchDiffByAction();
|
||||
waitForSwing();
|
||||
win = waitForWindow("Select Other Program");
|
||||
Window win = waitForWindow("Select Other Program");
|
||||
assertNotNull(win);
|
||||
comp = getComponentOfType(win, JComboBox.class);
|
||||
Component comp = getComponentOfType(win, JComboBox.class);
|
||||
assertNotNull(comp);
|
||||
|
||||
JTree tree = findComponent(win, JTree.class);
|
||||
|
|
|
@ -24,14 +24,12 @@ import javax.swing.JLabel;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import docking.test.AbstractDockingTest;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import generic.test.AbstractGenericTest;
|
||||
|
||||
public class PlaceholderSetTest extends AbstractGenericTest {
|
||||
public class PlaceholderSetTest extends AbstractDockingTest {
|
||||
|
||||
public PlaceholderSetTest() {
|
||||
super();
|
||||
}
|
||||
private Tool tool = new FakeDockingTool();
|
||||
|
||||
@Test
|
||||
public void testDedupingRestoredPlaceholders_OnlyOneHidden() {
|
||||
|
@ -118,7 +116,7 @@ public class PlaceholderSetTest extends AbstractGenericTest {
|
|||
JLabel label = new GDLabel();
|
||||
|
||||
public TestProvider() {
|
||||
super(null, null, null);
|
||||
super(PlaceholderSetTest.this.tool, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue