modules/graphics/src/test/java/test/javafx/scene/FocusTest.java

Print this page
rev 9250 : 8134762: Refactor Javafx graphics module tests for clear separation of tests
Reviewed-by:

*** 21,35 **** * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package javafx.scene; ! import com.sun.javafx.pgstub.StubScene; ! import com.sun.javafx.pgstub.StubToolkit; import com.sun.javafx.tk.Toolkit; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; --- 21,35 ---- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package test.javafx.scene; ! import test.com.sun.javafx.pgstub.StubScene; ! import test.com.sun.javafx.pgstub.StubToolkit; import com.sun.javafx.tk.Toolkit; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame;
*** 40,49 **** --- 40,54 ---- import java.util.List; import javafx.beans.InvalidationListener; import javafx.beans.Observable; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; + import javafx.scene.Group; + import javafx.scene.Node; + import javafx.scene.ParentShim; + import javafx.scene.Scene; + import javafx.scene.SceneShim; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; import org.junit.After;
*** 80,90 **** } void fireTestPulse() { // TODO: an actual pulse doesn't work in the stub environment. // Just clean up focus instead. ! scene.focusCleanup(); } boolean T = true; boolean F = false; --- 85,95 ---- } void fireTestPulse() { // TODO: an actual pulse doesn't work in the stub environment. // Just clean up focus instead. ! SceneShim.focusCleanup(scene); } boolean T = true; boolean F = false;
*** 123,144 **** */ @Test public void testInitial() { assertNullFocus(scene); scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(n()); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); } /** * Test requestFocus() on eligible and ineligible nodes. */ @Test public void testRequest() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll( n(T, T, T), // 0 - focusable n(F, T, T), // 1 - focusable n(T, T, F), // 2 - not focusable n(F, T, F), // 3 - not focusable n(T, F, T), // 4 - not focusable --- 128,149 ---- */ @Test public void testInitial() { assertNullFocus(scene); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(n()); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); } /** * Test requestFocus() on eligible and ineligible nodes. */ @Test public void testRequest() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll( n(T, T, T), // 0 - focusable n(F, T, T), // 1 - focusable n(T, T, F), // 2 - not focusable n(F, T, F), // 3 - not focusable n(T, F, T), // 4 - not focusable
*** 172,184 **** * Test removing the focus owner without another eligible node in the scene. */ @Test public void testRemove1() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(n()); nodes.get(0).requestFocus(); ! scene.getRoot().getChildren().remove(nodes.get(0)); fireTestPulse(); assertNotFocused(scene, nodes.get(0)); assertNullFocus(scene); } --- 177,189 ---- * Test removing the focus owner without another eligible node in the scene. */ @Test public void testRemove1() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(n()); nodes.get(0).requestFocus(); ! ParentShim.getChildren(scene.getRoot()).remove(nodes.get(0)); fireTestPulse(); assertNotFocused(scene, nodes.get(0)); assertNullFocus(scene); }
*** 186,198 **** * Test removing the focus owner with another eligible node in the scene. */ @Test public void testRemove2() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(n(), n()); nodes.get(0).requestFocus(); ! scene.getRoot().getChildren().remove(nodes.get(0)); fireTestPulse(); assertNotFocused(scene, nodes.get(0)); assertIsFocused(scene, nodes.get(1)); } --- 191,203 ---- * Test removing the focus owner with another eligible node in the scene. */ @Test public void testRemove2() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(n(), n()); nodes.get(0).requestFocus(); ! ParentShim.getChildren(scene.getRoot()).remove(nodes.get(0)); fireTestPulse(); assertNotFocused(scene, nodes.get(0)); assertIsFocused(scene, nodes.get(1)); }
*** 201,213 **** */ @Test public void testRemove_ClearsFocusOnRemovedNode1() { Node n = n(); scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(n); n.requestFocus(); ! scene.getRoot().getChildren().remove(n); fireTestPulse(); assertNotFocused(scene, n); } /** --- 206,218 ---- */ @Test public void testRemove_ClearsFocusOnRemovedNode1() { Node n = n(); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(n); n.requestFocus(); ! ParentShim.getChildren(scene.getRoot()).remove(n); fireTestPulse(); assertNotFocused(scene, n); } /**
*** 215,243 **** */ @Test public void testRemove_ClearsFocusOnRemovedNode2() { Node n = n(); scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(n, n()); n.requestFocus(); ! scene.getRoot().getChildren().remove(n); fireTestPulse(); assertNotFocused(scene, n); ! assertIsFocused(scene, scene.getRoot().getChildren().get(0)); } /** * Test removing the focus owner without another eligible node in the scene. */ @Test public void testRemoveChildOfGroup_ClearsFocusOnRemovedNode1() { Node n = n(); Group g = new Group(n); scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(g); n.requestFocus(); ! g.getChildren().remove(n); fireTestPulse(); assertNotFocused(scene, n); } /** --- 220,248 ---- */ @Test public void testRemove_ClearsFocusOnRemovedNode2() { Node n = n(); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(n, n()); n.requestFocus(); ! ParentShim.getChildren(scene.getRoot()).remove(n); fireTestPulse(); assertNotFocused(scene, n); ! assertIsFocused(scene, ParentShim.getChildren(scene.getRoot()).get(0)); } /** * Test removing the focus owner without another eligible node in the scene. */ @Test public void testRemoveChildOfGroup_ClearsFocusOnRemovedNode1() { Node n = n(); Group g = new Group(n); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(g); n.requestFocus(); ! ParentShim.getChildren(g).remove(n); fireTestPulse(); assertNotFocused(scene, n); } /**
*** 245,255 **** * node in the scene. */ @Test public void testInvisible1() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(n()); nodes.get(0).requestFocus(); assertIsFocused(scene, nodes.get(0)); nodes.get(0).setVisible(false); fireTestPulse(); assertNotFocused(scene, nodes.get(0)); --- 250,260 ---- * node in the scene. */ @Test public void testInvisible1() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(n()); nodes.get(0).requestFocus(); assertIsFocused(scene, nodes.get(0)); nodes.get(0).setVisible(false); fireTestPulse(); assertNotFocused(scene, nodes.get(0));
*** 261,271 **** * node in the scene. */ @Test public void testInvisible2() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(n(), n()); nodes.get(0).requestFocus(); assertIsFocused(scene, nodes.get(0)); nodes.get(0).setVisible(false); fireTestPulse(); assertNotFocused(scene, nodes.get(0)); --- 266,276 ---- * node in the scene. */ @Test public void testInvisible2() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(n(), n()); nodes.get(0).requestFocus(); assertIsFocused(scene, nodes.get(0)); nodes.get(0).setVisible(false); fireTestPulse(); assertNotFocused(scene, nodes.get(0));
*** 277,287 **** * node in the scene. */ @Test public void testDisable1() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(n()); nodes.get(0).requestFocus(); nodes.get(0).setDisable(true); fireTestPulse(); assertNotFocused(scene, nodes.get(0)); assertNullFocus(scene); --- 282,292 ---- * node in the scene. */ @Test public void testDisable1() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(n()); nodes.get(0).requestFocus(); nodes.get(0).setDisable(true); fireTestPulse(); assertNotFocused(scene, nodes.get(0)); assertNullFocus(scene);
*** 292,302 **** * node in the scene. */ @Test public void testDisable2() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(n(), n()); nodes.get(0).requestFocus(); nodes.get(0).setDisable(true); fireTestPulse(); assertNotFocused(scene, nodes.get(0)); assertIsFocused(scene, nodes.get(1)); --- 297,307 ---- * node in the scene. */ @Test public void testDisable2() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(n(), n()); nodes.get(0).requestFocus(); nodes.get(0).setDisable(true); fireTestPulse(); assertNotFocused(scene, nodes.get(0)); assertIsFocused(scene, nodes.get(1));
*** 308,329 **** @Test public void testAddEligible() { fireTestPulse(); // make sure focus is clean assertNullFocus(scene); scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(n()); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); } /** * When focus null, test making a node traversable. */ @Test public void testBecomeTraversable() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(n(F, T, T), n(F, T, T)); fireTestPulse(); assertNullFocus(scene); toolkit.clearPulseRequested(); assertFalse(toolkit.isPulseRequested()); nodes.get(0).setFocusTraversable(true); --- 313,334 ---- @Test public void testAddEligible() { fireTestPulse(); // make sure focus is clean assertNullFocus(scene); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(n()); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); } /** * When focus null, test making a node traversable. */ @Test public void testBecomeTraversable() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(n(F, T, T), n(F, T, T)); fireTestPulse(); assertNullFocus(scene); toolkit.clearPulseRequested(); assertFalse(toolkit.isPulseRequested()); nodes.get(0).setFocusTraversable(true);
*** 336,346 **** * When focus null, test making a node visible. */ @Test public void testBecomeVisible() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(n(T, F, T)); fireTestPulse(); assertNullFocus(scene); nodes.get(0).setVisible(true); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); --- 341,351 ---- * When focus null, test making a node visible. */ @Test public void testBecomeVisible() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(n(T, F, T)); fireTestPulse(); assertNullFocus(scene); nodes.get(0).setVisible(true); fireTestPulse(); assertIsFocused(scene, nodes.get(0));
*** 350,360 **** * When focus null, test making a node enabled. */ @Test public void testBecomeEnabled() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(n(T, T, F)); fireTestPulse(); assertNullFocus(scene); nodes.get(0).setDisable(false); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); --- 355,365 ---- * When focus null, test making a node enabled. */ @Test public void testBecomeEnabled() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(n(T, T, F)); fireTestPulse(); assertNullFocus(scene); nodes.get(0).setDisable(false); fireTestPulse(); assertIsFocused(scene, nodes.get(0));
*** 364,388 **** * When focus exists, test adding an eligible, traversable node. */ @Test public void testAddEligible2() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(n()); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); ! scene.getRoot().getChildren().add(n()); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); } /** * When focus exists, test making a node traversable. */ @Test public void testBecomeTraversable2() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(n(), n(F, T, T)); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); nodes.get(1).setFocusTraversable(true); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); --- 369,393 ---- * When focus exists, test adding an eligible, traversable node. */ @Test public void testAddEligible2() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(n()); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); ! ParentShim.getChildren(scene.getRoot()).add(n()); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); } /** * When focus exists, test making a node traversable. */ @Test public void testBecomeTraversable2() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(n(), n(F, T, T)); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); nodes.get(1).setFocusTraversable(true); fireTestPulse(); assertIsFocused(scene, nodes.get(0));
*** 392,402 **** * When focus exists, test making a node visible. */ @Test public void testBecomeVisible2() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(n(), n(T, F, T)); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); nodes.get(1).setVisible(true); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); --- 397,407 ---- * When focus exists, test making a node visible. */ @Test public void testBecomeVisible2() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(n(), n(T, F, T)); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); nodes.get(1).setVisible(true); fireTestPulse(); assertIsFocused(scene, nodes.get(0));
*** 406,416 **** * When focus exists, test making a node enabled. */ @Test public void testBecomeEnabled2() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(n(), n(T, T, F)); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); nodes.get(1).setDisable(false); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); --- 411,421 ---- * When focus exists, test making a node enabled. */ @Test public void testBecomeEnabled2() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(n(), n(T, T, F)); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); nodes.get(1).setDisable(false); fireTestPulse(); assertIsFocused(scene, nodes.get(0));
*** 422,435 **** @Test public void testMoveWithinScene() { Group g1 = new Group(n()); Group g2 = new Group(); scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(g1, g2); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); ! g2.getChildren().add(nodes.get(0)); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); } /** --- 427,440 ---- @Test public void testMoveWithinScene() { Group g1 = new Group(n()); Group g2 = new Group(); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(g1, g2); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); ! ParentShim.getChildren(g2).add(nodes.get(0)); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); } /**
*** 440,453 **** public void testMoveIntoInvisible() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setVisible(false); scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(g1, g2); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); ! g2.getChildren().add(nodes.get(0)); fireTestPulse(); assertNullFocus(scene); } /** --- 445,458 ---- public void testMoveIntoInvisible() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setVisible(false); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(g1, g2); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); ! ParentShim.getChildren(g2).add(nodes.get(0)); fireTestPulse(); assertNullFocus(scene); } /**
*** 458,472 **** public void testMoveIntoInvisible2() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setVisible(false); scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(g1, g2, n()); nodes.get(0).requestFocus(); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); ! g2.getChildren().add(nodes.get(0)); fireTestPulse(); assertIsFocused(scene, nodes.get(1)); } /** --- 463,477 ---- public void testMoveIntoInvisible2() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setVisible(false); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(g1, g2, n()); nodes.get(0).requestFocus(); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); ! ParentShim.getChildren(g2).add(nodes.get(0)); fireTestPulse(); assertIsFocused(scene, nodes.get(1)); } /**
*** 477,490 **** public void testMoveIntoDisabled() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setDisable(true); scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(g1, g2); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); ! g2.getChildren().add(nodes.get(0)); fireTestPulse(); assertNullFocus(scene); } /** --- 482,495 ---- public void testMoveIntoDisabled() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setDisable(true); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(g1, g2); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); ! ParentShim.getChildren(g2).add(nodes.get(0)); fireTestPulse(); assertNullFocus(scene); } /**
*** 495,509 **** public void testMoveIntoDisabled2() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setDisable(true); scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(g1, g2, n()); nodes.get(0).requestFocus(); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); ! g2.getChildren().add(nodes.get(0)); fireTestPulse(); assertIsFocused(scene, nodes.get(1)); } /** --- 500,514 ---- public void testMoveIntoDisabled2() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setDisable(true); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(g1, g2, n()); nodes.get(0).requestFocus(); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); ! ParentShim.getChildren(g2).add(nodes.get(0)); fireTestPulse(); assertIsFocused(scene, nodes.get(1)); } /**
*** 514,524 **** public void testMakeParentDisabled() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setVisible(false); scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(g1, g2); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); g1.setDisable(true); fireTestPulse(); assertNotFocused(scene, nodes.get(0)); --- 519,529 ---- public void testMakeParentDisabled() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setVisible(false); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(g1, g2); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); g1.setDisable(true); fireTestPulse(); assertNotFocused(scene, nodes.get(0));
*** 533,543 **** public void testMakeParentDisabled2() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setVisible(false); scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(g1, g2, n()); nodes.get(0).requestFocus(); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); g1.setDisable(true); fireTestPulse(); --- 538,548 ---- public void testMakeParentDisabled2() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setVisible(false); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(g1, g2, n()); nodes.get(0).requestFocus(); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); g1.setDisable(true); fireTestPulse();
*** 553,563 **** public void testMakeParentInvisible() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setVisible(false); scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(g1, g2); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); g1.setVisible(false); fireTestPulse(); assertNotFocused(scene, nodes.get(0)); --- 558,568 ---- public void testMakeParentInvisible() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setVisible(false); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(g1, g2); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); g1.setVisible(false); fireTestPulse(); assertNotFocused(scene, nodes.get(0));
*** 572,582 **** public void testMakeParentInvisible2() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setVisible(false); scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(g1, g2, n()); nodes.get(0).requestFocus(); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); g1.setVisible(false); fireTestPulse(); --- 577,587 ---- public void testMakeParentInvisible2() { Group g1 = new Group(n()); Group g2 = new Group(); g2.setVisible(false); scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(g1, g2, n()); nodes.get(0).requestFocus(); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); g1.setVisible(false); fireTestPulse();
*** 588,598 **** * Focus should not move if stacking order changes. */ @Test public void testToFront() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().addAll(n(), n()); nodes.get(0).requestFocus(); assertIsFocused(scene, nodes.get(0)); assertNotFocused(scene, nodes.get(1)); nodes.get(0).toFront(); assertIsFocused(scene, nodes.get(0)); --- 593,603 ---- * Focus should not move if stacking order changes. */ @Test public void testToFront() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).addAll(n(), n()); nodes.get(0).requestFocus(); assertIsFocused(scene, nodes.get(0)); assertNotFocused(scene, nodes.get(1)); nodes.get(0).toFront(); assertIsFocused(scene, nodes.get(0));
*** 606,620 **** * Test moving focused node into scene which is not in active stage. */ @Test public void testMoveIntoInactiveScene() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(n()); nodes.get(0).requestFocus(); assertIsFocused(scene, nodes.get(0)); Scene scene2 = new Scene(new Group()); ! scene2.getRoot().getChildren().add(nodes.get(0)); fireTestPulse(); assertNullFocus(scene); assertNullFocus(scene2); nodes.get(0).requestFocus(); fireTestPulse(); --- 611,625 ---- * Test moving focused node into scene which is not in active stage. */ @Test public void testMoveIntoInactiveScene() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(n()); nodes.get(0).requestFocus(); assertIsFocused(scene, nodes.get(0)); Scene scene2 = new Scene(new Group()); ! ParentShim.getChildren(scene2.getRoot()).add(nodes.get(0)); fireTestPulse(); assertNullFocus(scene); assertNullFocus(scene2); nodes.get(0).requestFocus(); fireTestPulse();
*** 631,641 **** * Test making stage invisible. */ @Test public void testInvisibleStage() { scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(n()); nodes.get(0).requestFocus(); stage.show(); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); stage.hide(); --- 636,646 ---- * Test making stage invisible. */ @Test public void testInvisibleStage() { scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(n()); nodes.get(0).requestFocus(); stage.show(); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); stage.hide();
*** 650,663 **** * remain the same while focused node should change. */ @Test public void testSwitchScenes(){ scene.setRoot(new Group()); ! scene.getRoot().getChildren().add(n()); nodes.get(0).requestFocus(); Scene scene2 = new Scene(new Group()); ! scene2.getRoot().getChildren().add(n()); nodes.get(1).requestFocus(); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); assertFalse(nodes.get(1).isFocused()); assertEquals(nodes.get(1), scene2.getFocusOwner()); --- 655,668 ---- * remain the same while focused node should change. */ @Test public void testSwitchScenes(){ scene.setRoot(new Group()); ! ParentShim.getChildren(scene.getRoot()).add(n()); nodes.get(0).requestFocus(); Scene scene2 = new Scene(new Group()); ! ParentShim.getChildren(scene2.getRoot()).add(n()); nodes.get(1).requestFocus(); fireTestPulse(); assertIsFocused(scene, nodes.get(0)); assertFalse(nodes.get(1).isFocused()); assertEquals(nodes.get(1), scene2.getFocusOwner());