RFR: 8339233: Test javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java#id failed: Button renderings are different after window resize [v3]
Harshitha Onkar
honkar at openjdk.org
Tue Sep 3 18:05:20 UTC 2024
On Sat, 31 Aug 2024 09:09:22 GMT, Manukumar V S <mvs 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.
@@ -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.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20777#issuecomment-2327119894
More information about the client-libs-dev
mailing list