RFR: 8338103: Stabilize and open source a Swing OGL ButtonResizeTest [v7]

Abhishek Kumar abhiscxk at openjdk.org
Wed Aug 28 09:16:48 UTC 2024


On Wed, 28 Aug 2024 08:50:40 GMT, Manukumar V S <mvs at openjdk.org> wrote:

>> This PR creates a new test by stabilising and open sourcing a closed test.
>> This test verifies that the OpenGL pipeline does not create artifacts with swing components after window is zoomed to maximum size and then resized back to normal.
>> This test is run twice, with and without the flags "-Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=false" .
>> 
>> This is tested(15 times per platform) in all the available mach5 headful platforms and found to be stable.
>
> Manukumar V S has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review comments fixed : Sorted imports, formatting changes, saving images only on failure, compare changed, dispose on EDT

test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java line 53:

> 51:  * resized back to normal. The test case simulates this operation using
> 52:  * a JButton. A file image of the component will be saved before and after
> 53:  * window resize. The test passes if both button images are the same.

Suggestion:

 * a JButton. A file image of the component will be saved before and after
 * window resize if test fails. The test passes if both button images are the same.

test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java line 187:

> 185:             Point buttonLoc = buttonLocRef.get();
> 186:             System.out.println("Button loc: " + buttonLoc);
> 187:             bimage = robot.createScreenCapture(new Rectangle(buttonLoc.x, buttonLoc.y, button.getWidth(), button.getHeight()));

Can we return the capturedScreen directly? I guess **yes** and then BufferedImage object is not required and can be removed.

test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java line 261:

> 259:             int g2;
> 260:             int b1;  // blue
> 261:             int b2;

Just a suggestion
Suggestion:

            int r1, r2;  // red
            int g1, g2;  // green
            int b1, b2;  // blue

test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java line 280:

> 278:                     b2 = cm2.getBlue(o2);
> 279: 
> 280:                     if ((Math.abs(r1 - r2) > threshold) || (Math.abs(g1 - g2) > threshold) || (Math.abs(b1 - b2) > threshold)) {

Should we save the absolute difference value as `Math.abs(r1 - r2)` is used multiple times?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20532#discussion_r1734290812
PR Review Comment: https://git.openjdk.org/jdk/pull/20532#discussion_r1734295294
PR Review Comment: https://git.openjdk.org/jdk/pull/20532#discussion_r1734301880
PR Review Comment: https://git.openjdk.org/jdk/pull/20532#discussion_r1734306088


More information about the client-libs-dev mailing list