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,40 ****
* 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;
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.shape.Rectangle;
import org.junit.Before;
import org.junit.Test;
--- 21,42 ----
* 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.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,88 ****
@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);
}
assertEquals(100, flowpane.minWidth(-1), 1e-100);
assertEquals(900, flowpane.minHeight(100), 1e-100);
assertEquals(400, flowpane.prefWidth(-1), 1e-100);
--- 80,90 ----
@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);
! 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,101 ****
flowpane.autosize();
flowpane.layout();
// test a handful
! Node first = flowpane.getChildren().get(0);
! Node last = flowpane.getChildren().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);
--- 92,103 ----
flowpane.autosize();
flowpane.layout();
// test a handful
! 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,161 ****
@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);
}
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);
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);
--- 144,163 ----
@Test public void testHorizontalFlowPaneAlignmentTopLeft() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.TOP_LEFT);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,186 ****
@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);
}
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);
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);
--- 169,188 ----
@Test public void testHorizontalFlowPaneAlignmentTopCenter() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.TOP_CENTER);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,211 ****
@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);
}
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);
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);
--- 194,213 ----
@Test public void testHorizontalFlowPaneAlignmentTopRight() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.TOP_RIGHT);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,236 ****
@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);
}
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);
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);
--- 219,238 ----
@Test public void testHorizontalFlowPaneAlignmentCenterLeft() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.CENTER_LEFT);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,261 ****
@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);
}
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);
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);
--- 244,263 ----
@Test public void testHorizontalFlowPaneAlignmentCenter() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.CENTER);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,286 ****
@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);
}
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);
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);
--- 269,288 ----
@Test public void testHorizontalFlowPaneAlignmentCenterRight() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.CENTER_RIGHT);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,311 ****
@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);
}
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);
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);
--- 294,313 ----
@Test public void testHorizontalFlowPaneAlignmentBottomLeft() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.BOTTOM_LEFT);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,336 ****
@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);
}
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);
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);
--- 319,338 ----
@Test public void testHorizontalFlowPaneAlignmentBottomCenter() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.BOTTOM_CENTER);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,361 ****
@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);
}
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);
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);
--- 344,363 ----
@Test public void testHorizontalFlowPaneAlignmentBottomRight() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.BOTTOM_RIGHT);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,388 ****
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);
}
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);
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);
--- 371,390 ----
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.TOP_LEFT);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
! 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,415 ****
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);
}
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);
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);
--- 398,417 ----
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.TOP_CENTER);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
! 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,442 ****
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);
}
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);
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);
--- 425,444 ----
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.TOP_RIGHT);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
! 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,469 ****
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);
}
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);
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);
--- 452,471 ----
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.CENTER_LEFT);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
! 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,496 ****
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);
}
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);
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);
--- 479,498 ----
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.CENTER);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
! 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,523 ****
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);
}
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);
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);
--- 506,525 ----
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.CENTER_RIGHT);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
! 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,550 ****
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);
}
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);
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);
--- 533,552 ----
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.BOTTOM_LEFT);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
! 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,577 ****
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);
}
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);
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);
--- 560,579 ----
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.BOTTOM_CENTER);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
! 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,604 ****
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);
}
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);
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);
--- 587,606 ----
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setAlignment(Pos.BOTTOM_RIGHT);
flowpane.resize(700,600);
flowpane.layout();
// test a handful
! 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,629 ****
@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);
}
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);
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);
--- 612,631 ----
@Test public void testHorizontalFlowPaneRowVAlignmentTop() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setRowValignment(VPos.TOP);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,654 ****
@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);
}
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);
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);
--- 637,656 ----
@Test public void testHorizontalFlowPaneRowVAlignmentCenter() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setRowValignment(VPos.CENTER);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,679 ****
@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);
}
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);
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);
--- 662,681 ----
@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);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setRowValignment(VPos.BASELINE);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,704 ****
@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);
}
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);
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);
--- 687,706 ----
@Test public void testHorizontalFlowPaneRowVAlignmentBottom() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setRowValignment(VPos.BOTTOM);
flowpane.resize(450,450);
flowpane.layout();
// test a handful
! 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,731 ****
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);
}
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);
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);
--- 714,733 ----
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setColumnHalignment(HPos.LEFT);
flowpane.resize(600,800);
flowpane.layout();
// test a handful
! 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,758 ****
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);
}
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);
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);
--- 741,760 ----
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setColumnHalignment(HPos.CENTER);
flowpane.resize(600,800);
flowpane.layout();
// test a handful
! 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,785 ****
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);
}
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);
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);
--- 768,787 ----
flowpane.setOrientation(Orientation.VERTICAL);
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(200,300);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
flowpane.setColumnHalignment(HPos.RIGHT);
flowpane.resize(600,800);
flowpane.layout();
// test a handful
! 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,819 ****
@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);
}
// test a handful
! Node first = flowpane.getChildren().get(0);
! Node last = flowpane.getChildren().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);
--- 806,821 ----
@Test public void testFlowPaneMarginConstraint() {
for(int i = 0; i < 3; i++) {
MockResizable child1 = new MockResizable(100,200);
Rectangle child2 = new Rectangle(100, 100);
! ParentShim.getChildren(flowpane).addAll(child1, child2);
}
// test a handful
! 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,845 ****
// 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);
flowpane.resize(100,100);
flowpane.layout();
assertEquals(200, child.getWidth(), 1e-100);
--- 837,847 ----
// 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);
! ParentShim.getChildren(flowpane).add(child);
flowpane.resize(100,100);
flowpane.layout();
assertEquals(200, child.getWidth(), 1e-100);
*** 848,858 ****
@Test public void testVerticalFlowPaneFitsChildWithinWidthIfPossible() {
flowpane.setOrientation(Orientation.VERTICAL);
MockResizable child = new MockResizable(10,20, 200,200, 500,500);
! flowpane.getChildren().add(child);
flowpane.resize(100,100);
System.out.println("******************");
flowpane.layout();
System.out.println("*****************");
--- 850,860 ----
@Test public void testVerticalFlowPaneFitsChildWithinWidthIfPossible() {
flowpane.setOrientation(Orientation.VERTICAL);
MockResizable child = new MockResizable(10,20, 200,200, 500,500);
! ParentShim.getChildren(flowpane).add(child);
flowpane.resize(100,100);
System.out.println("******************");
flowpane.layout();
System.out.println("*****************");