Class AbstractScreenShotGenerator
- Direct Known Subclasses:
GhidraScreenShotGenerator
,TutorialScreenShotGenerator
-
Nested Class Summary
Nested classes/interfaces inherited from class generic.test.AbstractGuiTest
AbstractGuiTest.ExceptionHandlingRunner
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
protected static final int
protected static final String
protected static final String
protected static final boolean
protected static final String
Fields inherited from class ghidra.test.AbstractGhidraHeadlessIntegrationTest
PROJECT_NAME
Fields inherited from class generic.test.AbstractGenericTest
concurrentTestExceptionRule, DEFAULT_TEST_TOOL_NAME, DEFAULT_TOOL_NAME, repeatedRule, 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
-
Method Summary
Modifier and TypeMethodDescriptionaddr
(long value) address
(long value) Deprecated.void
addSelection
(long start, long end) void
captureActionIcon
(String actionName) captureComponent
(Component component) void
captureComponents
(List<Component> comps) void
void
captureDialog
(int width, int height) void
captureDialog
(DialogComponentProvider provider) void
captureDialog
(Dialog dialog) void
captureDialog
(Dialog dialog, int width, int height) void
captureDialog
(Class<? extends DialogComponentProvider> clazz) void
captureDialog
(Class<? extends DialogComponentProvider> clazz, int width, int height) void
captureDialog
(String title) void
captureIcon
(Icon icon) void
captureIsolatedComponent
(JComponent component, int width, int height) void
captureIsolatedProvider
(ComponentProvider provider, int width, int height) void
captureIsolatedProvider
(Class<? extends ComponentProvider> clazz, int width, int height) void
captureIsolatedProviderWindow
(Class<? extends ComponentProvider> clazz, int width, int height) The same ascaptureIsolatedProvider(Class, int, int)
except this method will also capture the containing window.void
captureListingField
(long address, String fieldName, int padding) void
captureListingRange
(long start, long end, int width) void
void
captureMenuBarMenu
(String menuName, String... subMenuNames) void
captureMenuBarMenuHierachy
(String menuName, String... subMenuNames) void
captureProvider
(ComponentProvider provider) void
captureProvider
(Class<? extends ComponentProvider> clazz) void
captureProvider
(String name) void
captureProviderWindow
(ComponentProvider provider) Captures the window, including decorations.void
captureProviderWindow
(ComponentProvider provider, int width, int height) Captures the window, including decorations.void
captureProviderWindow
(Class<? extends ComponentProvider> clazz) Captures the window, including decorations.void
captureProviderWindow
(String name) Captures the window, including decorations.void
captureProviderWindow
(String name, int width, int height) Captures the window, including decorations.void
Captures the provider by using a screen shot and not by painting the provider directly (as doescaptureProvider(ComponentProvider)
).void
captureToolWindow
(int width, int height) void
void
captureWindow
(Window window) void
captureWindow
(Window window, int width, int height) void
void
closeProvider
(Class<? extends ComponentProvider> clazz) void
createBookmark
(long address) createEmptyImage
(int width, int height) void
void
void
void
drawBorder
(Color c) void
void
void
drawRectangle
(Color c, Rectangle rect, int thickness) drawRectangle
(Color c, Rectangle r, int padding, int thickness) drawRectangleAround
(JComponent component, Color color, int padding) drawRectangleAround
(JComponent component, JComponent root, Color color, int padding) Draws a rectangle around the given component.void
drawRectangleWithDropShadowAround
(JComponent component, Color color, int padding) void
void
void
void
exit()
void
fillRectangle
(Color c, Rectangle rect) findProviderToolBarButton
(ComponentProvider provider, String actionName) int
findRowByPartialText
(JTable table, String searchString) void
getBounds
(JComponent component) getDialog
(Class<? extends DialogComponentProvider> clazz) getDockableComponent
(ComponentProvider provider) getDockableComponent
(Class<? extends ComponentProvider> clazz) <T extends ComponentProvider>
TgetProvider
(Class<T> clazz) getProvider
(String name) void
go
(long address) void
goToListing
(long address) void
goToListing
(long address, boolean scrollToMiddle) void
goToListing
(long address, String fieldName, boolean scrollToMiddle) void
hideTableColumn
(GTable table, String columnName) void
loadPlugin
(Class<? extends Plugin> clazz) loadPlugin
(String className) void
loadProgram
(String programName) void
makeSelection
(long start, long end) void
makeSelection
(AddressSet addrSet) void
void
moveProvider
(ComponentProvider movee, ComponentProvider relativeTo, WindowPosition position) void
moveProviderToFront
(ComponentProvider provider) void
moveProviderToFront
(ComponentProvider provider, int width, int height) moveProviderToItsOwnWindow
(ComponentProvider provider) moveProviderToItsOwnWindow
(ComponentProvider provider, int width, int height) void
moveWindowUp
(Window window, int yOffset) protected TestEnv
protected void
void
performAction
(String actionName, String owner, boolean wait) void
performAction
(String actionName, String owner, ComponentProvider contextProvider, boolean wait) void
performDialogAction
(String actionName, boolean wait) void
performMemorySearch
(String searchString) placeImagesSideBySide
(Image left, Image right) void
positionCursor
(long address) void
positionCursor
(long address, String fieldName) void
positionListingCenter
(long address) void
positionListingTop
(long address) void
prepareCommentsDialog
(ghidra.app.plugin.core.comments.CommentsDialog dialog, String annotationText) void
void
pressButtonOnDialog
(String buttonText) void
protected BufferedImage
void
removeField
(String fieldName) void
void
void
scrollToRow
(JTable table, int row) void
void
void
setDividerPercentage
(Class<? extends ComponentProvider> provider1, Class<? extends ComponentProvider> provider2, float percentage) protected void
void
setListingFieldWidth
(String fieldName, int width) void
setSelected
(JToggleButton button, boolean select) void
setSelectedAnayzer
(Object analysisPanel, String analyzerName) void
setToolSize
(int width, int height) void
setUp()
void
void
setWindowSize
(Window window, int width, int height) void
showAnalysisOptions
(String selectedAnalyzerName) void
showColumnSettings
(GTable table, String colName) void
showCommentDialog
(String text) showMenuBarMenu
(String menuName, String... submenuNames) void
showOptions
(String optionsCategoryName) void
showProgramOptions
(String optionsCategoryName) <T extends ComponentProvider>
TshowProvider
(Class<T> clazz) void
showTableColumn
(GTable table, String columnName) takeSnippet
(Rectangle bounds) Crops a part of the current image, keeping what is inside the given bounds.void
tearDown()
void
topOfListing
(long address) Deprecated.protected void
Methods inherited from class ghidra.test.AbstractGhidraHeadedIntegrationTest
addPlugin, click, click, click, click, createApplicationConfiguration, createApplicationLayout, getAction, getPluginByName, saveTool, showDialogWithoutBlocking, showTool, waitForBusyTool, waitForProgram
Methods inherited from class ghidra.test.AbstractGhidraHeadlessIntegrationTest
applyCmd, cleanDbTestDir, clearSelection, createDefaultProgram, createDefaultProgram, debugProgramInTool, deleteProject, getLanguageCompilerSpecPair, getLanguageService, getPlugin, getSLEIGH_8051_LANGUAGE, getSLEIGH_X86_64_LANGUAGE, getSLEIGH_X86_LANGUAGE, getUniqueSymbol, getUniqueSymbol, getZ80_LANGUAGE, goTo, goTo, initializeSystemProperties, makeSelection, makeSelection, makeSelection, makeSelection, modifyProgram, modifyProgram, redo, redo, redo, replaceService, toAddressSet, toAddressSet, toAddressSet, toAddressSet, tx, tx, undo, undo, undo, undo, waitForScriptCompletion
Methods inherited from class docking.test.AbstractDockingTest
assertEnabled, assertIconsEqual, assertToggleButtonSelected, capture, clickComponentProvider, clickComponentProvider, close, close, closeAllWindows, closeAllWindows, closeAllWindowsAndFrames, closeProvider, closeSaveChangesDialog, createContext, createContext, createRenderedImage, createScreenImage, disposeErrorGUI, dockingSetUp, dockingTearDown, expandPath, expandTree, findButtonByActionName, findButtonByIcon, findButtonByName, findButtonByText, findComponent, findComponentByName, getAction, getAction, getAction, getActionsByName, getActionsByOwner, getActionsByOwnerAndName, getClipboardText, getComponentProvider, getDialogComponent, getDialogComponentProvider, getDockableComponent, getLocalAction, getMessageText, getNode, getOpenWindowsAsString, getStatusText, getTitleForWindow, getURL, getWindow, getWindowByTitle, getWindowByTitleContaining, getWindows, isEnabled, isEnabled, isEnabled, isSelected, isUseErrorGUI, performAction, performAction, performAction, performAction, performDialogAction, pressButtonByText, pressButtonByText, printOpenWindows, selectPath, selectTabIfAvailable, setErrorGUIEnabled, setToggleActionSelected, setToggleActionSelected, setToggleButtonSelected, setToggleButtonSelected, showProvider, triggerActionKey, triggerActionKey, triggerBackspaceKey, triggerEnter, triggerEscapeKey, triggerKey, triggerKey, triggerKey, triggerText, triggerText, waitForComponentProvider, waitForComponentProvider, waitForComponentProvider, waitForDialogComponent, waitForDialogComponent, waitForDialogComponent, waitForErrorDialog, waitForInfoDialog, waitForJDialog, waitForJDialog, waitForTableModel, waitForTree, waitForUpdateOnChooser, waitForWindow, waitForWindow, waitForWindow, waitForWindowByName, waitForWindowByTitleContaining, writeImage, writeImage
Methods inherited from class generic.test.AbstractGuiTest
assertColorsEqual, clickListRange, clickMouse, clickMouse, clickTableCell, clickTableRange, doubleClick, dragMouse, editCell, executeOnSwingWithoutBlocking, findAbstractButtonByName, findAbstractButtonByText, findButtonByIcon, findButtonByName, findButtonByText, findComponent, findComponent, findComponentByName, findComponentByName, findComponents, findComponents, findOwnedWindows, findPathToText, findTreePathToText, fixupGUI, getAllWindows, getRenderedTableCellValue, getSwing, getText, leftClick, middleClick, moveMouse, postEvent, pressButton, pressButton, pressButtonByName, pressButtonByName, pressButtonByText, pressButtonByText, printMemory, privatewaitForSwing_SwingSafe, rightClick, runSwing, runSwing, runSwing, runSwingLater, runSwingWithException, setComboBoxSelection, setText, waitForPostedSwingRunnables, waitForSwing, waitForTasks, waitForTasks, yieldToSwing
Methods inherited from class generic.test.AbstractGenericTest
createStackTraceForAllThreads, createTempDirectory, createTempFile, createTempFile, createTempFileForTest, createTempFileForTest, createTempFilePath, createTempFilePath, deleteMatchingTempFiles, deleteSimilarTempFiles, findTestDataFile, getDebugFileDirectory, getFontMetrics, getInstanceField, getInstanceFieldByClassType, getTestDataDir, getTestDataDirectory, getTestDataFile, hasTestFailed, initializeLayout, invokeConstructor, invokeInstanceMethod, invokeInstanceMethod, loadTextResource, loadTextResource, resetLogging, setErrorsExpected, setInstanceField, setLogLevel, setLogLevel, testFailed, toString, windowForComponent
Methods inherited from class generic.test.AbstractGTest
assertArraysEqualOrdered, assertArraysEqualUnordered, assertArraysEqualUnordered, assertContainsExactly, assertContainsExactly, assertContainsString, assertContainsStringIgnoringCase, assertListEqualOrdered, assertListEqualOrdered, assertListEqualsArrayOrdered, assertListEqualsArrayUnordered, assertListEqualUnordered, bytes, failWithException, getName, getRandomInt, getRandomInt, getRandomString, getRandomString, getTestDirectoryPath, sleep, waitFor, waitFor, waitFor, waitFor, waitFor, waitForCondition, waitForCondition, waitForCondition, waitForConditionWithoutFailing, waitForValue, waitForValueWithoutFailing
-
Field Details
-
SAVE_CREATED_IMAGE_FILE_KEY
- See Also:
-
SAVE_CREATED_IMAGE_FILE
protected static final boolean SAVE_CREATED_IMAGE_FILE -
NEW_FILENAME_SUFFIX_KEY
- See Also:
-
DEFAULT_FILENAME_SUFFIX
- See Also:
-
NEW_FILENAME_SUFFIX
-
DIALOG_HEADER_HEIGHT
protected static final int DIALOG_HEADER_HEIGHT- See Also:
-
tool
-
env
-
program
-
image
-
-
Constructor Details
-
AbstractScreenShotGenerator
public AbstractScreenShotGenerator()
-
-
Method Details
-
newTestEnv
- Throws:
Exception
-
setUp
- Throws:
Exception
-
tearDown
- Throws:
Exception
-
prepareTool
public void prepareTool() -
loadProgram
- Throws:
Exception
-
closeNonProgramArchives
public void closeNonProgramArchives() -
loadProgram
-
exit
public void exit() -
setUser
-
setDockIcon
protected void setDockIcon() -
addr
-
setToolSize
public void setToolSize(int width, int height) -
setWindowSize
-
performAction
-
performDialogAction
-
performAction
public void performAction(String actionName, String owner, ComponentProvider contextProvider, boolean wait) -
showOptions
-
showProgramOptions
-
getCursorBounds
-
pressOkOnDialog
public void pressOkOnDialog() -
pressButtonOnDialog
-
captureIsolatedComponent
-
captureComponent
-
captureIsolatedProviderWindow
public void captureIsolatedProviderWindow(Class<? extends ComponentProvider> clazz, int width, int height) The same ascaptureIsolatedProvider(Class, int, int)
except this method will also capture the containing window.- Parameters:
clazz
- the provider classwidth
- the width of the captureheight
- the height of the capture
-
captureIsolatedProvider
public void captureIsolatedProvider(Class<? extends ComponentProvider> clazz, int width, int height) -
captureIsolatedProvider
-
moveProviderToFront
-
moveProviderToFront
-
moveWindowUp
-
moveProviderToItsOwnWindow
-
moveProviderToItsOwnWindow
-
getDockableComponent
-
moveProvider
public void moveProvider(ComponentProvider movee, ComponentProvider relativeTo, WindowPosition position) -
captureMenu
public void captureMenu() -
getPopupMenu
-
captureProvider
-
captureProvider
-
captureProvider
-
captureProviderWithScreenShot
Captures the provider by using a screen shot and not by painting the provider directly (as doescaptureProvider(ComponentProvider)
). Use this method if you need to capture the provider along with any popup windows.- Parameters:
provider
- the provider
-
captureProviderWindow
Captures the window, including decorations. This will use aRobot
to create a screen capture, which has the effect of getting all items within the window bounds. This method is needed if you wish to capture child windows, like popups/hovers.Other capture methods will not use the screen capture mechanism, but rather will directly render the given component. In this case, subordinate windows will not be captured. For example, see
captureProvider(Class)
.- Parameters:
name
- the provider's name
-
captureProviderWindow
Captures the window, including decorations. This will use aRobot
to create a screen capture, which has the effect of getting all items within the window bounds. This method is needed if you wish to capture child windows, like popups/hovers.Other capture methods will not use the screen capture mechanism, but rather will directly render the given component. In this case, subordinate windows will not be captured. For example, see
captureProvider(Class)
.- Parameters:
clazz
- the provider's class
-
captureProviderWindow
Captures the window, including decorations. This will use aRobot
to create a screen capture, which has the effect of getting all items within the window bounds. This method is needed if you wish to capture child windows, like popups/hovers.Other capture methods will not use the screen capture mechanism, but rather will directly render the given component. In this case, subordinate windows will not be captured. For example, see
captureProvider(Class)
.- Parameters:
provider
- the provider
-
captureProviderWindow
Captures the window, including decorations. This will use aRobot
to create a screen capture, which has the effect of getting all items within the window bounds. This method is needed if you wish to capture child windows, like popups/hovers.Other capture methods will not use the screen capture mechanism, but rather will directly render the given component. In this case, subordinate windows will not be captured. For example, see
captureProvider(Class)
.- Parameters:
name
- the provider's namewidth
- the desired widthheight
- the desired height
-
captureProviderWindow
Captures the window, including decorations. This will use aRobot
to create a screen capture, which has the effect of getting all items within the window bounds. This method is needed if you wish to capture child windows, like popups/hovers.Other capture methods will not use the screen capture mechanism, but rather will directly render the given component. In this case, subordinate windows will not be captured. For example, see
captureProvider(Class)
.- Parameters:
provider
- the provider's namewidth
- the desired widthheight
- the desired height
-
showProvider
-
closeProvider
-
captureActionIcon
-
captureIcon
-
captureDialog
public void captureDialog() -
getDialog
-
getDialog
-
captureDialog
public void captureDialog(int width, int height) -
paintFix
-
captureDialog
-
captureDialog
-
captureDialog
-
captureDialog
-
captureWindow
public void captureWindow() -
captureWindow
-
captureWindow
-
captureToolWindow
public void captureToolWindow(int width, int height) -
captureDialog
-
captureDialog
-
captureListingField
-
generateImage
-
captureComponents
-
captureMenuBarMenu
-
captureMenuBarMenuHierachy
-
captureListingRange
public void captureListingRange(long start, long end, int width) -
error
-
setListingFieldWidth
-
getField
-
leftClickCursor
public void leftClickCursor() -
rightClickCursor
public void rightClickCursor() -
middleClickCursor
public void middleClickCursor() -
doubleClickCursor
public void doubleClickCursor() -
selectRow
-
setSelected
-
hideTableColumn
-
showMenuBarMenu
-
showColumnSettings
-
showTableColumn
-
setSelectedAnayzer
-
showCommentDialog
-
prepareCommentsDialog
public void prepareCommentsDialog(ghidra.app.plugin.core.comments.CommentsDialog dialog, String annotationText) -
createBookmark
public void createBookmark(long address) -
selectRow
-
scrollToRow
-
findRowByPartialText
-
performMemorySearch
-
removeField
-
showAnalysisOptions
-
removeFlowArrows
public void removeFlowArrows() -
makeSelection
-
addSelection
public void addSelection(long start, long end) -
makeSelection
public void makeSelection(long start, long end) -
go
public void go(long address) -
goToListing
public void goToListing(long address) -
goToListing
public void goToListing(long address, boolean scrollToMiddle) -
goToListing
-
positionCursor
public void positionCursor(long address) -
positionCursor
-
positionListingTop
public void positionListingTop(long address) -
positionListingCenter
public void positionListingCenter(long address) -
topOfListing
Deprecated. -
loadPlugin
-
loadPlugin
-
getProvider
-
getProvider
-
getDockableComponent
-
findProviderToolBarButton
-
address
Deprecated.useaddr(long)
instead- Parameters:
value
- the address's long value- Returns:
- the new address
-
getBounds
-
drawRectangleWithDropShadowAround
-
drawRectangleAround
-
drawRectangleAround
public Rectangle drawRectangleAround(JComponent component, JComponent root, Color color, int padding) Draws a rectangle around the given component. The root parameter is used to calculate screen coordinates. This allows you to capture a sub-component of a UI, drawing rectangles around children of said sub-component.If you are unsure of what to pass for
root
, the calldrawRectangleAround(JComponent, Color, int)
instead.- Parameters:
component
- the component to be en-rectangledroot
- the outermost container widget being displayed; null implies a top-level parentcolor
- the rectangle colorpadding
- the space between the rectangle and the component; more space makes the component more visible- Returns:
- the bounds of the drawn rectangle
-
drawRectangle
-
drawBorder
-
drawRectangle
-
fillRectangle
-
drawOval
-
drawText
-
drawText
-
drawLine
-
drawArrow
-
drawArrow
-
writeFile
-
readImage
-
crop
-
padImage
-
placeImagesSideBySide
-
createEmptyImage
-
takeSnippet
Crops a part of the current image, keeping what is inside the given bounds. This method creates a shape such that the top and bottom of the cropped image have a jagged line, looking somewhat like a sideways lightening bolt.- Parameters:
bounds
- the bounds to keep- Returns:
- the snippet
-
setDividerPercentage
public void setDividerPercentage(Class<? extends ComponentProvider> provider1, Class<? extends ComponentProvider> provider2, float percentage) -
showTab
-
addr(long)
instead