Class AbstractScreenShotGenerator

Direct Known Subclasses:
GhidraScreenShotGenerator, TutorialScreenShotGenerator

public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIntegrationTest
  • Field Details Link icon

    • SAVE_CREATED_IMAGE_FILE_KEY Link icon

      protected static final String SAVE_CREATED_IMAGE_FILE_KEY
      See Also:
    • SAVE_CREATED_IMAGE_FILE Link icon

      protected static final boolean SAVE_CREATED_IMAGE_FILE
    • NEW_FILENAME_SUFFIX_KEY Link icon

      protected static final String NEW_FILENAME_SUFFIX_KEY
      See Also:
    • DEFAULT_FILENAME_SUFFIX Link icon

      protected static final String DEFAULT_FILENAME_SUFFIX
      See Also:
    • NEW_FILENAME_SUFFIX Link icon

      protected static final String NEW_FILENAME_SUFFIX
    • DIALOG_HEADER_HEIGHT Link icon

      protected static final int DIALOG_HEADER_HEIGHT
      See Also:
    • tool Link icon

      public PluginTool tool
    • env Link icon

      public TestEnv env
    • program Link icon

      public Program program
    • image Link icon

      public Image image
  • Constructor Details Link icon

    • AbstractScreenShotGenerator Link icon

      public AbstractScreenShotGenerator()
  • Method Details Link icon

    • newTestEnv Link icon

      protected TestEnv newTestEnv() throws Exception
      Throws:
      Exception
    • setUp Link icon

      public void setUp() throws Exception
      Throws:
      Exception
    • tearDown Link icon

      public void tearDown() throws Exception
      Throws:
      Exception
    • prepareTool Link icon

      public void prepareTool()
    • loadProgram Link icon

      public void loadProgram() throws Exception
      Throws:
      Exception
    • closeNonProgramArchives Link icon

      public void closeNonProgramArchives()
    • loadProgram Link icon

      public Program loadProgram(String programName)
    • exit Link icon

      public void exit()
    • setUser Link icon

      public void setUser(String userName)
    • setDockIcon Link icon

      protected void setDockIcon()
    • addr Link icon

      public Address addr(long value)
    • setToolSize Link icon

      public void setToolSize(int width, int height)
    • setWindowSize Link icon

      public void setWindowSize(Window window, int width, int height)
    • performAction Link icon

      public void performAction(String actionName, String owner, boolean wait)
    • performDialogAction Link icon

      public void performDialogAction(String actionName, boolean wait)
    • performAction Link icon

      public void performAction(String actionName, String owner, ComponentProvider contextProvider, boolean wait)
    • showOptions Link icon

      public void showOptions(String optionsCategoryName)
    • showProgramOptions Link icon

      public void showProgramOptions(String optionsCategoryName)
    • getCursorBounds Link icon

      public Rectangle getCursorBounds()
    • pressOkOnDialog Link icon

      public void pressOkOnDialog()
    • pressButtonOnDialog Link icon

      public void pressButtonOnDialog(String buttonText)
    • captureIsolatedComponent Link icon

      public void captureIsolatedComponent(JComponent component, int width, int height)
    • captureComponent Link icon

      public Image captureComponent(Component component)
    • captureIsolatedProviderWindow Link icon

      public void captureIsolatedProviderWindow(Class<? extends ComponentProvider> clazz, int width, int height)
      The same as captureIsolatedProvider(Class, int, int) except this method will also capture the containing window.
      Parameters:
      clazz - the provider class
      width - the width of the capture
      height - the height of the capture
    • captureIsolatedProvider Link icon

      public void captureIsolatedProvider(Class<? extends ComponentProvider> clazz, int width, int height)
    • captureIsolatedProvider Link icon

      public void captureIsolatedProvider(ComponentProvider provider, int width, int height)
    • moveProviderToFront Link icon

      public void moveProviderToFront(ComponentProvider provider, int width, int height)
    • moveProviderToFront Link icon

      public void moveProviderToFront(ComponentProvider provider)
    • moveWindowUp Link icon

      public void moveWindowUp(Window window, int yOffset)
    • moveProviderToItsOwnWindow Link icon

      public Window moveProviderToItsOwnWindow(ComponentProvider provider)
    • moveProviderToItsOwnWindow Link icon

      public Window moveProviderToItsOwnWindow(ComponentProvider provider, int width, int height)
    • getDockableComponent Link icon

      public DockableComponent getDockableComponent(ComponentProvider provider)
    • moveProvider Link icon

      public void moveProvider(ComponentProvider movee, ComponentProvider relativeTo, WindowPosition position)
    • captureMenu Link icon

      public void captureMenu()
    • getPopupMenu Link icon

      public JPopupMenu getPopupMenu()
    • captureProvider Link icon

      public void captureProvider(Class<? extends ComponentProvider> clazz)
    • captureProvider Link icon

      public void captureProvider(ComponentProvider provider)
    • captureProvider Link icon

      public void captureProvider(String name)
    • captureProviderWithScreenShot Link icon

      public void captureProviderWithScreenShot(ComponentProvider provider)
      Captures the provider by using a screen shot and not by painting the provider directly (as does captureProvider(ComponentProvider)). Use this method if you need to capture the provider along with any popup windows.
      Parameters:
      provider - the provider
    • captureProviderWindow Link icon

      public void captureProviderWindow(String name)
      Captures the window, including decorations. This will use a Robot 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 Link icon

      public void captureProviderWindow(Class<? extends ComponentProvider> clazz)
      Captures the window, including decorations. This will use a Robot 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 Link icon

      public void captureProviderWindow(ComponentProvider provider)
      Captures the window, including decorations. This will use a Robot 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 Link icon

      public void captureProviderWindow(String name, int width, int height)
      Captures the window, including decorations. This will use a Robot 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
      width - the desired width
      height - the desired height
    • captureProviderWindow Link icon

      public void captureProviderWindow(ComponentProvider provider, int width, int height)
      Captures the window, including decorations. This will use a Robot 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 name
      width - the desired width
      height - the desired height
    • showProvider Link icon

      public <T extends ComponentProvider> T showProvider(Class<T> clazz)
    • closeProvider Link icon

      public void closeProvider(Class<? extends ComponentProvider> clazz)
    • captureActionIcon Link icon

      public void captureActionIcon(String actionName)
    • captureIcon Link icon

      public void captureIcon(Icon icon)
    • captureDialog Link icon

      public void captureDialog()
    • getDialog Link icon

      public DialogComponentProvider getDialog()
    • getDialog Link icon

      public DialogComponentProvider getDialog(Class<? extends DialogComponentProvider> clazz)
    • captureDialog Link icon

      public void captureDialog(int width, int height)
    • paintFix Link icon

      protected void paintFix(Window window)
    • captureDialog Link icon

      public void captureDialog(String title)
    • captureDialog Link icon

      public void captureDialog(Class<? extends DialogComponentProvider> clazz)
    • captureDialog Link icon

      public void captureDialog(DialogComponentProvider provider)
    • captureDialog Link icon

      public void captureDialog(Class<? extends DialogComponentProvider> clazz, int width, int height)
    • captureWindow Link icon

      public void captureWindow()
    • captureWindow Link icon

      public void captureWindow(Window window)
    • captureWindow Link icon

      public void captureWindow(Window window, int width, int height)
    • captureToolWindow Link icon

      public void captureToolWindow(int width, int height)
    • captureDialog Link icon

      public void captureDialog(Dialog dialog)
    • captureDialog Link icon

      public void captureDialog(Dialog dialog, int width, int height)
    • captureListingField Link icon

      public void captureListingField(long address, String fieldName, int padding)
    • generateImage Link icon

      public void generateImage(Component c)
    • captureComponents Link icon

      public void captureComponents(List<Component> comps)
    • captureMenuBarMenu Link icon

      public void captureMenuBarMenu(String menuName, String... subMenuNames)
    • captureMenuBarMenuHierachy Link icon

      public void captureMenuBarMenuHierachy(String menuName, String... subMenuNames)
    • captureListingRange Link icon

      public void captureListingRange(long start, long end, int width)
    • error Link icon

      public void error(Exception e)
    • setListingFieldWidth Link icon

      public void setListingFieldWidth(String fieldName, int width)
    • getField Link icon

      public Field getField(Point point)
    • leftClickCursor Link icon

      public void leftClickCursor()
    • rightClickCursor Link icon

      public void rightClickCursor()
    • middleClickCursor Link icon

      public void middleClickCursor()
    • doubleClickCursor Link icon

      public void doubleClickCursor()
    • selectRow Link icon

      public void selectRow(JTable table, int rowIndex)
    • setSelected Link icon

      public void setSelected(JToggleButton button, boolean select)
    • hideTableColumn Link icon

      public void hideTableColumn(GTable table, String columnName)
    • showMenuBarMenu Link icon

      public List<Component> showMenuBarMenu(String menuName, String... submenuNames)
    • showColumnSettings Link icon

      public void showColumnSettings(GTable table, String colName)
    • showTableColumn Link icon

      public void showTableColumn(GTable table, String columnName)
    • setSelectedAnayzer Link icon

      public void setSelectedAnayzer(Object analysisPanel, String analyzerName)
    • showCommentDialog Link icon

      public void showCommentDialog(String text)
    • prepareCommentsDialog Link icon

      public void prepareCommentsDialog(ghidra.app.plugin.core.comments.CommentsDialog dialog, String annotationText)
    • createBookmark Link icon

      public void createBookmark(long address)
    • selectRow Link icon

      public void selectRow(JTable table, String searchString)
    • scrollToRow Link icon

      public void scrollToRow(JTable table, int row)
    • findRowByPartialText Link icon

      public int findRowByPartialText(JTable table, String searchString)
    • performMemorySearch Link icon

      public void performMemorySearch(String searchString)
    • removeField Link icon

      public void removeField(String fieldName)
    • showAnalysisOptions Link icon

      public void showAnalysisOptions(String selectedAnalyzerName)
    • removeFlowArrows Link icon

      public void removeFlowArrows()
    • makeSelection Link icon

      public void makeSelection(AddressSet addrSet)
    • addSelection Link icon

      public void addSelection(long start, long end)
    • makeSelection Link icon

      public void makeSelection(long start, long end)
    • go Link icon

      public void go(long address)
    • goToListing Link icon

      public void goToListing(long address)
    • goToListing Link icon

      public void goToListing(long address, boolean scrollToMiddle)
    • goToListing Link icon

      public void goToListing(long address, String fieldName, boolean scrollToMiddle)
    • positionCursor Link icon

      public void positionCursor(long address)
    • positionCursor Link icon

      public void positionCursor(long address, String fieldName)
    • positionListingTop Link icon

      public void positionListingTop(long address)
    • positionListingCenter Link icon

      public void positionListingCenter(long address)
    • topOfListing Link icon

      @Deprecated public void topOfListing(long address)
      Deprecated.
    • loadPlugin Link icon

      public Plugin loadPlugin(Class<? extends Plugin> clazz)
    • loadPlugin Link icon

      public Plugin loadPlugin(String className)
    • getProvider Link icon

      public ComponentProvider getProvider(String name)
    • getProvider Link icon

      public <T extends ComponentProvider> T getProvider(Class<T> clazz)
    • getDockableComponent Link icon

      public DockableComponent getDockableComponent(Class<? extends ComponentProvider> clazz)
    • findProviderToolBarButton Link icon

      public JButton findProviderToolBarButton(ComponentProvider provider, String actionName)
    • address Link icon

      @Deprecated public Address address(long value)
      Deprecated.
      use addr(long) instead
      Parameters:
      value - the address's long value
      Returns:
      the new address
    • getBounds Link icon

      public Rectangle getBounds(JComponent component)
    • drawRectangleWithDropShadowAround Link icon

      public void drawRectangleWithDropShadowAround(JComponent component, Color color, int padding)
    • drawRectangleAround Link icon

      public Rectangle drawRectangleAround(JComponent component, Color color, int padding)
    • drawRectangleAround Link icon

      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 call drawRectangleAround(JComponent, Color, int) instead.

      Parameters:
      component - the component to be en-rectangled
      root - the outermost container widget being displayed; null implies a top-level parent
      color - the rectangle color
      padding - the space between the rectangle and the component; more space makes the component more visible
      Returns:
      the bounds of the drawn rectangle
    • drawRectangle Link icon

      public Rectangle drawRectangle(Color c, Rectangle r, int padding, int thickness)
    • drawBorder Link icon

      public void drawBorder(Color c)
    • drawRectangle Link icon

      public void drawRectangle(Color c, Rectangle rect, int thickness)
    • fillRectangle Link icon

      public void fillRectangle(Color c, Rectangle rect)
    • drawOval Link icon

      public void drawOval(Color c, Rectangle rect, int thickness)
    • drawText Link icon

      public void drawText(String text, Color color, Point start, float size)
    • drawText Link icon

      public void drawText(String text, Color color, Point start, Font font)
    • drawLine Link icon

      public void drawLine(Color c, int thickness, Point start, Point end)
    • drawArrow Link icon

      public void drawArrow(Color c, Point start, Point end)
    • drawArrow Link icon

      public void drawArrow(Color c, int thickness, Point start, Point end, int arrowSize)
    • writeFile Link icon

      protected void writeFile(File imageFile)
    • readImage Link icon

      protected BufferedImage readImage(File imageFile)
    • crop Link icon

      public Image crop(Rectangle bounds)
    • padImage Link icon

      public Image padImage(Color c, int top, int left, int right, int bottom)
    • placeImagesSideBySide Link icon

      public Image placeImagesSideBySide(Image left, Image right)
    • createEmptyImage Link icon

      public BufferedImage createEmptyImage(int width, int height)
    • takeSnippet Link icon

      public Image takeSnippet(Rectangle bounds)
      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 Link icon

      public void setDividerPercentage(Class<? extends ComponentProvider> provider1, Class<? extends ComponentProvider> provider2, float percentage)
    • showTab Link icon

      public Component showTab(String title)