@Test public void testPrefWidthNegativeTreatedAsZero() { Region region = new Region(); region.setPrefWidth(-10); assertEquals(0, region.prefWidth(-1), 0); assertEquals(0, region.prefWidth(5), 0); }
@Test public void testPrefWidthNaNTreatedAsZero() { Region region = new Region(); region.setPrefWidth(Double.NaN); assertEquals(0, region.prefWidth(-1), 0); assertEquals(0, region.prefWidth(5), 0); }
@Test public void testPrefWidthOverride() { Region region = new MockRegion(10, 20, 100, 200, 500, 600); assertEquals(100, region.prefWidth(-1), 1e-100); region.setPrefWidth(150.0); assertEquals(150, region.getPrefWidth(), 1e-100); assertEquals(150, region.prefWidth(-1), 1e-100); }
@Test public void testPrefWidthOverrideThenRestoreComputedSize() { Region region = new MockRegion(10, 20, 100, 200, 500, 600); region.setPrefWidth(150.0); region.setPrefWidth(Region.USE_COMPUTED_SIZE); // reset assertEquals(Region.USE_COMPUTED_SIZE, region.getPrefWidth(), 1e-100); assertEquals(100, region.prefWidth(-1), 1e-100); }