On Mon, 7 Feb 2022 08:18:23 GMT, Manukumar V S <[email protected]> wrote:
> Create a regression test for > [JDK-4515999](https://bugs.openjdk.java.net/browse/JDK-4515999) > Create a test which checks whether incrementing dates via the keyboard > (up/down) gives the same results as when using mouse press on the arrow > buttons in a JSpinner. Does this new test reproduce the original problem reported in JDK-4515999? test/jdk/javax/swing/JSpinner/4515999/JSpinnerMouseAndKeyPressTest.java line 30: > 28: */ > 29: public class JSpinnerMouseAndKeyPressTest { > 30: //2 days in milliseconds Please add a space after `//` according to [the guidelines](http://cr.openjdk.java.net/~alundblad/styleguide/index-v6.html#toc-whitespace). In other places too. test/jdk/javax/swing/JSpinner/4515999/JSpinnerMouseAndKeyPressTest.java line 32: > 30: //2 days in milliseconds > 31: private static final int EXPECTED_VALUE_2_DAYS = 2 * 24 * 60 * 60 * > 1000; > 32: private static JFrame frame; I suggest adding a blank line between the constant and the frame to separate them. test/jdk/javax/swing/JSpinner/4515999/JSpinnerMouseAndKeyPressTest.java line 72: > 70: List<String> lafs = Arrays.stream(getInstalledLookAndFeels()) > 71: > .map(UIManager.LookAndFeelInfo::getClassName) > 72: .collect(Collectors.toList()); This is probably a bit too much for just mapping `LookAndFeelInfo` to `lafClassName`… If you like it though, I don't mind. test/jdk/javax/swing/JSpinner/4515999/JSpinnerMouseAndKeyPressTest.java line 83: > 81: final int spinnerButtonWidth = spinner.getWidth() - > 82: spinnerEditorWidth; > 83: final int spinnerQuarterHeight = spinner.getHeight() / 4; The `spinner` component must be accessed from EDT only. test/jdk/javax/swing/JSpinner/4515999/JSpinnerMouseAndKeyPressTest.java line 100: > 98: robot.mouseMove(spinnerUpButtonCenter.x, > spinnerUpButtonCenter.y); > 99: robot.mousePress(InputEvent.BUTTON1_MASK); > 100: robot.mouseRelease(InputEvent.BUTTON1_MASK); `BUTTON1_MASK` is deprecated in favour of `BUTTON1_DOWN_MASK` test/jdk/javax/swing/JSpinner/4515999/JSpinnerMouseAndKeyPressTest.java line 102: > 100: robot.mouseRelease(InputEvent.BUTTON1_MASK); > 101: > 102: long upValue = ((Date) spinner.getValue()).getTime(); The `spinner` component must be accessed from EDT only. ------------- Changes requested by aivanov (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/7363
