RFR: 8296621: Stage steals focus on scene change [v4]

Thiago Milczarek Sayao tsayao at openjdk.org
Tue Dec 6 11:03:15 UTC 2022


On Tue, 6 Dec 2022 05:35:07 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

>> Thiago Milczarek Sayao has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add new line
>
> tests/system/src/test/java/test/robot/javafx/scene/SceneChangeShouldNotFocusStageTest.java line 80:
> 
>> 78:             tl.setCycleCount(Animation.INDEFINITE);
>> 79:             tl.getKeyFrames().addAll(new KeyFrame(Duration.millis(0), e -> stage.setScene(scene1)),
>> 80:                     new KeyFrame(Duration.millis(200), e -> stage.setScene(scene2)));
> 
> With `Duration.millis(0)`, JavaFX gets no time to switch to `scene2`. We should allow some time for `stage.setScene(scene2)` to be processed.
> We can observe the behavior by commenting two lines 55 and 88, and adding a delay `Util.sleep(10000)` in `exit()` method : The `scene2` will never be seen on Window.
> I would recommend to change `Duration.millis(0)` to `Duration.millis(100)` OR any other duration with sufficient gap between the two Frames.

I don't mind changing it, but I think those durations are relative, so `Duration.millis(0)` means "don't wait". I'm not sure I follow the recommendation.

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

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


More information about the openjfx-dev mailing list