RFR: 8349351 : Combine Screen Inset Tests into a Single File

Harshitha Onkar honkar at openjdk.org
Thu Feb 6 23:53:10 UTC 2025


On Tue, 4 Feb 2025 20:26:45 GMT, anass baya <duke at openjdk.org> wrote:

> While working on [JDK-6899304](https://bugs.openjdk.org/browse/JDK-6899304), we discovered that there are two tests meant to perform the same task.
> 
> The first test is located at test/jdk/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java and was originally designed for multi-screen configurations on Linux platforms.
> 
> The second test, located at test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java, is intended for single-screen configurations but lacks accuracy due to some workarounds to support Windows.
> 
> Now, the test at test/jdk/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java has been updated to work across all platforms, including Windows, which was previously failing. As a result, it has been agreed to rename this test to ScreenInsetsTest, remove the condition that restricted its execution to multi-screen configurations, and remove the redundant test at test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java.

Tested it on Windows. Changes look good. 
Does CI testing look good on all platforms?

test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java line 26:

> 24: /*
> 25:   @test
> 26:   @key headful

Suggestion:

/*
 * @test
 * @key headful

test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java line 47:

> 45:     private static final int SIZE = 100;
> 46:     // Allow a margin tolerance of 1 pixel due to scaling
> 47:     private static final int MARGIN_TOLERANCE = 1;

Since this test is extended to both single and multi monitor, I think tolerance can be increased to 2-3 (considering this test runs on CI now).

test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java line 106:

> 104:                     || bounds.y + insets.top != frameBounds.y
> 105:                     || Math.abs((bounds.width - insets.right - insets.left) - frameBounds.width) > MARGIN_TOLERANCE
> 106:                     || Math.abs((bounds.height - insets.bottom - insets.top) - frameBounds.height) > MARGIN_TOLERANCE) {

Line length exceeds 80 characters.

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

PR Review: https://git.openjdk.org/jdk/pull/23449#pullrequestreview-2600183614
PR Review Comment: https://git.openjdk.org/jdk/pull/23449#discussion_r1945626262
PR Review Comment: https://git.openjdk.org/jdk/pull/23449#discussion_r1945623601
PR Review Comment: https://git.openjdk.org/jdk/pull/23449#discussion_r1945568847


More information about the client-libs-dev mailing list