Class AbstractScreenShotGenerator
- Direct Known Subclasses:
GhidraScreenShotGenerator,TutorialScreenShotGenerator
-
Nested Class Summary
Nested classes/interfaces inherited from class generic.test.AbstractGuiTest
AbstractGuiTest.ExceptionHandlingRunner -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final intprotected static final Stringprotected static final Stringprotected static final booleanprotected static final StringFields inherited from class ghidra.test.AbstractGhidraHeadlessIntegrationTest
PROJECT_NAMEFields inherited from class generic.test.AbstractGenericTest
concurrentTestExceptionRule, DEFAULT_TEST_TOOL_NAME, DEFAULT_TOOL_NAME, ruleChain, TESTDATA_DIRECTORY_NAME, watchmanFields inherited from class generic.test.AbstractGTest
BATCH_MODE, DEFAULT_WAIT_DELAY, DEFAULT_WAIT_TIMEOUT, DEFAULT_WINDOW_TIMEOUT, ignoreUnfinishedRule, PARALLEL_MODE, PRIVATE_LONG_WAIT_TIMEOUT, repeatedRule, testName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddr(long value) address(long value) Deprecated.voidaddSelection(long start, long end) voidcaptureActionIcon(String actionName) captureComponent(Component component) voidcaptureComponents(List<Component> comps) voidvoidcaptureDialog(int width, int height) voidcaptureDialog(DialogComponentProvider provider) voidcaptureDialog(Dialog dialog) voidcaptureDialog(Dialog dialog, int width, int height) voidcaptureDialog(Class<? extends DialogComponentProvider> clazz) voidcaptureDialog(Class<? extends DialogComponentProvider> clazz, int width, int height) voidcaptureDialog(String title) voidcaptureIcon(Icon icon) voidcaptureIsolatedComponent(JComponent component, int width, int height) voidcaptureIsolatedProvider(ComponentProvider provider, int width, int height) voidcaptureIsolatedProvider(Class<? extends ComponentProvider> clazz, int width, int height) voidcaptureIsolatedProviderWindow(Class<? extends ComponentProvider> clazz, int width, int height) The same ascaptureIsolatedProvider(Class, int, int)except this method will also capture the containing window.voidcaptureListingField(long address, String fieldName, int padding) voidcaptureListingRange(long start, long end, int width) voidvoidcaptureMenuBarMenu(String menuName, String... subMenuNames) voidcaptureMenuBarMenuHierachy(String menuName, String... subMenuNames) voidcaptureProvider(ComponentProvider provider) voidcaptureProvider(Class<? extends ComponentProvider> clazz) voidcaptureProvider(String name) voidcaptureProviderWindow(ComponentProvider provider) Captures the window, including decorations.voidcaptureProviderWindow(ComponentProvider provider, int width, int height) Captures the window, including decorations.voidcaptureProviderWindow(Class<? extends ComponentProvider> clazz) Captures the window, including decorations.voidcaptureProviderWindow(String name) Captures the window, including decorations.voidcaptureProviderWindow(String name, int width, int height) Captures the window, including decorations.voidCaptures the provider by using a screen shot and not by painting the provider directly (as doescaptureProvider(ComponentProvider)).voidcaptureToolWindow(int width, int height) voidvoidcaptureWindow(Window window) voidcaptureWindow(Window window, int width, int height) voidvoidcloseProvider(Class<? extends ComponentProvider> clazz) voidcreateBookmark(long address) createEmptyImage(int width, int height) voidvoidvoidvoiddrawBorder(Color c) voidvoidvoiddrawRectangle(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.voiddrawRectangleWithDropShadowAround(JComponent component, Color color, int padding) voidvoidvoidvoidexit()voidfillRectangle(Color c, Rectangle rect) findProviderToolBarButton(ComponentProvider provider, String actionName) intfindRowByPartialText(JTable table, String searchString) voidgetBounds(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) voidgo(long address) voidgoToListing(long address) voidgoToListing(long address, boolean scrollToMiddle) voidgoToListing(long address, String fieldName, boolean scrollToMiddle) voidhideTableColumn(GTable table, String columnName) voidloadPlugin(Class<? extends Plugin> clazz) loadPlugin(String className) voidloadProgram(String programName) voidmakeSelection(long start, long end) voidmakeSelection(AddressSet addrSet) voidvoidmoveProvider(ComponentProvider movee, ComponentProvider relativeTo, WindowPosition position) voidmoveProviderToFront(ComponentProvider provider) voidmoveProviderToFront(ComponentProvider provider, int width, int height) moveProviderToItsOwnWindow(ComponentProvider provider) moveProviderToItsOwnWindow(ComponentProvider provider, int width, int height) voidmoveWindowUp(Window window, int yOffset) protected TestEnvprotected voidvoidperformAction(String actionName, String owner, boolean wait) voidperformAction(String actionName, String owner, ComponentProvider contextProvider, boolean wait) voidperformDialogAction(String actionName, boolean wait) voidperformMemorySearch(String searchString) placeImagesSideBySide(Image left, Image right) voidpositionCursor(long address) voidpositionCursor(long address, String fieldName) voidpositionListingCenter(long address) voidpositionListingTop(long address) voidprepareCommentsDialog(ghidra.app.plugin.core.comments.CommentsDialog dialog, String annotationText) voidvoidpressButtonOnDialog(String buttonText) voidprotected BufferedImagevoidremoveField(String fieldName) voidvoidvoidscrollToRow(JTable table, int row) voidvoidvoidsetDividerPercentage(Class<? extends ComponentProvider> provider1, Class<? extends ComponentProvider> provider2, float percentage) protected voidvoidsetListingFieldWidth(String fieldName, int width) voidsetSelected(JToggleButton button, boolean select) voidsetSelectedAnayzer(Object analysisPanel, String analyzerName) voidsetToolSize(int width, int height) voidsetUp()voidvoidsetWindowSize(Window window, int width, int height) voidshowAnalysisOptions(String selectedAnalyzerName) voidshowColumnSettings(GTable table, String colName) voidshowCommentDialog(String text) showMenuBarMenu(String menuName, String... submenuNames) voidshowOptions(String optionsCategoryName) voidshowProgramOptions(String optionsCategoryName) <T extends ComponentProvider>
TshowProvider(Class<T> clazz) voidshowTableColumn(GTable table, String columnName) takeSnippet(Rectangle bounds) Crops a part of the current image, keeping what is inside the given bounds.voidtearDown()voidtopOfListing(long address) Deprecated.protected voidMethods inherited from class ghidra.test.AbstractGhidraHeadedIntegrationTest
addPlugin, click, click, click, click, createApplicationConfiguration, createApplicationLayout, getAction, getPluginByName, saveTool, showDialogWithoutBlocking, showTool, waitForBusyTool, waitForProgramMethods 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, tx, undo, undo, undo, undo, waitForScriptCompletionMethods 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, isToggleButttonSelected, isUseErrorGUI, performAction, performAction, performAction, performAction, performDialogAction, pressButtonByText, pressButtonByText, printOpenWindows, selectPath, selectTabIfAvailable, setErrorGUIEnabled, setToggleActionSelected, setToggleActionSelected, setToggleButtonSelected, setToggleButtonSelected, showProvider, triggerActionKey, triggerActionKey, triggerBackspace, triggerEnter, triggerEscape, triggerKey, triggerKey, triggerKey, triggerText, triggerText, waitForComponentProvider, waitForComponentProvider, waitForComponentProvider, waitForDialogComponent, waitForDialogComponent, waitForDialogComponent, waitForErrorDialog, waitForInfoDialog, waitForJDialog, waitForJDialog, waitForTableModel, waitForTree, waitForUpdateOnChooser, waitForWindow, waitForWindow, waitForWindow, waitForWindowByName, waitForWindowByTitleContaining, writeImage, writeImageMethods 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, waitForExpiringSwingTimers, waitForPostedSwingRunnables, waitForSwing, waitForTasks, waitForTasks, yieldToSwingMethods 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, windowForComponentMethods 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 aRobotto 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 aRobotto 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 aRobotto 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 aRobotto 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 aRobotto 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