mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +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;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import javax.swing.JDialog;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
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
|
||||
public void testGetByteDiffsAction() throws Exception {
|
||||
getDiffDialog(diffTestP1, diffTestP2);
|
||||
|
@ -43,7 +30,7 @@ public class DiffGet2Test extends DiffTestAdapter {
|
|||
byteCB.setSelected(true);
|
||||
waitForPostedSwingRunnables();
|
||||
pressButtonByText(getDiffsDialog, "OK");
|
||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
||||
JDialog dialog = waitForJDialog("Memory Differs");
|
||||
pressButtonByText(dialog, "OK");
|
||||
waitForPostedSwingRunnables();
|
||||
waitForDiff();
|
||||
|
@ -58,7 +45,7 @@ public class DiffGet2Test extends DiffTestAdapter {
|
|||
codeUnitCB.setSelected(true);
|
||||
waitForPostedSwingRunnables();
|
||||
pressButtonByText(getDiffsDialog, "OK");
|
||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
||||
JDialog dialog = waitForJDialog("Memory Differs");
|
||||
pressButtonByText(dialog, "OK");
|
||||
waitForPostedSwingRunnables();
|
||||
waitForDiff();
|
||||
|
@ -73,7 +60,7 @@ public class DiffGet2Test extends DiffTestAdapter {
|
|||
programContextCB.setSelected(true);
|
||||
waitForPostedSwingRunnables();
|
||||
pressButtonByText(getDiffsDialog, "OK");
|
||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
||||
JDialog dialog = waitForJDialog("Memory Differs");
|
||||
pressButtonByText(dialog, "OK");
|
||||
waitForPostedSwingRunnables();
|
||||
waitForDiff();
|
||||
|
@ -87,7 +74,7 @@ public class DiffGet2Test extends DiffTestAdapter {
|
|||
bookmarkCB.setSelected(true);
|
||||
waitForPostedSwingRunnables();
|
||||
pressButtonByText(getDiffsDialog, "OK");
|
||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
||||
JDialog dialog = waitForJDialog("Memory Differs");
|
||||
pressButtonByText(dialog, "OK");
|
||||
waitForPostedSwingRunnables();
|
||||
waitForDiff();
|
||||
|
@ -101,7 +88,7 @@ public class DiffGet2Test extends DiffTestAdapter {
|
|||
commentCB.setSelected(true);
|
||||
waitForPostedSwingRunnables();
|
||||
pressButtonByText(getDiffsDialog, "OK");
|
||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
||||
JDialog dialog = waitForJDialog("Memory Differs");
|
||||
pressButtonByText(dialog, "OK");
|
||||
waitForPostedSwingRunnables();
|
||||
waitForDiff();
|
||||
|
|
|
@ -27,22 +27,18 @@ import ghidra.program.model.address.AddressSet;
|
|||
import ghidra.program.model.symbol.Equate;
|
||||
|
||||
/**
|
||||
* Tests the Ignore function of the Diff Tool, such that the current
|
||||
* difference is ignored and the next difference is selected.
|
||||
* Tests the Ignore function of the Diff Tool, such that the current difference is ignored and
|
||||
* the next difference is selected
|
||||
*/
|
||||
public class DiffIgnoreTest extends DiffApplyTestAdapter {
|
||||
public DiffIgnoreTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests to see if a difference is ignored and the next difference is selected
|
||||
* @throws Exception
|
||||
/*
|
||||
* Tests that a difference is ignored and the next difference is selected
|
||||
*/
|
||||
@Test
|
||||
public void testIgnoreDiffsNextActionFirst() throws Exception {
|
||||
openDiff(diffTestP1, diffTestP2);
|
||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
||||
JDialog dialog = waitForJDialog("Memory Differs");
|
||||
pressButtonByText(dialog, "OK");
|
||||
waitForPostedSwingRunnables();
|
||||
|
||||
|
@ -61,14 +57,13 @@ public class DiffIgnoreTest extends DiffApplyTestAdapter {
|
|||
assertEquals((byte) 0xac, bytes[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests to see if Equate Tables are properly ignored and the next difference is properly selected
|
||||
* @throws Exception
|
||||
/*
|
||||
* Test that Equate Tables are properly ignored and the next difference is properly selected
|
||||
*/
|
||||
@Test
|
||||
public void testIgnoreDiffsNextActionMiddle() throws Exception {
|
||||
openDiff(diffTestP1, diffTestP2);
|
||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
||||
JDialog dialog = waitForJDialog("Memory Differs");
|
||||
pressButtonByText(dialog, "OK");
|
||||
waitForPostedSwingRunnables();
|
||||
|
||||
|
@ -86,14 +81,13 @@ public class DiffIgnoreTest extends DiffApplyTestAdapter {
|
|||
assertEquals(0, eqs.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests to see if the ignore button is disabled after ignoring the last difference
|
||||
* @throws Exception
|
||||
/*
|
||||
* Tests that the ignore button is disabled after ignoring the last difference
|
||||
*/
|
||||
@Test
|
||||
public void testIgnoreDiffsNextActionLast() throws Exception {
|
||||
openDiff(diffTestP1, diffTestP2);
|
||||
JDialog dialog = waitForJDialog(tool.getToolFrame(), "Memory Differs", 2000);
|
||||
JDialog dialog = waitForJDialog("Memory Differs");
|
||||
pressButtonByText(dialog, "OK");
|
||||
waitForPostedSwingRunnables();
|
||||
|
||||
|
|
|
@ -1739,6 +1739,11 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||
}
|
||||
|
||||
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)) {
|
||||
return parent;
|
||||
}
|
||||
|
@ -1793,6 +1798,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||
3) A dialog provider's code
|
||||
4) A background thread
|
||||
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.
|
||||
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
|
||||
active window, we can default to the tool's frame.
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Test that the modal password dialog does not get hidden behind the
|
||||
* splash screen.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue