Skip to content

Ghidra is a software reverse engineering (SRE) framework

Tests - fix for test focus issue

dragonmacher26b2dfef94f3
diff --git a/Ghidra/Features/FunctionGraph/src/test/java/ghidra/app/plugin/core/functiongraph/FunctionGraphPlugin1Test.java b/Ghidra/Features/FunctionGraph/src/test/java/ghidra/app/plugin/core/functiongraph/FunctionGraphPlugin1Test.java
index 2c4c155e6b..4983409609 100644
--- a/Ghidra/Features/FunctionGraph/src/test/java/ghidra/app/plugin/core/functiongraph/FunctionGraphPlugin1Test.java
+++ b/Ghidra/Features/FunctionGraph/src/test/java/ghidra/app/plugin/core/functiongraph/FunctionGraphPlugin1Test.java
@@ -799,11 +799,23 @@ public class FunctionGraphPlugin1Test extends AbstractFunctionGraphTest {
"original point: " + originalPoint + " - reloaded point: " + reloadedPoint,
pointsAreSimilar(originalPoint, reloadedPoint));
- // make sure the CodeBrowser's location matches ours
+ //
+ // Make sure the CodeBrowser's location matches ours after the relayout (the location should
+ // get broadcast to the CodeBrowser)
+ //
+
+ // Note: there is a timing failure that happens for this check; the event broadcast
+ // only happens if the FG provider has focus; in parallel batch mode focus is
+ // unreliable
+ if (!BATCH_MODE) {
+ assertTrue(graphAddressMatchesCodeBrowser(newGraph));
+ }
+ }
- FGVertex focusedVertex = runSwing(() -> newGraph.getFocusedVertex());
+ private boolean graphAddressMatchesCodeBrowser(FunctionGraph graph) {
+ FGVertex focusedVertex = runSwing(() -> graph.getFocusedVertex());
ProgramLocation graphLocation = focusedVertex.getProgramLocation();
ProgramLocation codeBrowserLocation = runSwing(() -> codeBrowser.getCurrentLocation());
- assertEquals(graphLocation.getAddress(), codeBrowserLocation.getAddress());
+ return graphLocation.getAddress().equals(codeBrowserLocation.getAddress());
}
}