Test fixes

This commit is contained in:
dragonmacher 2020-10-07 11:26:48 -04:00
parent 9dd458e9e1
commit 22fd0a24a3
4 changed files with 117 additions and 129 deletions

View file

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

View file

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