modules/graphics/src/test/java/test/javafx/scene/layout/FlowPaneTest.java
Print this page
rev 9250 : 8134762: Refactor Javafx graphics module tests for clear separation of tests
Reviewed-by:
@@ -21,20 +21,22 @@
* 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.layout;
+package test.javafx.scene.layout;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.geometry.VPos;
import javafx.scene.Node;
+import javafx.scene.ParentShim;
+import javafx.scene.layout.FlowPane;
import javafx.scene.shape.Rectangle;
import org.junit.Before;
import org.junit.Test;
@@ -78,11 +80,11 @@
@Test public void testSimpleFlowPane() {
for(int i = 0; i < 3; i++) { // 6 children
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
assertEquals(100, flowpane.minWidth(-1), 1e-100);
assertEquals(900, flowpane.minHeight(100), 1e-100);
assertEquals(400, flowpane.prefWidth(-1), 1e-100);
@@ -90,12 +92,12 @@
flowpane.autosize();
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -142,20 +144,20 @@
@Test public void testHorizontalFlowPaneAlignmentTopLeft() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.TOP_LEFT);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -167,20 +169,20 @@
@Test public void testHorizontalFlowPaneAlignmentTopCenter() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.TOP_CENTER);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(25, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -192,20 +194,20 @@
@Test public void testHorizontalFlowPaneAlignmentTopRight() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.TOP_RIGHT);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(50, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -217,20 +219,20 @@
@Test public void testHorizontalFlowPaneAlignmentCenterLeft() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.CENTER_LEFT);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(25, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -242,20 +244,20 @@
@Test public void testHorizontalFlowPaneAlignmentCenter() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.CENTER);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(25, first.getLayoutX(), 1e-100);
assertEquals(25, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -267,20 +269,20 @@
@Test public void testHorizontalFlowPaneAlignmentCenterRight() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.CENTER_RIGHT);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(50, first.getLayoutX(), 1e-100);
assertEquals(25, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -292,20 +294,20 @@
@Test public void testHorizontalFlowPaneAlignmentBottomLeft() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.BOTTOM_LEFT);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(50, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -317,20 +319,20 @@
@Test public void testHorizontalFlowPaneAlignmentBottomCenter() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.BOTTOM_CENTER);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(25, first.getLayoutX(), 1e-100);
assertEquals(50, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -342,20 +344,20 @@
@Test public void testHorizontalFlowPaneAlignmentBottomRight() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.BOTTOM_RIGHT);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(50, first.getLayoutX(), 1e-100);
assertEquals(50, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -369,20 +371,20 @@
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.TOP_LEFT);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(200, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(300, first.getLayoutBounds().getHeight(), 1e-100);
@@ -396,20 +398,20 @@
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.TOP_CENTER);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(50, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(200, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(300, first.getLayoutBounds().getHeight(), 1e-100);
@@ -423,20 +425,20 @@
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.TOP_RIGHT);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(100, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(200, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(300, first.getLayoutBounds().getHeight(), 1e-100);
@@ -450,20 +452,20 @@
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.CENTER_LEFT);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(100, first.getLayoutY(), 1e-100);
assertEquals(200, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(300, first.getLayoutBounds().getHeight(), 1e-100);
@@ -477,20 +479,20 @@
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.CENTER);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(50, first.getLayoutX(), 1e-100);
assertEquals(100, first.getLayoutY(), 1e-100);
assertEquals(200, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(300, first.getLayoutBounds().getHeight(), 1e-100);
@@ -504,20 +506,20 @@
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.CENTER_RIGHT);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(100, first.getLayoutX(), 1e-100);
assertEquals(100, first.getLayoutY(), 1e-100);
assertEquals(200, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(300, first.getLayoutBounds().getHeight(), 1e-100);
@@ -531,20 +533,20 @@
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.BOTTOM_LEFT);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(200, first.getLayoutY(), 1e-100);
assertEquals(200, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(300, first.getLayoutBounds().getHeight(), 1e-100);
@@ -558,20 +560,20 @@
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.BOTTOM_CENTER);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(50, first.getLayoutX(), 1e-100);
assertEquals(200, first.getLayoutY(), 1e-100);
assertEquals(200, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(300, first.getLayoutBounds().getHeight(), 1e-100);
@@ -585,20 +587,20 @@
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.BOTTOM_RIGHT);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(100, first.getLayoutX(), 1e-100);
assertEquals(200, first.getLayoutY(), 1e-100);
assertEquals(200, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(300, first.getLayoutBounds().getHeight(), 1e-100);
@@ -610,20 +612,20 @@
@Test public void testHorizontalFlowPaneRowVAlignmentTop() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setRowValignment(VPos.TOP);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -635,20 +637,20 @@
@Test public void testHorizontalFlowPaneRowVAlignmentCenter() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setRowValignment(VPos.CENTER);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -660,20 +662,20 @@
@Test public void testHorizontalFlowPaneRowVAlignmentBaseline() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200); //baseline=190
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setRowValignment(VPos.BASELINE);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -685,20 +687,20 @@
@Test public void testHorizontalFlowPaneRowVAlignmentBottom() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setRowValignment(VPos.BOTTOM);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(100, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(200, first.getLayoutBounds().getHeight(), 1e-100);
@@ -712,20 +714,20 @@
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setColumnHalignment(HPos.LEFT);
flowpane.resize(600,800);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(200, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(300, first.getLayoutBounds().getHeight(), 1e-100);
@@ -739,20 +741,20 @@
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setColumnHalignment(HPos.CENTER);
flowpane.resize(600,800);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(200, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(300, first.getLayoutBounds().getHeight(), 1e-100);
@@ -766,20 +768,20 @@
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setColumnHalignment(HPos.RIGHT);
flowpane.resize(600,800);
flowpane.layout();
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
assertEquals(0, first.getLayoutX(), 1e-100);
assertEquals(0, first.getLayoutY(), 1e-100);
assertEquals(200, first.getLayoutBounds().getWidth(), 1e-100);
assertEquals(300, first.getLayoutBounds().getHeight(), 1e-100);
@@ -804,16 +806,16 @@
@Test public void testFlowPaneMarginConstraint() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
- flowpane.getChildren().addAll(child1, child2);
+ ParentShim.getChildren(flowpane).addAll(child1, child2);
}
// test a handful
- Node first = flowpane.getChildren().get(0);
- Node last = flowpane.getChildren().get(5);
+ Node first = ParentShim.getChildren(flowpane).get(0);
+ Node last = ParentShim.getChildren(flowpane).get(5);
FlowPane.setMargin(first, new Insets(10,20,30,40));
assertEquals(100, flowpane.minWidth(-1), 1e-100);
assertEquals(940, flowpane.minHeight(100), 1e-100);
@@ -835,11 +837,11 @@
// FlowPane does not shrink their children to be smaller than their preferred sizes
@Test public void testHorizontalFlowPaneFitsChildWithinHeightIfPossible() {
MockResizable child = new MockResizable(10,20, 200,200, 500,500);
- flowpane.getChildren().add(child);
+ ParentShim.getChildren(flowpane).add(child);
flowpane.resize(100,100);
flowpane.layout();
assertEquals(200, child.getWidth(), 1e-100);
@@ -848,11 +850,11 @@
@Test public void testVerticalFlowPaneFitsChildWithinWidthIfPossible() {
flowpane.setOrientation(Orientation.VERTICAL);
MockResizable child = new MockResizable(10,20, 200,200, 500,500);
- flowpane.getChildren().add(child);
+ ParentShim.getChildren(flowpane).add(child);
flowpane.resize(100,100);
System.out.println("******************");
flowpane.layout();
System.out.println("*****************");