On Tue, 22 Jul 2025 07:09:58 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:
> 
>   Add copyright sections

I'll review the code soon. I ran a full set of tests, excluding the robot 
tests, and see two failures (below), which you mentioned are expected. 
Presumably these are the same two failures you see?

It would probably be best to skip these two tests when running the Headless 
glass platform. This could either be done as part of this PR or in a follow-up 
"Skip failing tests on Headless glass platform" bug.

1. MacPasteboardTest


MacPasteboardTest > testValidLocalImageURLMacPasteboard() FAILED
    java.lang.NullPointerException: Cannot invoke 
"com.sun.glass.ui.mac.MacPasteboardShim.pushMacPasteboard(java.util.HashMap)" 
because "test.com.sun.glass.ui.mac.MacPasteboardTest.macPasteboardShim" is null
        at 
test.com.sun.glass.ui.mac.MacPasteboardTest.lambda$testValidLocalImageURLMacPasteboard$0(MacPasteboardTest.java:73)

MacPasteboardTest > testDataBase64ImageMacPasteboard() FAILED
    java.lang.NullPointerException: Cannot invoke 
"com.sun.glass.ui.mac.MacPasteboardShim.pushMacPasteboard(java.util.HashMap)" 
because "test.com.sun.glass.ui.mac.MacPasteboardTest.macPasteboardShim" is null
        at 
test.com.sun.glass.ui.mac.MacPasteboardTest.lambda$testDataBase64ImageMacPasteboard$0(MacPasteboardTest.java:89)

MacPasteboardTest > testNotAnImageURLMacPasteboard() FAILED
    java.lang.NullPointerException: Cannot invoke 
"com.sun.glass.ui.mac.MacPasteboardShim.pushMacPasteboard(java.util.HashMap)" 
because "test.com.sun.glass.ui.mac.MacPasteboardTest.macPasteboardShim" is null
        at 
test.com.sun.glass.ui.mac.MacPasteboardTest.lambda$testNotAnImageURLMacPasteboard$0(MacPasteboardTest.java:100)


The tests in this class assume we are running the Mac glass platform, so they 
should all be skipped when running the Headless glass platform. One way to do 
this would be to add a `PlatformUtil::isHeadless` method and change all of the 
`assumeTrue(PlatformUtil.isMac())` calls to `assumeTrue(PlatformUtil.isMac() && 
!PlatformUtil.isHeadless())`. The assumeTrue wouldn't be annotated with a bug 
ID, since this expresses a fundamental requirement of the test, not a bug that 
needs to be fixed.


2. ClipboardTest::testCopyUTF8String


ClipboardTest > testCopyUTF8String() FAILED
    org.opentest4j.AssertionFailedError: expected: < Jump to: 😃💁 Jump> but was: 
<HEADLESS_TEST>
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at 
app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at 
app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
        at 
app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
        at 
app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1145)
        at 
app//test.javafx.scene.input.ClipboardTest.testCopyUTF8String(ClipboardTest.java:94)


This looks like a bug in the Headless glass platform code (not the test), so a 
bug tracking this headless clipboard failure should be filed. Then add 
`assumeTrue(!PlatformUtil.isHeadless())` along with a comment above the 
assumeTrue with the bug ID of the headless clipboard tracking bug.

Separately, another bug should be filed for the failing robot tests (I don't 
have a list, since I didn't run it with `-PUSE_ROBOT=true` for this test run).

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

PR Comment: https://git.openjdk.org/jfx/pull/1836#issuecomment-3117871252

Reply via email to