File tree Expand file tree Collapse file tree 4 files changed +27
-2
lines changed
modules/javafx.graphics/src
test/java/test/javafx/scene Expand file tree Collapse file tree 4 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -1223,6 +1223,7 @@ protected void invalidated() {
1223
1223
1224
1224
if (oldRoot != null ) {
1225
1225
oldRoot .setScenes (null , null );
1226
+ oldRoot .getStyleClass ().remove ("root" );
1226
1227
}
1227
1228
oldRoot = _value ;
1228
1229
_value .getStyleClass ().add (0 , "root" );
Original file line number Diff line number Diff line change @@ -316,6 +316,7 @@ protected void invalidated() {
316
316
if (oldRoot != null ) {
317
317
StyleManager .getInstance ().forget (SubScene .this );
318
318
oldRoot .setScenes (null , null );
319
+ oldRoot .getStyleClass ().remove ("root" );
319
320
}
320
321
oldRoot = _value ;
321
322
_value .getStyleClass ().add (0 , "root" );
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2011, 2021 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2011, 2022 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -222,6 +222,17 @@ public void testRootUpdatedWhenChangedInScene() {
222
222
assertEquals (scene , g2 .getScene ());
223
223
}
224
224
225
+ @ Test
226
+ public void testRootStyleClassIsClearedWhenRootNodeIsRemovedFromScene () {
227
+ Scene scene = new Scene (new Group ());
228
+ Group g = new Group ();
229
+ assertFalse (g .getStyleClass ().contains ("root" ));
230
+ scene .setRoot (g );
231
+ assertTrue (g .getStyleClass ().contains ("root" ));
232
+ scene .setRoot (new Group ());
233
+ assertFalse (g .getStyleClass ().contains ("root" ));
234
+ }
235
+
225
236
@ Test
226
237
public void testNodeUpdatedWhenAddedToScene () {
227
238
Group root = new Group ();
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2011, 2016 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2011, 2022 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
41
41
import javafx .scene .SubSceneShim ;
42
42
import javafx .scene .layout .Pane ;
43
43
import static org .junit .Assert .assertEquals ;
44
+ import static org .junit .Assert .assertFalse ;
44
45
import static org .junit .Assert .assertNull ;
45
46
import org .junit .Test ;
46
47
import static org .junit .Assert .assertTrue ;
@@ -131,6 +132,17 @@ public void testRootUpdatedWhenChangedInSubScene() {
131
132
assertEquals (subScene , NodeShim .getSubScene (g2 ));
132
133
}
133
134
135
+ @ Test
136
+ public void testRootStyleClassIsClearedWhenRootNodeIsRemovedFromSubScene () {
137
+ SubScene scene = new SubScene (new Group (), 10 , 10 );
138
+ Group g = new Group ();
139
+ assertFalse (g .getStyleClass ().contains ("root" ));
140
+ scene .setRoot (g );
141
+ assertTrue (g .getStyleClass ().contains ("root" ));
142
+ scene .setRoot (new Group ());
143
+ assertFalse (g .getStyleClass ().contains ("root" ));
144
+ }
145
+
134
146
@ Test
135
147
public void testSetCamera () {
136
148
Camera camera = new PerspectiveCamera ();
You can’t perform that action at this time.
0 commit comments