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!" Upon further testing, I found out that this updated version also fails. <img width="300" height="200" alt="MultiResolutionSplashTest: translucent blue rectangle with a smaller translucent white rectangle to the bottom" src="https://github.com/user-attachments/assets/2dafe43a-0170-4742-858d-81fb3e19f71b" /> <img width="300" height="200" alt="MultiResolutionSplashTest: translucent blue rectangle with a translucent white rectangle that nearly covers the blue one" src="https://github.com/user-attachments/assets/19397f24-d292-4365-9867-28f8e8418d0c" /> I can't really explain what causes the pictures like the ones above. The first case with the blue splash screen completed successfully, but the second case with the white splash screen failed. It appears that on these images the blue splash screen window is fading out while the white splash screen is fading in. Adding a delay before capturing the splash screen and then explicitly closing it resolves the problem. After I added the delay, the captured splash screen looks a solid-filled rectangle with no background image seen around it. ------------- PR Comment: https://git.openjdk.org/jdk/pull/29851#issuecomment-4023919481
