TestFX / Monocle

Pre-packaged builds of Monocle (OpenJFX)
GNU General Public License v2.0
50 stars 24 forks source link

Java 11 - exception while calling MonocleRobot->getScreenCapture #83

Closed cristiannandrean closed 8 months ago

cristiannandrean commented 3 years ago

jdk: OpenJDK11U-jdk_x64_windows_hotspot_11.0.10_9 javafx version: 11.0.2 monocle version: jdk-11+26

JVM parameters: -Dtestfx.robot=glass -Dglass.platform=Monocle -Dmonocle.platform=Headless -Dprism.order=sw -Dprism.text=t2k

code:

  public static WritableImage takeScreenshot(final GlassRobot robot) {
        final Rectangle2D bounds = Screen.getPrimary().getVisualBounds();
        final int width = (int) bounds.getWidth();
        final int height = (int) bounds.getHeight();
        final int x = (int) bounds.getMinX();
        final int y = (int) bounds.getMinY();

        return robot.getScreenCapture(null, x, y, width, height, false);
    }

Expected result: screenhsot captured Actual result: java.lang.UnsupportedOperationException at java.base/java.nio.IntBuffer.array(IntBuffer.java:1049) at com.sun.glass.ui.monocle.MonocleRobot.getScreenCapture(MonocleRobot.java:209) at com.sun.glass.ui.GlassRobot.getScreenCapture(GlassRobot.java:200)

longtimeago commented 1 year ago

the same for jdk 17

shankalel commented 9 months ago

Any fix or workaround for this issue. would be highly appreciated

mvsoder commented 8 months ago

We recently posted new Monocle builds for JFX 11 and 17: https://central.sonatype.com/artifact/org.testfx/openjfx-monocle/versions

shankalel commented 8 months ago

This issue is still not fixed with latest Monocle builds for JFX 11 and 17 posted on 2024-02-11. Looking forward for this fix eagerly as it is blocking our Test Automation

mvsoder commented 8 months ago

Please note that this is not the 'official' Monocle repository. This repository is only for generating builds to support TestFX. To report bugs for Monocle, please visit, https://github.com/openjdk/jfx, and read the section on Issue Tracking.