RFR: 8303478: DatePicker throws uncatchable exception on tab out from garbled text
Kevin Rushforth
kcr at openjdk.org
Thu Nov 9 17:52:33 UTC 2023
On Thu, 2 Nov 2023 08:01:01 GMT, Marius Hanl <mhanl at openjdk.org> wrote:
>> The fix prevents the DatePicker from losing focus if the date is not parsable.
>
> modules/javafx.controls/src/main/java/javafx/scene/control/DatePicker.java line 157:
>
>> 155:
>> 156: /**
>> 157: * This is to address https://bugs.openjdk.org/browse/JDK-8303478
>
> I don't think this javadoc is needed, since it just links the issue one can also lookup when checking the git history
Exactly. Remove this line and either add a comment describing what the method does, or since the name is self-explanatory, remove the comment block entirely.
> tests/system/src/test/java/test/robot/javafx/scene/DatePickerOnFocusLostTest.java line 98:
>
>> 96: // 3. Click on button to grab the focus and hence attempt to datePicker.commitValue()
>> 97: // 4. Verify that in case of typo, the value was reverted, as well as the editor's text
>> 98: public void testDatePickerCommit(boolean typo) throws Exception {
>
> you actually can also write a normal JUnit test as far as I get this. Then there is no need for `Util.runAndWait`, `sleep` and so on.
>
> See: `test.javafx.scene.control.DatePickerTest`
A headless test is the preferred way to do it, if feasible. If it is, move the test to the `javafx.controls` module.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1274#discussion_r1379989660
PR Review Comment: https://git.openjdk.org/jfx/pull/1274#discussion_r1379993571
More information about the openjfx-dev
mailing list