...
java -Dawt.toolkit.name=WLToolkit JFTest
The java.awt.Robot
functionality is implemented in a somewhat roundabout way because it contradicts several basic principles of Wayland such as not exposing pixels after they have been composited. As a short- to mid-term solution, we intend to run tests in an instance of Weston (one such instance per test) that runs on top of X11. That instance of Weston requires a custom plugin libwakefield.so
(source code is under src/java.desktop/share/native/libwakefield). A Java wrapper is available that helps to fire up and tear down Weston and set up WAYLAND_DISPLAY
for the test. There is also a sample test test/jdk/java/awt/wakefield/ScreenCapture.java that can be run roughly as follows:
export LIBWAKEFIELD=/.../build/wakefield/libwakefield.so
jtreg -e:XDG_RUNTIME_DIR -e:LIBWAKEFIELD -testjdk:... test/jdk/java/awt/wakefield/
This was verified to work with Weston 9 on Ubuntu 21.10.