modules/graphics/src/test/java/test/javafx/scene/PaneTest.java
Print this page
rev 9250 : 8134762: Refactor Javafx graphics module tests for clear separation of tests
Reviewed-by:
*** 20,32 ****
*
* 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 javafx.scene.layout.MockRegion;
import javafx.scene.layout.Pane;
import javafx.scene.shape.Rectangle;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
--- 20,34 ----
*
* 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 javafx.scene.Node;
! import javafx.scene.ParentShim;
! import test.javafx.scene.layout.MockRegion;
import javafx.scene.layout.Pane;
import javafx.scene.shape.Rectangle;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
*** 35,67 ****
@Test
public void testPrefWidthWithResizableChild() {
Pane pane = new Pane();
! javafx.scene.layout.MockRegion region = new javafx.scene.layout.MockRegion(100,150);
! pane.getChildren().add(region);
pane.layout();
assertEquals(100, pane.prefWidth(-1), 0);
}
@Test
public void testPrefHeightWithResizableChild() {
Pane pane = new Pane();
! javafx.scene.layout.MockRegion region = new javafx.scene.layout.MockRegion(100,150);
! pane.getChildren().add(region);
pane.layout();
assertEquals(150, pane.prefHeight(-1), 0);
}
@Test
public void testMinAndPreferredSizes() {
Pane pane = new Pane();
Rectangle rect = new Rectangle(50,50);
! pane.getChildren().add(rect);
rect.relocate(0, 0);
pane.layout();
--- 37,69 ----
@Test
public void testPrefWidthWithResizableChild() {
Pane pane = new Pane();
! test.javafx.scene.layout.MockRegion region = new test.javafx.scene.layout.MockRegion(100,150);
! ParentShim.getChildren(pane).add(region);
pane.layout();
assertEquals(100, pane.prefWidth(-1), 0);
}
@Test
public void testPrefHeightWithResizableChild() {
Pane pane = new Pane();
! test.javafx.scene.layout.MockRegion region = new test.javafx.scene.layout.MockRegion(100,150);
! ParentShim.getChildren(pane).add(region);
pane.layout();
assertEquals(150, pane.prefHeight(-1), 0);
}
@Test
public void testMinAndPreferredSizes() {
Pane pane = new Pane();
Rectangle rect = new Rectangle(50,50);
! ParentShim.getChildren(pane).add(rect);
rect.relocate(0, 0);
pane.layout();
*** 92,102 ****
Node n1 = new MockRegion(100, 100, 10, 10, 1000, 1000);
n1.relocate(10, 0);
Node n2 = new MockRegion(0, 0, 200, 200, 100, 100);
n2.relocate(0, 20);
! pane.getChildren().addAll(n1, n2);
pane.layout();
assertEquals(110, pane.prefWidth(-1), 1e-100);
assertEquals(120, pane.prefHeight(-1), 1e-100);
--- 94,104 ----
Node n1 = new MockRegion(100, 100, 10, 10, 1000, 1000);
n1.relocate(10, 0);
Node n2 = new MockRegion(0, 0, 200, 200, 100, 100);
n2.relocate(0, 20);
! ParentShim.getChildren(pane).addAll(n1, n2);
pane.layout();
assertEquals(110, pane.prefWidth(-1), 1e-100);
assertEquals(120, pane.prefHeight(-1), 1e-100);