Ghidra is a software reverse engineering (SRE) framework
Tests - fixed tests failing due to graph job not correctly notifying its listener
dragonmacherdee6e0cd4d73
diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/util/job/UngroupAllVertexFunctionGraphJob.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/util/job/UngroupAllVertexFunctionGraphJob.javaindex 75f90ae589..1a72a89291 100644--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/util/job/UngroupAllVertexFunctionGraphJob.java+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/util/job/UngroupAllVertexFunctionGraphJob.java@@ -20,9 +20,8 @@ import ghidra.graph.job.GraphJob;import ghidra.graph.job.GraphJobListener;/**- * A dummy job that is designed to simply call the- * {@link FunctionGraphUtils#ungroupAllVertices(FGController)}. We use this job- * to know when the previous job is finished.+ * A dummy job that is designed to simply call the {@link FGController#ungroupAllVertices()}.+ * We use this job to know when the previous job is finished.*/public class UngroupAllVertexFunctionGraphJob implements GraphJob {diff --git a/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java b/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.javaindex 309361971d..6c237ec1fb 100644--- a/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java+++ b/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java@@ -1305,8 +1305,7 @@ public abstract class AbstractGenericTest extends AbstractGTest {* @param count the number of rows to select* @throws Exception if there's a problem simulating the click*/- public static void clickListRange(final JList list, final int row, int count)- throws Exception {+ public static void clickListRange(final JList list, final int row, int count) throws Exception {waitForSwing();for (int i = row; i < row + count; i++) {Rectangle rect = list.getCellBounds(i, i);@@ -1315,7 +1314,7 @@ public abstract class AbstractGenericTest extends AbstractGTest {}waitForSwing();}-+/*** Clicks a range of items in a table (simulates holding SHIFT and selecting* each item in the range)diff --git a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/job/FitGraphToViewJob.java b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/job/FitGraphToViewJob.javaindex acf13bac54..e890d54081 100644--- a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/job/FitGraphToViewJob.java+++ b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/job/FitGraphToViewJob.java@@ -73,6 +73,11 @@ public class FitGraphToViewJob<V extends VisualVertex, E extends VisualEdge<V>>@Overridepublic void execute(GraphJobListener listener) {+ doExecute();+ listener.jobFinished(this);+ }++ private void doExecute() {if (isFinished) {return;}@@ -90,7 +95,6 @@ public class FitGraphToViewJob<V extends VisualVertex, E extends VisualEdge<V>>}isFinished = true;- listener.jobFinished(this);}private boolean graphIsEmpty() {diff --git a/Ghidra/Framework/Graph/src/test.slow/java/ghidra/graph/viewer/GraphComponentTest.java b/Ghidra/Framework/Graph/src/test.slow/java/ghidra/graph/viewer/GraphComponentTest.javaindex b78aa729ae..a5a461a226 100644--- a/Ghidra/Framework/Graph/src/test.slow/java/ghidra/graph/viewer/GraphComponentTest.java+++ b/Ghidra/Framework/Graph/src/test.slow/java/ghidra/graph/viewer/GraphComponentTest.java@@ -262,8 +262,8 @@ public class GraphComponentTest extends AbstractVisualGraphTest {Shape edgeShape =GraphViewerUtils.getEdgeShapeInGraphSpace(graphComponent.getPrimaryViewer(), e);Rectangle bounds = edgeShape.getBounds();- assertTrue("Edge width not initialized", bounds.width > 1);- assertTrue("Edge height not initialized", bounds.height > 1);+ assertTrue("Edge width not initialized - width: " + bounds.width, bounds.width > 1);+ assertTrue("Edge height not initialized - height: " + bounds.height, bounds.height > 1);}@Testdiff --git a/Ghidra/Framework/Graph/src/test.slow/java/ghidra/graph/viewer/edge/VisualGraphPathHighlighterTest.java b/Ghidra/Framework/Graph/src/test.slow/java/ghidra/graph/viewer/edge/VisualGraphPathHighlighterTest.javaindex 43bfbfcae1..1074c0b9f5 100644--- a/Ghidra/Framework/Graph/src/test.slow/java/ghidra/graph/viewer/edge/VisualGraphPathHighlighterTest.java+++ b/Ghidra/Framework/Graph/src/test.slow/java/ghidra/graph/viewer/edge/VisualGraphPathHighlighterTest.java@@ -15,8 +15,7 @@*/package ghidra.graph.viewer.edge;-import static org.junit.Assert.assertFalse;-import static org.junit.Assert.assertTrue;+import static org.junit.Assert.*;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// applied to it that we need to verify for testing.//- LabelTestVertex v = new LabelTestVertex(Integer.toString(id));- Collection<AbstractTestVertex> vertices = graph.getVertices();- for (AbstractTestVertex vertex : vertices) {- if (v.equals(vertex)) {- return vertex;+ AbstractTestVertex v = runSwing(() -> {+ LabelTestVertex labelVertex = new LabelTestVertex(Integer.toString(id));+ Collection<AbstractTestVertex> vertices = graph.getVertices();+ for (AbstractTestVertex vertex : vertices) {+ if (labelVertex.equals(vertex)) {+ return vertex;+ }}- }+ return labelVertex;+ });graph.addVertex(v);return v;