On Mon, 22 Jun 2026 14:18:01 GMT, Andy Goryachev <[email protected]> wrote:

>> Found while reviewing 
>> https://github.com/openjdk/jfx/pull/2184#discussion_r3452349547.
>> 
>> If this particular test runs before `TextInputControlModenaTest`, it will 
>> set the `Application` user agent stylesheet to `"data:,"` and not null.
>> The contract of `Application.setUserAgentStylesheet(..)` is that a `null` 
>> value will restore the platform default stylesheets, which is `Modena`. So 
>> we need to reset this value when changed in a test.
>> 
>> In our case, it is always `null`, but I still followed the pattern we use in 
>> other tests (like for `Locale`).
>> 
>> This can very easily tested by copying the test into 
>> `TextInputControlModenaTest` and see that the `testHighlightTextInput` will 
>> fail - and succeed with this change.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> modules/javafx.graphics/src/test/java/test/com/sun/javafx/css/StyleManagerTest.java
>  line 1175:
> 
>> 1173:             assertEquals(Color.BLUE, rect.getFill());
>> 1174:         } finally {
>> 1175:             Application.setUserAgentStylesheet(userAgentStylesheet);
> 
> I am curious as to what was the thinking around `"data:,"` - is it even a 
> legal data URL?  Or does it decode as ""?  In any case, this it the right fix.

Yes this is legal and just an empty `String`. To be fair 
`Application.setUserAgentStylesheet` is a bit strange from the API perspective 
and funny enough I wrote a mail about that some weeks ago: 
https://mail.openjdk.org/archives/list/[email protected]/message/5TKROXINHMVVW3YX4PO5B5B5MXPETDFD/

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2195#discussion_r3453061574

Reply via email to