Package org.testfx.service.adapter.impl
Class PrivateGlassRobotAdapter
java.lang.Object
org.testfx.service.adapter.impl.GlassRobotAdapter
org.testfx.service.adapter.impl.PrivateGlassRobotAdapter
- All Implemented Interfaces:
RobotAdapter
RobotAdapter
implementation that uses the private
com.sun.glass.ui.GlassRobot
implementation to support JavaFX versions before 11.
All methods are called reflectively so that this class can compile on any JavaFX version.
-
Field Summary
Fields inherited from class org.testfx.service.adapter.impl.GlassRobotAdapter
glassRobot, RETRIEVAL_TIMEOUT_IN_MILLIS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate javafx.scene.paint.Color
convertFromGlassColor
(int color) private javafx.scene.image.Image
convertFromGlassPixels
(Object glassPixels) private int
convertToButtonId
(javafx.scene.input.MouseButton button) javafx.scene.paint.Color
getCapturePixelColor
(javafx.geometry.Point2D location) Gets the color of a pixel at the given JavaFx coordinates.javafx.geometry.Point2D
Returns the current position of the cursor in JavaFx coordinatesprotected javafx.scene.image.Image
getScreenCapture
(javafx.geometry.Rectangle2D region, boolean raw) void
keyPress
(javafx.scene.input.KeyCode key) Function used to make the robot press a key.void
keyRelease
(javafx.scene.input.KeyCode key) Function used to make the robot release a key.void
mouseMove
(javafx.geometry.Point2D location) Moves the mouse cursor to the given position in JavaFx coordinatesvoid
mousePress
(javafx.scene.input.MouseButton button) Makes the robot press a mouse button.void
mouseRelease
(javafx.scene.input.MouseButton button) Makes the robot release a mouse button.void
Creates a robot.void
Destroys the robotprivate void
writeIntBufferToImage
(IntBuffer intBuffer, javafx.scene.image.WritableImage image) Methods inherited from class org.testfx.service.adapter.impl.GlassRobotAdapter
createGlassRobot, getCaptureRegion, getCaptureRegionRaw, getRobot, mouseWheel
-
Constructor Details
-
PrivateGlassRobotAdapter
PrivateGlassRobotAdapter()
-
-
Method Details
-
robotCreate
public void robotCreate()Description copied from interface:RobotAdapter
Creates a robot. -
robotDestroy
public void robotDestroy()Description copied from interface:RobotAdapter
Destroys the robot -
keyPress
public void keyPress(javafx.scene.input.KeyCode key) Description copied from interface:RobotAdapter
Function used to make the robot press a key. The key must be a physical existing key on the keyboard.- Parameters:
key
- the key to press (must exist on a keyboard)
-
keyRelease
public void keyRelease(javafx.scene.input.KeyCode key) Description copied from interface:RobotAdapter
Function used to make the robot release a key. The key must be a physical existing key on the keyboard.- Parameters:
key
- the key to press (must exist on a keyboard)
-
getMouseLocation
public javafx.geometry.Point2D getMouseLocation()Description copied from interface:RobotAdapter
Returns the current position of the cursor in JavaFx coordinates- Returns:
- the current position of the mouse cursor
-
mouseMove
public void mouseMove(javafx.geometry.Point2D location) Description copied from interface:RobotAdapter
Moves the mouse cursor to the given position in JavaFx coordinates- Parameters:
location
- the location in JavaFx coordinates to move the cursor to
-
mousePress
public void mousePress(javafx.scene.input.MouseButton button) Description copied from interface:RobotAdapter
Makes the robot press a mouse button.- Parameters:
button
- the button to press
-
mouseRelease
public void mouseRelease(javafx.scene.input.MouseButton button) Description copied from interface:RobotAdapter
Makes the robot release a mouse button.- Parameters:
button
- the button to release
-
getCapturePixelColor
public javafx.scene.paint.Color getCapturePixelColor(javafx.geometry.Point2D location) Description copied from interface:RobotAdapter
Gets the color of a pixel at the given JavaFx coordinates. The returned Color is in the JavaFx color space. //TODO Due to technical reasons, there might be a deviation in color.- Parameters:
location
- of the pixel in JavaFx coordinates, to retrieve the color for- Returns:
- the Color of the given Pixel in the JavaFx color space
-
getScreenCapture
protected javafx.scene.image.Image getScreenCapture(javafx.geometry.Rectangle2D region, boolean raw) - Specified by:
getScreenCapture
in classGlassRobotAdapter
-
convertToButtonId
private int convertToButtonId(javafx.scene.input.MouseButton button) -
convertFromGlassColor
private javafx.scene.paint.Color convertFromGlassColor(int color) -
convertFromGlassPixels
-
writeIntBufferToImage
-