Package ghidra.graph.viewer
Class AbstractVisualGraphTest
- java.lang.Object
-
- generic.test.AbstractGTest
-
- generic.test.AbstractGenericTest
-
- docking.test.AbstractDockingTest
-
- ghidra.graph.viewer.AbstractVisualGraphTest
-
- Direct Known Subclasses:
AbstractSimpleVisualGraphTest
,GraphComponentTest
,GraphViewerTest
,VisualGraphComponentProviderTest
,VisualGraphPathHighlighterTest
,VisualGraphViewUpdaterTest
public abstract class AbstractVisualGraphTest extends AbstractDockingTest
Creates a basic test environment that uses a JFrame to house aGraphComponent
, which itself has a primary and satellite viewer, all initialized with a graph of your setup, with reasonable default settings.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class generic.test.AbstractGenericTest
AbstractGenericTest.ExceptionHandlingRunner
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.JFrame
frame
protected TestVisualGraph
graph
protected GraphComponent<AbstractTestVertex,TestEdge,TestVisualGraph>
graphComponent
-
Fields inherited from class generic.test.AbstractGenericTest
concurrentTestExceptionRule, DEFAULT_TEST_TOOL_NAME, ruleChain, TESTDATA_DIRECTORY_NAME, watchman
-
Fields inherited from class generic.test.AbstractGTest
BATCH_MODE, DEFAULT_WAIT_DELAY, DEFAULT_WAIT_TIMEOUT, DEFAULT_WINDOW_TIMEOUT, PARALLEL_MODE, PRIVATE_LONG_WAIT_TIMEOUT, testName
-
-
Constructor Summary
Constructors Constructor Description AbstractVisualGraphTest()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
assertPointsAreAboutEqual(java.lang.String message, java.awt.geom.Point2D primaryPoint, java.awt.geom.Point2D clonePoint)
protected void
buildAndLayoutGraph()
protected abstract TestVisualGraph
buildGraph()
protected void
clickVertex(AbstractTestVertex v, int xOffset, int yOffset)
protected void
clickVertex(AbstractTestVertex v, int xOffset, int yOffset, int clickCount)
protected void
clickViewer(int x, int y)
protected GraphComponent<AbstractTestVertex,TestEdge,TestVisualGraph>
createGraphComponent(TestLayoutProvider layoutProvider)
protected TestLayoutProvider
createLayoutProvider()
protected void
drag(int x1, int y1, int x2, int y2)
protected void
dragMouse(AbstractTestVertex v, int yOffset, int distance)
protected void
ensureVertexVisible(AbstractTestVertex v)
Makes the given vertex visible by, as needed, moving it away (out from under) other vertices and moving the viewers visible area so that it is on screen.protected void
focusVertex(AbstractTestVertex v)
Focuses the given vertex, which means to trigger it to be picked/selected in the UI, causing it to be the focused vertex of the graph.protected AbstractTestVertex
getAnyVertex()
protected TestEdge
getEdge(AbstractTestVertex v1, AbstractTestVertex v2)
protected AbstractTestVertex
getVertex(java.lang.String name)
protected java.awt.Point
getViewLocation(AbstractTestVertex v)
protected double
getZoom()
protected void
hideSatellite()
protected void
hoverVertex(AbstractTestVertex v)
protected void
initialize()
protected void
installMouseDebugger()
protected void
isolateVertex(AbstractTestVertex v)
Moves the given vertex as necessary so that it is not touching any other vertexprotected boolean
isSatelliteUndocked()
protected boolean
isSatelliteVisible()
protected void
moveMouse(AbstractTestVertex v)
protected void
moveVertex(AbstractTestVertex v, int xOffset, int yOffset)
protected void
scaleGraphPastInteractionThreshold()
void
setUp()
protected void
setZoom(double newZoom)
protected void
swing(java.lang.Runnable r)
protected <T> T
swing(java.util.function.Supplier<T> s)
void
tearDown()
protected void
waitForAnimation()
-
Methods inherited from class docking.test.AbstractDockingTest
assertEnabled, assertToggleButtonSelected, capture, checkMessageDisplay, clickComponentProvider, clickComponentProvider, close, close, closeAllWindows, closeAllWindows, closeAllWindowsAndFrames, closeProvider, closeSaveChangesDialog, createApplicationConfiguration, createApplicationLayout, createRenderedImage, createScreenImage, disposeErrorGUI, dockingSetUp, dockingTearDown, expandPath, expandTree, findButtonByActionName, findButtonByIcon, findButtonByText, findComponent, findComponentByName, getAction, getAction, getActions, getClipboardText, getComponentProvider, getDialogComponent, getDialogComponentProvider, getDockableComponent, getNode, getOpenWindowsAsString, getStatusText, getTitleForWindow, getWindow, getWindowByTitle, getWindowByTitleContaining, getWindows, isEnabled, isEnabled, isSelected, isUseErrorGUI, performAction, performAction, performAction, performAction, performDialogAction, pressButtonByText, pressButtonByText, printOpenWindows, selectPath, selectTabIfAvailable, setErrorGUIEnabled, setErrorsExpected, setToggleActionSelected, setToggleActionSelected, setToggleButtonSelected, setToggleButtonSelected, showProvider, triggerActionKey, triggerActionKey, triggerBackspaceKey, triggerEnter, triggerEscapeKey, triggerKey, triggerKey, triggerText, triggerText, waitForComponentProvider, waitForComponentProvider, waitForDialogComponent, waitForDialogComponent, waitForDialogComponent, waitForJDialog, waitForJDialog, waitForTableModel, waitForTree, waitForUpdateOnChooser, waitForWindow, waitForWindow, waitForWindow, waitForWindow, waitForWindowByName, waitForWindowByTitleContaining, waitForWindowByTitleContaining, writeImage, writeImage
-
Methods inherited from class generic.test.AbstractGenericTest
clickMouse, clickMouse, clickTableCell, createStackTraceForAllThreads, createTempDirectory, createTempFile, createTempFile, createTempFileForTest, createTempFileForTest, createTempFilePath, createTempFilePath, deleteMatchingTempFiles, deleteSimilarTempFiles, doubleClick, dragMouse, editCell, executeOnSwingWithoutBlocking, findAbstractButtonByName, findAbstractButtonByText, findButtonByIcon, findButtonByText, findComponent, findComponent, findComponentByName, findComponentByName, findComponentsByName, findOwnedWindows, findPathToText, findTestDataFile, findTreePathToText, fixupGUI, getAllWindows, getDebugFileDirectory, getInstanceField, getInstanceFieldByClassType, getLocalResourceFile, getTestDataDir, getTestDataDirectory, getTestDataFile, getText, hasTestFailed, initializeLayout, initializeSystemProperties, invokeConstructor, invokeInstanceMethod, invokeInstanceMethod, leftClick, loadTextResource, loadTextResource, middleClick, moveMouse, postEvent, pressButton, pressButton, pressButtonByName, pressButtonByName, pressButtonByText, pressButtonByText, printMemory, privateWaitForPostedSwingRunnables_SwingSafe, rightClick, runSwing, runSwing, runSwing, setComboBoxSelection, setInstanceField, setText, testFailed, toString, waitForPostedSwingRunnables, waitForSwing, waitForTasks, windowForComponent, yieldToSwing
-
Methods inherited from class generic.test.AbstractGTest
assertArraysEqualOrdered, assertArraysEqualUnordered, assertArraysEqualUnordered, assertContainsExactly, assertContainsExactly, assertListEqualOrdered, assertListEqualOrdered, assertListEqualsArrayOrdered, assertListEqualsArrayUnordered, assertListEqualUnordered, failWithException, getName, getRandomInt, getRandomInt, getRandomString, getRandomString, getTestDirectoryPath, sleep, waitFor, waitFor, waitFor, waitForCondition, waitForCondition, waitForConditionWithoutFailing, waitForValue, waitForValueWithoutFailing
-
-
-
-
Field Detail
-
frame
protected javax.swing.JFrame frame
-
graph
protected TestVisualGraph graph
-
graphComponent
protected GraphComponent<AbstractTestVertex,TestEdge,TestVisualGraph> graphComponent
-
-
Method Detail
-
setUp
public void setUp() throws java.lang.Exception
- Throws:
java.lang.Exception
-
buildAndLayoutGraph
protected void buildAndLayoutGraph() throws CancelledException
- Throws:
CancelledException
-
createLayoutProvider
protected TestLayoutProvider createLayoutProvider()
-
createGraphComponent
protected GraphComponent<AbstractTestVertex,TestEdge,TestVisualGraph> createGraphComponent(TestLayoutProvider layoutProvider)
-
initialize
protected void initialize()
-
buildGraph
protected abstract TestVisualGraph buildGraph()
-
tearDown
public void tearDown()
-
getVertex
protected AbstractTestVertex getVertex(java.lang.String name)
-
getAnyVertex
protected AbstractTestVertex getAnyVertex()
-
getEdge
protected TestEdge getEdge(AbstractTestVertex v1, AbstractTestVertex v2)
-
swing
protected void swing(java.lang.Runnable r)
-
swing
protected <T> T swing(java.util.function.Supplier<T> s)
-
waitForAnimation
protected void waitForAnimation()
-
assertPointsAreAboutEqual
protected void assertPointsAreAboutEqual(java.lang.String message, java.awt.geom.Point2D primaryPoint, java.awt.geom.Point2D clonePoint)
-
setZoom
protected void setZoom(double newZoom)
-
getZoom
protected double getZoom()
-
moveVertex
protected void moveVertex(AbstractTestVertex v, int xOffset, int yOffset)
-
getViewLocation
protected java.awt.Point getViewLocation(AbstractTestVertex v)
-
ensureVertexVisible
protected void ensureVertexVisible(AbstractTestVertex v)
Makes the given vertex visible by, as needed, moving it away (out from under) other vertices and moving the viewers visible area so that it is on screen.- Parameters:
v
- the vertex
-
isolateVertex
protected void isolateVertex(AbstractTestVertex v)
Moves the given vertex as necessary so that it is not touching any other vertex- Parameters:
v
- the vertex
-
clickViewer
protected void clickViewer(int x, int y)
-
clickVertex
protected void clickVertex(AbstractTestVertex v, int xOffset, int yOffset) throws java.lang.Exception
- Throws:
java.lang.Exception
-
clickVertex
protected void clickVertex(AbstractTestVertex v, int xOffset, int yOffset, int clickCount)
-
dragMouse
protected void dragMouse(AbstractTestVertex v, int yOffset, int distance) throws java.lang.Exception
- Throws:
java.lang.Exception
-
moveMouse
protected void moveMouse(AbstractTestVertex v)
-
drag
protected void drag(int x1, int y1, int x2, int y2)
-
scaleGraphPastInteractionThreshold
protected void scaleGraphPastInteractionThreshold()
-
installMouseDebugger
protected void installMouseDebugger()
-
focusVertex
protected void focusVertex(AbstractTestVertex v)
Focuses the given vertex, which means to trigger it to be picked/selected in the UI, causing it to be the focused vertex of the graph.- Parameters:
v
- the vertex
-
hoverVertex
protected void hoverVertex(AbstractTestVertex v)
-
isSatelliteVisible
protected boolean isSatelliteVisible()
-
isSatelliteUndocked
protected boolean isSatelliteUndocked()
-
hideSatellite
protected void hideSatellite()
-
-