On Thu, 15 May 2025 16:36:28 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:
>>>However, the CountDownLatch is currently set to 1, which means the test only >>>waits for the first open/close interaction to complete. As a result, it does >>>not wait for the second attempt (opening the dialog again and pressing ESC >>>to close it), because the latch reaches zero after the first attempt. >> This causes the test to proceed immediately to the validation step: >> if (fd.isVisible()) { >> throw new RuntimeException("File Dialog is not closed"); >> } >> >> I don't see the existing code ignores the second attempt, that is due to >> longer delay put after the robot operations. >> You can add print statements and observe the behavior. >> >> However, I agree the countdown latch should be initialize to 2 to behave >> correctly. > >> > However, the CountDownLatch is currently set to 1, which means the test >> > only waits for the first open/close interaction to complete. As a result, >> > it does not wait for the second attempt (opening the dialog again and >> > pressing ESC to close it), because the latch reaches zero after the first >> > attempt. >> > This causes the test to proceed immediately to the validation step: >> > if (fd.isVisible()) { >> > throw new RuntimeException("File Dialog is not closed"); >> > } >> >> I don't see the existing code ignores the second attempt, that is due to >> longer delay put after the robot operations. You can add print statements >> and observe the behavior. >> >> However, I agree the countdown latch should be initialize to 2 to behave >> correctly. > > Technically, longer delays do add up, yet if it takes longer to display the > dialog and hide it, it's well possible that the dialog isn't hidden by the > time the main thread reaches the point where it calls `fd.isVisible()`. Hello @aivanov-jdk, I also added the test DoubleActionESCWithGtkDisabled to ensure that the old fix is still working Hello @aivanov-jdk, Please let me know if you're good with the recent changes ------------- PR Comment: https://git.openjdk.org/jdk/pull/25184#issuecomment-2922435910 PR Comment: https://git.openjdk.org/jdk/pull/25184#issuecomment-2956574585