modules/graphics/src/test/java/test/javafx/scene/effect/BoxBlurTest.java

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

*** 21,37 **** * 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.effect; import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.Before; import org.junit.Test; public class BoxBlurTest extends EffectsTestBase { private BoxBlur effect; @Before --- 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 test.javafx.scene.effect; + import javafx.scene.effect.BoxBlur; + import javafx.scene.effect.EffectShim; import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.Before; import org.junit.Test; + import test.javafx.scene.effect.EffectsTestBase; public class BoxBlurTest extends EffectsTestBase { private BoxBlur effect; @Before
*** 48,195 **** public void testSetWidth() { // try setting correct value effect.setWidth(1.0f); assertEquals(1.0f, effect.getWidth(), 1e-100); pulse(); ! assertEquals(1, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getHorizontalSize()); } @Test public void testDefaultWidth() { // default value should be 5 assertEquals(5.0f, effect.getWidth(), 1e-100); assertEquals(5.0f, effect.widthProperty().get(), 1e-100); pulse(); ! assertEquals(5, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getHorizontalSize()); } @Test public void testMinWidth() { // 0 should be ok effect.setWidth(0); // try setting value smaller than minimal effect.setWidth(-0.1f); assertEquals(-0.1f, effect.getWidth(), 1e-100); pulse(); ! assertEquals(0, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getHorizontalSize()); } @Test public void testMaxWidth() { // 255 should be ok effect.setWidth(255); // try setting value greater than maximal effect.setWidth(255.1f); assertEquals(255.1f, effect.getWidth(), 1e-100); pulse(); ! assertEquals(255, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getHorizontalSize()); } @Test public void testSetHeight() { // try setting correct value effect.setHeight(1.0f); assertEquals(1.0f, effect.getHeight(), 1e-100); pulse(); ! assertEquals(1, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getVerticalSize()); } @Test public void testDefaultHeight() { // default value should be 5 assertEquals(5.0f, effect.getHeight(), 1e-100); assertEquals(5.0f, effect.heightProperty().get(), 1e-100); pulse(); ! assertEquals(5, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getVerticalSize()); } @Test public void testMinHeight() { // 0 should be ok effect.setHeight(0); // try setting value smaller than minimal effect.setHeight(-0.1f); assertEquals(-0.1f, effect.getHeight(), 1e-100); pulse(); ! assertEquals(0, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getVerticalSize()); } @Test public void testMaxHeight() { // 255 should be ok effect.setHeight(255); // try setting value greater than maximal effect.setHeight(255.1f); assertEquals(255.1f, effect.getHeight(), 1e-100); pulse(); ! assertEquals(255, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getVerticalSize()); } @Test public void testSetIterations() { // try setting correct value effect.setIterations(2); assertEquals(2, effect.getIterations()); pulse(); ! assertEquals(2, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getPasses()); } @Test public void testDefaultIterations() { // default value should be 1 assertEquals(1, effect.getIterations()); assertEquals(1, effect.iterationsProperty().get()); pulse(); ! assertEquals(1, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getPasses()); } @Test public void testMinIterations() { // 0 should be ok effect.setIterations(0); // try setting value smaller than minimal effect.setIterations(-1); assertEquals(-1, effect.getIterations()); pulse(); ! assertEquals(0, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getPasses()); } @Test public void testMaxIterations() { // 3 should be ok effect.setIterations(3); // try setting value greater than maximal effect.setIterations(4); assertEquals(4, effect.getIterations()); pulse(); ! assertEquals(3, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getPasses()); } @Test public void testCreateWithParams() { effect = new BoxBlur(1, 1, 3); setupTest(effect); assertEquals(1, effect.getWidth(), 1e-100); assertEquals(1, effect.getHeight(), 1e-100); assertEquals(3, effect.getIterations()); pulse(); ! assertEquals(1, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getHorizontalSize()); ! assertEquals(1, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getVerticalSize()); ! assertEquals(3, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getPasses()); } @Test public void testCreateWithDefaultParams() { effect = new BoxBlur(5, 5, 1); setupTest(effect); assertEquals(5, effect.getWidth(), 1e-100); assertEquals(5, effect.getHeight(), 1e-100); assertEquals(1, effect.getIterations()); pulse(); ! assertEquals(5, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getHorizontalSize()); ! assertEquals(5, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getVerticalSize()); ! assertEquals(1, ((com.sun.scenario.effect.BoxBlur)effect.impl_getImpl()).getPasses()); } @Test public void testHeightSynced() throws Exception { checkDoublePropertySynced( --- 51,216 ---- public void testSetWidth() { // try setting correct value effect.setWidth(1.0f); assertEquals(1.0f, effect.getWidth(), 1e-100); pulse(); ! assertEquals(1, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getHorizontalSize()); } @Test public void testDefaultWidth() { // default value should be 5 assertEquals(5.0f, effect.getWidth(), 1e-100); assertEquals(5.0f, effect.widthProperty().get(), 1e-100); pulse(); ! assertEquals(5, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getHorizontalSize()); } @Test public void testMinWidth() { // 0 should be ok effect.setWidth(0); // try setting value smaller than minimal effect.setWidth(-0.1f); assertEquals(-0.1f, effect.getWidth(), 1e-100); pulse(); ! assertEquals(0, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getHorizontalSize()); } @Test public void testMaxWidth() { // 255 should be ok effect.setWidth(255); // try setting value greater than maximal effect.setWidth(255.1f); assertEquals(255.1f, effect.getWidth(), 1e-100); pulse(); ! assertEquals(255, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getHorizontalSize()); } @Test public void testSetHeight() { // try setting correct value effect.setHeight(1.0f); assertEquals(1.0f, effect.getHeight(), 1e-100); pulse(); ! assertEquals(1, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getVerticalSize()); } @Test public void testDefaultHeight() { // default value should be 5 assertEquals(5.0f, effect.getHeight(), 1e-100); assertEquals(5.0f, effect.heightProperty().get(), 1e-100); pulse(); ! assertEquals(5, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getVerticalSize()); } @Test public void testMinHeight() { // 0 should be ok effect.setHeight(0); // try setting value smaller than minimal effect.setHeight(-0.1f); assertEquals(-0.1f, effect.getHeight(), 1e-100); pulse(); ! assertEquals(0, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getVerticalSize()); } @Test public void testMaxHeight() { // 255 should be ok effect.setHeight(255); // try setting value greater than maximal effect.setHeight(255.1f); assertEquals(255.1f, effect.getHeight(), 1e-100); pulse(); ! assertEquals(255, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getVerticalSize()); } @Test public void testSetIterations() { // try setting correct value effect.setIterations(2); assertEquals(2, effect.getIterations()); pulse(); ! assertEquals(2, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getPasses()); } @Test public void testDefaultIterations() { // default value should be 1 assertEquals(1, effect.getIterations()); assertEquals(1, effect.iterationsProperty().get()); pulse(); ! assertEquals(1, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getPasses()); } @Test public void testMinIterations() { // 0 should be ok effect.setIterations(0); // try setting value smaller than minimal effect.setIterations(-1); assertEquals(-1, effect.getIterations()); pulse(); ! assertEquals(0, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getPasses()); } @Test public void testMaxIterations() { // 3 should be ok effect.setIterations(3); // try setting value greater than maximal effect.setIterations(4); assertEquals(4, effect.getIterations()); pulse(); ! assertEquals(3, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getPasses()); } @Test public void testCreateWithParams() { effect = new BoxBlur(1, 1, 3); setupTest(effect); assertEquals(1, effect.getWidth(), 1e-100); assertEquals(1, effect.getHeight(), 1e-100); assertEquals(3, effect.getIterations()); pulse(); ! assertEquals(1, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getHorizontalSize()); ! assertEquals(1, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getVerticalSize()); ! assertEquals(3, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getPasses()); } @Test public void testCreateWithDefaultParams() { effect = new BoxBlur(5, 5, 1); setupTest(effect); assertEquals(5, effect.getWidth(), 1e-100); assertEquals(5, effect.getHeight(), 1e-100); assertEquals(1, effect.getIterations()); pulse(); ! assertEquals(5, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getHorizontalSize()); ! assertEquals(5, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getVerticalSize()); ! assertEquals(1, ((com.sun.scenario.effect.BoxBlur) ! EffectShim.impl_getImpl(effect)).getPasses()); } @Test public void testHeightSynced() throws Exception { checkDoublePropertySynced(