RFR: JDK-8266245: AWT Test FullScreenInsets.java fails due to incorrect pixel color and wrong window bounds

Harshitha Onkar honkar at openjdk.org
Fri Dec 2 18:16:13 UTC 2022


On Fri, 2 Dec 2022 03:37:47 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> The above test was failing due to incorrect pixel color and wrong window bounds on Mac-ARM, Windows and Linux platforms.
>> 
>> The following changes have been made:
>> - Correct window bounds are obtained using the screen device being tested (this test checks FullScreen functionality on multiple screen devices).
>> - Color tolerance has been added for color check
>> - Instead of scanning the full screen to check pixel color, vertical and horizontal scans are done at the far right and bottom end to ensure that window is in full screen mode w.r.t to screen device and the window bounds are as expected.
>> 
>> CI testing passes on all platforms (tested 50 times per platform).
>
> test/jdk/java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java line 44:
> 
>> 42:  * @bug 8003173 7019055
>> 43:  * @summary Full-screen windows should have the proper insets.
>> 44:  * @run main FullScreenInsets
> 
> run main is not needed if no options are provided for the test. less one place to make a typo or copy-paste error in the name of the test.

Added the @run tag to be consistent with other jtreg tests. I can remove it in the next update.

> test/jdk/java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java line 61:
> 
>> 59:         final Frame wGreen = new Frame();
>> 60:         wGreen.setBackground(Color.GREEN);
>> 61:         wGreen.setUndecorated(true);
> 
> Why did you make that frame undecorated? I think the decoration was one of the reasons why the bug was reproduced.

When testing on Win10, observed that for a decorated frame the title bar is retained in full screen mode unlike some of the other applications (eg. Chrome and IDE in full screen mode). 

When I checked the Javadocs for [setFullScreenWindow(Window w)](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/java/awt/GraphicsDevice.html#setFullScreenWindow(java.awt.Window)), it states that - _"It is unspecified and platform-dependent how decorated windows operate in full-screen mode. For this reason, it is recommended to turn off the decorations in a Frame or Dialog object by using the setUndecorated method."_  

For the above reasons and to aid testing the pixel-color across full-screen window without having to account for different platform specific title bar sizes, the frame was set as undecorated.

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

PR: https://git.openjdk.org/jdk/pull/11462



More information about the client-libs-dev mailing list