On Mon, 5 Dec 2022 12:48:14 GMT, Karthik P K <[email protected]> wrote:

>> Cause: When slider is dragged for first time after tooltip appears, 
>> setOnMousePressed event was not invoked, hence dragStart was null in the 
>> subsequently invoked event handler (setOnMouseDragged).
>> 
>> Fix: Initialized dragStart in initialize method.
>> 
>> Test: Added system test to validate the fix.
>> 
>> Note: Initializing dragStart in layoutChildren method as suggested in the 
>> bug was causing side effects. Hence initialized dragStart in initialize 
>> method.
>
> Karthik P K has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update in mouse enter and exit events. Update in unit test

Changes requested by angorya (Committer).

modules/javafx.controls/src/main/java/javafx/scene/control/skin/SliderSkin.java 
line 395:

> 393: 
> 394:         thumb.setOnMouseEntered(me -> {
> 395:             if (getSkinnable().getTooltip() != null && 
> getSkinnable().getTooltip().isAutoHide()) {

If I may suggest an edit in these two event handlers - create a local variable:


            Tooltip t = getSkinnable().getTooltip();
            if (t != null && t.isAutoHide()) {
                tooltipConsumeAutoHidingEvents = t.getConsumeAutoHidingEvents();
                t.setConsumeAutoHidingEvents(false);
            }

tests/system/src/test/java/test/robot/javafx/scene/SliderTooltipNPETest.java 
line 85:

> 83: 
> 84:     private void dragSliderAfterTooltipDisplayed(int dragDistance) throws 
> Exception {
> 85:         Thread.sleep(1000); // Wait for slider to layout

is there an equivalent of waitForIdle()?

could we replace the sleep() with waiting for some event/property instead?

-------------

PR: https://git.openjdk.org/jfx/pull/965

Reply via email to