RFR: 8240506: TextFieldSkin/Behavior: misbehavior on switching skin [v2]

Ambarish Rapte arapte at openjdk.java.net
Thu Jul 8 17:28:55 UTC 2021


On Wed, 7 Jul 2021 10:02:52 GMT, Jeanette Winzenburg <fastegal at openjdk.org> wrote:

>> modules/javafx.controls/src/test/java/test/com/sun/javafx/scene/control/behavior/BehaviorCleanupTest.java line 404:
>> 
>>> 402:         }
>>> 403:         if (!root.getChildren().contains(control)) {
>>> 404:             root.getChildren().add(control);
>> 
>> The controls added to root are not removed. I think we should clear the scenegraph after execution of each test.
>> suggesting to add following call in the cleanup method,
>> 
>> if (root != null) {
>>     root.getChildren().removeAll();
>> }
>
> Hmm ... don't quite understand: the cleanup follows the same pattern used across many controls/skin tests 
> 
>     @After
>     public void cleanup() {
>         if (stage != null) {
>             stage.hide();
>         }
> 
> The stage is created at most once per test method, and allows to add more controls in that same test method, it's hidden after running each test. Running the next text, there's no reference to the old .. why should we remove its children also? Or maybe I misunderstand what you are suggesting :)

Oops, the current code is proper. I missed the cleanup somehow. This looks good.

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

PR: https://git.openjdk.java.net/jfx/pull/534


More information about the openjfx-dev mailing list