On Tue, 3 Mar 2026 19:48:46 GMT, Alexey Ivanov <[email protected]> wrote:

>> I added capturing a screenshot of the splash screen into the test, and I 
>> found that the splash screen is already closed when the screenshot is taken. 
>> I realised that I had changed the behaviour of the test with my screenshot 
>> code. The original test gets the color of the pixel on the screen before it 
>> calls `getScaleFactor` that displays a dialog, which results closing the 
>> splash screen.
>> 
>> https://github.com/openjdk/jdk/blob/e0b040a6c6713827033e9ba51c9ded920dd0203b/test/jdk/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java#L110-L111
>> 
>> I analysed the code of the splash screen, and it never opens the images with 
>> decorations for 100% scale: `[email protected]` or `[email protected]`.
>> 
>> To avoid any confusion, I modified the test code to ensure it never creates 
>> decorated files for 100%. If the scale factor of the main screen is 1.00, 
>> the second image remains with the default `@2x` decoration.
>> 
>> I also simplified the test. Now, `getScaleFactor` doesn't display a dialog, 
>> but reads the scale from `GraphicsEnvironment`. It did so anyway because the 
>> `Graphics` object passed to `paint` is an instance of `SunGraphics2D` in 
>> nearly all the cases.
>> 
>> The test always creates a screenshot of the splash screen and reads the 
>> color from the screenshot to determine whether the test fails or not.
>> 
>> The updated test is stable on all the platforms, I ran it many times, and 
>> the test never failed.
>> 
>> If the test ever fails again, we'll have the screenshot to analyse why.
>
> Alexey Ivanov has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains six additional 
> commits since the last revision:
> 
>  - Merge master
>  - Revert to always saving screenshot of splash screen
>  - Merge master
>  - Use screen capture to get color from splash screen
>    
>    Save the image only when the test fails
>  - Remove @modules java.desktop/sun.java2d and align colors
>  - 8374304: MultiResolutionSplashTest.java fails in CI: "Image with wrong 
> resolution is used for splash screen!"

Marked as reviewed by dmarkov (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/29851#pullrequestreview-3888849071

Reply via email to