mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 12:00:04 +02:00
Tests - fixed tests failing due to graph job not correctly notifying its
listener
This commit is contained in:
parent
dba6e117b8
commit
dee6e0cd4d
5 changed files with 21 additions and 17 deletions
|
@ -20,9 +20,8 @@ import ghidra.graph.job.GraphJob;
|
||||||
import ghidra.graph.job.GraphJobListener;
|
import ghidra.graph.job.GraphJobListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dummy job that is designed to simply call the
|
* A dummy job that is designed to simply call the {@link FGController#ungroupAllVertices()}.
|
||||||
* {@link FunctionGraphUtils#ungroupAllVertices(FGController)}. We use this job
|
* We use this job to know when the previous job is finished.
|
||||||
* to know when the previous job is finished.
|
|
||||||
*/
|
*/
|
||||||
public class UngroupAllVertexFunctionGraphJob implements GraphJob {
|
public class UngroupAllVertexFunctionGraphJob implements GraphJob {
|
||||||
|
|
||||||
|
|
|
@ -1305,8 +1305,7 @@ public abstract class AbstractGenericTest extends AbstractGTest {
|
||||||
* @param count the number of rows to select
|
* @param count the number of rows to select
|
||||||
* @throws Exception if there's a problem simulating the click
|
* @throws Exception if there's a problem simulating the click
|
||||||
*/
|
*/
|
||||||
public static void clickListRange(final JList list, final int row, int count)
|
public static void clickListRange(final JList list, final int row, int count) throws Exception {
|
||||||
throws Exception {
|
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
for (int i = row; i < row + count; i++) {
|
for (int i = row; i < row + count; i++) {
|
||||||
Rectangle rect = list.getCellBounds(i, i);
|
Rectangle rect = list.getCellBounds(i, i);
|
||||||
|
|
|
@ -73,6 +73,11 @@ public class FitGraphToViewJob<V extends VisualVertex, E extends VisualEdge<V>>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(GraphJobListener listener) {
|
public void execute(GraphJobListener listener) {
|
||||||
|
doExecute();
|
||||||
|
listener.jobFinished(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doExecute() {
|
||||||
if (isFinished) {
|
if (isFinished) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +95,6 @@ public class FitGraphToViewJob<V extends VisualVertex, E extends VisualEdge<V>>
|
||||||
}
|
}
|
||||||
|
|
||||||
isFinished = true;
|
isFinished = true;
|
||||||
listener.jobFinished(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean graphIsEmpty() {
|
private boolean graphIsEmpty() {
|
||||||
|
|
|
@ -262,8 +262,8 @@ public class GraphComponentTest extends AbstractVisualGraphTest {
|
||||||
Shape edgeShape =
|
Shape edgeShape =
|
||||||
GraphViewerUtils.getEdgeShapeInGraphSpace(graphComponent.getPrimaryViewer(), e);
|
GraphViewerUtils.getEdgeShapeInGraphSpace(graphComponent.getPrimaryViewer(), e);
|
||||||
Rectangle bounds = edgeShape.getBounds();
|
Rectangle bounds = edgeShape.getBounds();
|
||||||
assertTrue("Edge width not initialized", bounds.width > 1);
|
assertTrue("Edge width not initialized - width: " + bounds.width, bounds.width > 1);
|
||||||
assertTrue("Edge height not initialized", bounds.height > 1);
|
assertTrue("Edge height not initialized - height: " + bounds.height, bounds.height > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -15,8 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.graph.viewer.edge;
|
package ghidra.graph.viewer.edge;
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.*;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -650,13 +649,16 @@ public class VisualGraphPathHighlighterTest extends AbstractVisualGraphTest {
|
||||||
// First, find the exact instance of the vertex in the graph, as it may have state
|
// First, find the exact instance of the vertex in the graph, as it may have state
|
||||||
// applied to it that we need to verify for testing.
|
// applied to it that we need to verify for testing.
|
||||||
//
|
//
|
||||||
LabelTestVertex v = new LabelTestVertex(Integer.toString(id));
|
AbstractTestVertex v = runSwing(() -> {
|
||||||
Collection<AbstractTestVertex> vertices = graph.getVertices();
|
LabelTestVertex labelVertex = new LabelTestVertex(Integer.toString(id));
|
||||||
for (AbstractTestVertex vertex : vertices) {
|
Collection<AbstractTestVertex> vertices = graph.getVertices();
|
||||||
if (v.equals(vertex)) {
|
for (AbstractTestVertex vertex : vertices) {
|
||||||
return vertex;
|
if (labelVertex.equals(vertex)) {
|
||||||
|
return vertex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return labelVertex;
|
||||||
|
});
|
||||||
|
|
||||||
graph.addVertex(v);
|
graph.addVertex(v);
|
||||||
return v;
|
return v;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue