On Mon, 7 Jul 2025 17:56:06 GMT, Johan Vos <j...@openjdk.org> wrote:

>> After spending a year in the sandbox repository, the Headless Platform is 
>> now ready to be reviewed in the main repository.
>> 
>> ### the Headless Platform
>> The Headless Platform is a top-level com.sun.glass.ui platform that replaces 
>> the second-level Monocle-Headless subplatform, that is part of the top-level 
>> Monocle platform. 
>> The platform can be used like any other platform, especially for running 
>> headless JavaFX applications, or for running tests (e.g. on CI systems)
>> 
>> ### changes
>> The code for the Headless Platform is in a new package 
>> com.sun.glass.ui.headless in the javafx.graphics module, and it does not 
>> require a code change in other packages.
>> This PR adds a simple change in the `build.gradle` file, to make the 
>> Headless Platform the standard when running headless tests (instead of using 
>> Monocle/Headless)
>> 
>> ### enable the Headless Platform
>> Setting the system property `glass.platform` to `Headless` will select the 
>> Headless Platform instead of the default one (either gtk, mac or win).
>> 
>> ### testing
>> `gradlew --info -PHEADLESS_TEST=true -PFULL_TEST=true :systemTests:cleanTest 
>> :systemTests:test`
>> runs all the system tests, apart from the robot tests. There are 2 failing 
>> tests, but there are valid reasons for those to fail.
>> 
>> ### robot tests
>> Most of the robot tests are working on headless as well. add `-PUSE_ROBOT` 
>> to test those.
>
> Johan Vos has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Specify A as a double.

I left one inline comment about the need for copyright headers.

I did a quick first pass, and this looks like a reasonable replacement for the 
Headless monocle platform to support running headless tests. It has the 
advantage of not needing to manually add monocle, which is not shipped on 
desktop platforms.

This is effectively an experimental feature used for testing. Since there is no 
API, and it is only enabled by setting a (as yet undocumented) system property, 
it seems OK that it isn't complete and doesn't have an associated CSR.

Longer term, we will want to think about how this might evolve. The first 
question is: Does this have any use case beyond testing? AWT has a headless 
mode that developers can use for server-side rendering. We have discussed the 
possibility of adding a similar feature for JavaFX, although it is less clear 
how it would be used, since we don't have image APIs that would be expected for 
such applications.

Even if this remains a testing feature, how should it eventually be configured? 
Using system properties? Some sort of config file? Something else?

How should this interact with the AWT headless toolkit? Or does it?

This requires the prism SW pipeline. How / where should be document this 
restriction?

modules/javafx.graphics/src/main/java/com/sun/glass/ui/headless/HeadlessApplication.java
 line 1:

> 1: package com.sun.glass.ui.headless;

All of the new files need a standard copyright header.

modules/javafx.graphics/src/main/java/com/sun/glass/ui/headless/HeadlessApplication.java
 line 141:

> 139:             float scaleX = 1.f;
> 140:             float scaleY = 1.f;
> 141:             String scale = System.getProperty("glass.gtk.uiScale");

"gtk" ?

-------------

PR Review: https://git.openjdk.org/jfx/pull/1836#pullrequestreview-3017927741
PR Review Comment: https://git.openjdk.org/jfx/pull/1836#discussion_r2205886360
PR Review Comment: https://git.openjdk.org/jfx/pull/1836#discussion_r2205920463

Reply via email to