RFR: 8339233: Test javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java#id failed: Button renderings are different after window resize [v4]

Manukumar V S mvs at openjdk.org
Tue Sep 3 18:17:33 UTC 2024


On Tue, 3 Sep 2024 18:02:33 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

> > Individual robot.delay() can be added after UI creation and when frame state is changed to stabilize the test.
> 
> You are still missing some delays. Please check the diff lines in the following code snippet.
> 
> ```
> @@ -124,16 +125,15 @@ public void runTest() throws Exception {
> 
>          try {
>              robot = new Robot();
> +            robot.waitForIdle();
> +            robot.delay(1000);    // delay after UI creation
> 
>              if (focusGainedLatch.await(3, TimeUnit.SECONDS)) {
>                  System.out.println("Button focus gained...");
>              } else {
>                  System.out.println("Button focus not gained...");
>                  throw new RuntimeException(
>                          "Can't gain focus on button even after waiting " +
>                         "too long..");
>              }
> 
>              System.out.println("Getting initial button image..image1");
> @@ -142,16 +142,18 @@ public void runTest() throws Exception {
>              // some platforms may not support maximize frame
>              if (frame.getToolkit().isFrameStateSupported(
>                      JFrame.MAXIMIZED_BOTH)) {
> -                robot.waitForIdle(); // unnecessary waitForIdle can be removed 
>                  // maximize frame from normal size
>                  frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
>                  System.out.println("Frame is maximized");
>                  robot.waitForIdle();
>                  robot.delay(100);
> 
>                  if (frame.getToolkit().isFrameStateSupported(JFrame.NORMAL)) {
>                      System.out.println("Frame is back to normal");
>                      // resize from maximum size to normal
>                      frame.setExtendedState(JFrame.NORMAL);
> +                    robot.waitForIdle();
> +                    robot.delay(100); // please add these two lines after frame state is changed again.
> 
> @@ -192,7 +194,7 @@ public void runTest() throws Exception {
>      private BufferedImage getButtonImage() {
>          try {
>              robot.waitForIdle();
> -            robot.delay(1000);
> +            robot.delay(300); this can be reduced from 1000 to ~300-500ms based on testing.
> ```

Done.

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

PR Comment: https://git.openjdk.org/jdk/pull/20777#issuecomment-2327134209


More information about the client-libs-dev mailing list