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
9dd458e9e1
commit
22fd0a24a3
4 changed files with 117 additions and 129 deletions
|
@ -15,27 +15,14 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.diff;
|
package ghidra.app.plugin.core.diff;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import javax.swing.JDialog;
|
import javax.swing.JDialog;
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class DiffGet2Test extends DiffTestAdapter {
|
public class DiffGet2Test extends DiffTestAdapter {
|
||||||
|
|
||||||
public DiffGet2Test() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Before
|
|
||||||
public void setUp() throws Exception {
|
|
||||||
super.setUp();
|
|
||||||
// programBuilderDiffTest1.createMemory("d4", "0x400", 0x100);
|
|
||||||
// programBuilderDiffTest2.createMemory("d2", "0x200", 0x100);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetByteDiffsAction() throws Exception {
|
public void testGetByteDiffsAction() throws Exception {
|
||||||
getDiffDialog(diffTestP1, diffTestP2);
|
getDiffDialog(diffTestP1, diffTestP2);
|
||||||
|
@ -43,7 +30,7 @@ public class DiffGet2Test extends DiffTestAdapter {
|
||||||
byteCB.setSelected(true);
|
byteCB.setSelected(true);
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
pressButtonByText(getDiffsDialog, "OK");
|
pressButtonByText(getDiffsDialog, "OK");
|
||||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
JDialog dialog = waitForJDialog("Memory Differs");
|
||||||
pressButtonByText(dialog, "OK");
|
pressButtonByText(dialog, "OK");
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
waitForDiff();
|
waitForDiff();
|
||||||
|
@ -58,7 +45,7 @@ public class DiffGet2Test extends DiffTestAdapter {
|
||||||
codeUnitCB.setSelected(true);
|
codeUnitCB.setSelected(true);
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
pressButtonByText(getDiffsDialog, "OK");
|
pressButtonByText(getDiffsDialog, "OK");
|
||||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
JDialog dialog = waitForJDialog("Memory Differs");
|
||||||
pressButtonByText(dialog, "OK");
|
pressButtonByText(dialog, "OK");
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
waitForDiff();
|
waitForDiff();
|
||||||
|
@ -73,7 +60,7 @@ public class DiffGet2Test extends DiffTestAdapter {
|
||||||
programContextCB.setSelected(true);
|
programContextCB.setSelected(true);
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
pressButtonByText(getDiffsDialog, "OK");
|
pressButtonByText(getDiffsDialog, "OK");
|
||||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
JDialog dialog = waitForJDialog("Memory Differs");
|
||||||
pressButtonByText(dialog, "OK");
|
pressButtonByText(dialog, "OK");
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
waitForDiff();
|
waitForDiff();
|
||||||
|
@ -87,7 +74,7 @@ public class DiffGet2Test extends DiffTestAdapter {
|
||||||
bookmarkCB.setSelected(true);
|
bookmarkCB.setSelected(true);
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
pressButtonByText(getDiffsDialog, "OK");
|
pressButtonByText(getDiffsDialog, "OK");
|
||||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
JDialog dialog = waitForJDialog("Memory Differs");
|
||||||
pressButtonByText(dialog, "OK");
|
pressButtonByText(dialog, "OK");
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
waitForDiff();
|
waitForDiff();
|
||||||
|
@ -101,7 +88,7 @@ public class DiffGet2Test extends DiffTestAdapter {
|
||||||
commentCB.setSelected(true);
|
commentCB.setSelected(true);
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
pressButtonByText(getDiffsDialog, "OK");
|
pressButtonByText(getDiffsDialog, "OK");
|
||||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
JDialog dialog = waitForJDialog("Memory Differs");
|
||||||
pressButtonByText(dialog, "OK");
|
pressButtonByText(dialog, "OK");
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
waitForDiff();
|
waitForDiff();
|
||||||
|
|
|
@ -27,22 +27,18 @@ import ghidra.program.model.address.AddressSet;
|
||||||
import ghidra.program.model.symbol.Equate;
|
import ghidra.program.model.symbol.Equate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the Ignore function of the Diff Tool, such that the current
|
* Tests the Ignore function of the Diff Tool, such that the current difference is ignored and
|
||||||
* difference is ignored and the next difference is selected.
|
* the next difference is selected
|
||||||
*/
|
*/
|
||||||
public class DiffIgnoreTest extends DiffApplyTestAdapter {
|
public class DiffIgnoreTest extends DiffApplyTestAdapter {
|
||||||
public DiffIgnoreTest() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests to see if a difference is ignored and the next difference is selected
|
* Tests that a difference is ignored and the next difference is selected
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testIgnoreDiffsNextActionFirst() throws Exception {
|
public void testIgnoreDiffsNextActionFirst() throws Exception {
|
||||||
openDiff(diffTestP1, diffTestP2);
|
openDiff(diffTestP1, diffTestP2);
|
||||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
JDialog dialog = waitForJDialog("Memory Differs");
|
||||||
pressButtonByText(dialog, "OK");
|
pressButtonByText(dialog, "OK");
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
|
|
||||||
|
@ -61,14 +57,13 @@ public class DiffIgnoreTest extends DiffApplyTestAdapter {
|
||||||
assertEquals((byte) 0xac, bytes[0]);
|
assertEquals((byte) 0xac, bytes[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests to see if Equate Tables are properly ignored and the next difference is properly selected
|
* Test that Equate Tables are properly ignored and the next difference is properly selected
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testIgnoreDiffsNextActionMiddle() throws Exception {
|
public void testIgnoreDiffsNextActionMiddle() throws Exception {
|
||||||
openDiff(diffTestP1, diffTestP2);
|
openDiff(diffTestP1, diffTestP2);
|
||||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
JDialog dialog = waitForJDialog("Memory Differs");
|
||||||
pressButtonByText(dialog, "OK");
|
pressButtonByText(dialog, "OK");
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
|
|
||||||
|
@ -86,14 +81,13 @@ public class DiffIgnoreTest extends DiffApplyTestAdapter {
|
||||||
assertEquals(0, eqs.size());
|
assertEquals(0, eqs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Tests to see if the ignore button is disabled after ignoring the last difference
|
* Tests that the ignore button is disabled after ignoring the last difference
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testIgnoreDiffsNextActionLast() throws Exception {
|
public void testIgnoreDiffsNextActionLast() throws Exception {
|
||||||
openDiff(diffTestP1, diffTestP2);
|
openDiff(diffTestP1, diffTestP2);
|
||||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
JDialog dialog = waitForJDialog("Memory Differs");
|
||||||
pressButtonByText(dialog, "OK");
|
pressButtonByText(dialog, "OK");
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
|
|
||||||
|
|
|
@ -1739,6 +1739,11 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Window ensureParentHierarchy(Window parent, Component component) {
|
private static Window ensureParentHierarchy(Window parent, Component component) {
|
||||||
|
if (CollectionUtils.isAllNull(parent, component)) {
|
||||||
|
KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
|
||||||
|
return kfm.getActiveWindow();
|
||||||
|
}
|
||||||
|
|
||||||
if (SwingUtilities.isDescendingFrom(parent, component)) {
|
if (SwingUtilities.isDescendingFrom(parent, component)) {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
@ -1793,6 +1798,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
||||||
3) A dialog provider's code
|
3) A dialog provider's code
|
||||||
4) A background thread
|
4) A background thread
|
||||||
5) The help window
|
5) The help window
|
||||||
|
6) A modal password dialog appears over the splash screen
|
||||||
|
|
||||||
It seems like the parent should be the active window for 1-2.
|
It seems like the parent should be the active window for 1-2.
|
||||||
Case 3 should probably use the window of the dialog provider.
|
Case 3 should probably use the window of the dialog provider.
|
||||||
|
@ -1800,6 +1806,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
||||||
moving between windows while the thread is working. So, rather than using the
|
moving between windows while the thread is working. So, rather than using the
|
||||||
active window, we can default to the tool's frame.
|
active window, we can default to the tool's frame.
|
||||||
Case 5 should use the help window.
|
Case 5 should use the help window.
|
||||||
|
Case 6 should use the splash screen as the parent.
|
||||||
|
|
||||||
We have not yet solidified how we should parent. This documentation is meant to
|
We have not yet solidified how we should parent. This documentation is meant to
|
||||||
move us towards clarity as we find Use Cases that don't make sense. (Once we
|
move us towards clarity as we find Use Cases that don't make sense. (Once we
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class SplashScreenTest extends AbstractDockingTest {
|
||||||
showSplashScreen(false);
|
showSplashScreen(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test that the modal password dialog does not get hidden behind the
|
* Test that the modal password dialog does not get hidden behind the
|
||||||
* splash screen.
|
* splash screen.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue