RFR: 8342602: Remove JButton/PressedButtonRightClickTest test
Alexey Ivanov
aivanov at openjdk.org
Fri Oct 18 17:42:01 UTC 2024
On Fri, 18 Oct 2024 17:04:41 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
> The `bug4490179` verifies the code using the listener added to the button while the `PressedButtonRightClickTest` verifies the code using `getModel().isPressed()` which is not necessary the same.
The description of [JDK-8049069](https://bugs.openjdk.org/browse/JDK-8049069):
> 1. Press JButton with left mouse button and don't release it.
> 2. While holding left button, press and release right button
> Expected behaviour: JButton is still pressed
> Actual behaviour: JButton is released.
This matches the description of [JDK-4490179](https://bugs.openjdk.org/browse/JDK-4490179):
> On a JButton, press the left mouse button and, without releasing it, click the right button. This (incorrectly) fires an ActionEvent and disarms the button.
Indeed, if I add `ActionListener` to `JButton` to the test case `JButtonReleaseBug.java` attached to JDK-8049069, the action event is triggered as soon as I release the right mouse button because the model goes from pressed state to released state.
Even though the tests verify slightly different conditions, the effect is the same. The button must remain pressed when right mouse button is pressed and released.
> btw it is unclear why the bug4490179 test is not mention in the https://bugs.openjdk.org/browse/JDK-8049069
I do not know. I assume the reporter of JDK-8049069 didn't know a test had already existed.
According the first comment, “Detected by test: Swing_JButton/Automated/RButtonEventOP.” It looks the bug was found by SQE and a test in the SQE test suite.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21587#issuecomment-2422944764
More information about the client-libs-dev
mailing list