modules/graphics/src/test/java/test/javafx/scene/effect/BloomTest.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 com.sun.javafx.test.TestHelper.box; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; public class BloomTest extends EffectsTestBase { private Bloom effect; @Before --- 21,41 ---- * 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.Bloom; ! import javafx.scene.effect.BoxBlur; ! import javafx.scene.effect.EffectShim; ! import static test.com.sun.javafx.test.TestHelper.box; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; + import test.javafx.scene.effect.EffectsTestBase; public class BloomTest extends EffectsTestBase { private Bloom effect; @Before
*** 44,85 **** public void testSetThreshold() { // try setting correct value effect.setThreshold(1.0f); assertEquals(1.0f, (float) effect.getThreshold(), 1e-100); pulse(); ! assertEquals(1.0f, (float) ((com.sun.scenario.effect.Bloom)effect.impl_getImpl()).getThreshold(), 1e-100); } @Test public void testDefaultThreshold() { // default value should be 0.3 assertEquals(0.3f, (float) effect.getThreshold(), 1e-100); assertEquals(0.3f, (float) effect.thresholdProperty().get(), 1e-100); pulse(); ! assertEquals(0.3f, (float) ((com.sun.scenario.effect.Bloom)effect.impl_getImpl()).getThreshold(), 1e-100); } @Test public void testMinThreshold() { // 0 should be ok effect.setThreshold(0); // try setting value smaller than minimal effect.setThreshold(-0.1f); assertEquals(-0.1f, (float) effect.getThreshold(), 1e-100); pulse(); ! assertEquals(0.0f, (float) ((com.sun.scenario.effect.Bloom)effect.impl_getImpl()).getThreshold(), 1e-100); } @Test public void testMaxThreshold() { // 1 should be ok effect.setThreshold(1); // try setting value greater than maximal effect.setThreshold(1.1f); assertEquals(1.1f, (float) effect.getThreshold(), 1e-100); pulse(); ! assertEquals(1.0f, (float) ((com.sun.scenario.effect.Bloom)effect.impl_getImpl()).getThreshold(), 1e-100); } @Test public void testThresholdSynced() throws Exception { checkDoublePropertySynced( --- 48,93 ---- public void testSetThreshold() { // try setting correct value effect.setThreshold(1.0f); assertEquals(1.0f, (float) effect.getThreshold(), 1e-100); pulse(); ! assertEquals(1.0f, (float) ((com.sun.scenario.effect.Bloom) ! EffectShim.impl_getImpl(effect)).getThreshold(), 1e-100); } @Test public void testDefaultThreshold() { // default value should be 0.3 assertEquals(0.3f, (float) effect.getThreshold(), 1e-100); assertEquals(0.3f, (float) effect.thresholdProperty().get(), 1e-100); pulse(); ! assertEquals(0.3f, (float) ((com.sun.scenario.effect.Bloom) ! EffectShim.impl_getImpl(effect)).getThreshold(), 1e-100); } @Test public void testMinThreshold() { // 0 should be ok effect.setThreshold(0); // try setting value smaller than minimal effect.setThreshold(-0.1f); assertEquals(-0.1f, (float) effect.getThreshold(), 1e-100); pulse(); ! assertEquals(0.0f, (float) ((com.sun.scenario.effect.Bloom) ! EffectShim.impl_getImpl(effect)).getThreshold(), 1e-100); } @Test public void testMaxThreshold() { // 1 should be ok effect.setThreshold(1); // try setting value greater than maximal effect.setThreshold(1.1f); assertEquals(1.1f, (float) effect.getThreshold(), 1e-100); pulse(); ! assertEquals(1.0f, (float) ((com.sun.scenario.effect.Bloom) ! EffectShim.impl_getImpl(effect)).getThreshold(), 1e-100); } @Test public void testThresholdSynced() throws Exception { checkDoublePropertySynced(
*** 91,101 **** public void testInputSynced() throws Exception { BoxBlur blur = new BoxBlur(); checkEffectPropertySynced( "javafx.scene.effect.Bloom", "input", "com.sun.scenario.effect.Bloom", "input", ! blur, (com.sun.scenario.effect.BoxBlur)blur.impl_getImpl()); } @Test public void testBounds() { assertEquals(box(0, 0, 100, 100), n.getBoundsInLocal()); --- 99,110 ---- public void testInputSynced() throws Exception { BoxBlur blur = new BoxBlur(); checkEffectPropertySynced( "javafx.scene.effect.Bloom", "input", "com.sun.scenario.effect.Bloom", "input", ! blur, ! (com.sun.scenario.effect.BoxBlur) EffectShim.impl_getImpl(blur)); } @Test public void testBounds() { assertEquals(box(0, 0, 100, 100), n.getBoundsInLocal());
*** 113,129 **** public void testCreateWithParams() { effect = new Bloom(1); setupTest(effect); assertEquals(1, effect.getThreshold(), 1e-100); pulse(); ! assertEquals(1.0f, ((com.sun.scenario.effect.Bloom) effect.impl_getImpl()).getThreshold(), 1e-100); } @Test public void testCreateWithDefaultParams() { effect = new Bloom(0.3); setupTest(effect); assertEquals(0.3, effect.getThreshold(), 1e-100); pulse(); ! assertEquals(0.3f, ((com.sun.scenario.effect.Bloom) effect.impl_getImpl()).getThreshold(), 1e-100); } } --- 122,140 ---- public void testCreateWithParams() { effect = new Bloom(1); setupTest(effect); assertEquals(1, effect.getThreshold(), 1e-100); pulse(); ! assertEquals(1.0f, ((com.sun.scenario.effect.Bloom) ! EffectShim.impl_getImpl(effect)).getThreshold(), 1e-100); } @Test public void testCreateWithDefaultParams() { effect = new Bloom(0.3); setupTest(effect); assertEquals(0.3, effect.getThreshold(), 1e-100); pulse(); ! assertEquals(0.3f, ((com.sun.scenario.effect.Bloom) ! EffectShim.impl_getImpl(effect)).getThreshold(), 1e-100); } }