RFR: 8295339: DatePicker updates its value property with wrong date when dialog closes
Kevin Rushforth
kcr at openjdk.org
Thu Dec 8 19:00:12 UTC 2022
On Mon, 28 Nov 2022 12:42:15 GMT, Karthik P K <kpk at openjdk.org> wrote:
> Cause: On hiding the DatePicker dropdown, value selected was not getting updated to the text editor. Hence old value from the text editor was getting committed to DatePicker on focus loss. This issue was seen only when DatePicker is used in Alert dialog and Alert dialog is closed on making selection in DatePicker dropdown.
>
> Fix: Added call to updateDisplayNode() function before hiding the date picker dropdown.
>
> Test: Added system test to validate the fix.
Looks fine. I did a quick test on Windows and it fails without the fix and passes with the fix. I left a couple comments inline. The main question is whether we might need a small delay after the mouse click before checking the value.
tests/system/src/test/java/test/robot/javafx/scene/DatePickerUpdateOnAlertCloseTest.java line 25:
> 23: * questions.
> 24: */
> 25: package test.robot.javafx.scene;
Minor: as long as you are removing the blank like Andy pointed out, you can add a missing blank line here. :)
tests/system/src/test/java/test/robot/javafx/scene/DatePickerUpdateOnAlertCloseTest.java line 121:
> 119: datePicker.getLayoutY() + datePicker.getHeight() * Y_FACTOR);
> 120:
> 121: Assert.assertFalse(LocalDate.now().isEqual(datePicker.getValue()));
Do you need a small sleep here? It works for me without it on Windows, but I haven't tried it on my slow Ubuntu 20.04 VM.
-------------
Marked as reviewed by kcr (Lead).
PR: https://git.openjdk.org/jfx/pull/963
More information about the openjfx-dev
mailing list