1 /*
   2  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.scene.effect;
  27 
  28 import static com.sun.javafx.test.TestHelper.box;
  29 import static org.junit.Assert.assertEquals;
  30 import static org.junit.Assert.assertNull;
  31 
  32 import com.sun.javafx.FXUnit;
  33 import javafx.beans.property.DoubleProperty;
  34 import javafx.beans.property.SimpleDoubleProperty;
  35 import javafx.scene.paint.Color;
  36 
  37 import org.junit.Before;
  38 import org.junit.Rule;
  39 import org.junit.Test;
  40 
  41 import com.sun.scenario.effect.AbstractShadow.ShadowMode;
  42 import com.sun.scenario.effect.Color4f;
  43 
  44 public class InnerShadowTest extends EffectsTestBase {
  45 
  46     @Rule
  47     public FXUnit fx = new FXUnit();
  48 
  49     private InnerShadow effect;
  50     private static final Color4f red =  new Color4f(
  51                 (float) Color.RED.getRed(),
  52                 (float) Color.RED.getGreen(),
  53                 (float) Color.RED.getBlue(),
  54                 (float) Color.RED.getOpacity()
  55                 );
  56     private static final Color4f black =  new Color4f(
  57                 (float) Color.BLACK.getRed(),
  58                 (float) Color.BLACK.getGreen(),
  59                 (float) Color.BLACK.getBlue(),
  60                 (float) Color.BLACK.getOpacity()
  61                 );
  62 
  63     @Before
  64     public void setUp() {
  65         effect = new InnerShadow();
  66         setupTest(effect);
  67     }
  68 
  69     @Test
  70     public void testSetBlurType() {
  71         // try setting correct value
  72         effect.setBlurType(BlurType.ONE_PASS_BOX);
  73         assertEquals(BlurType.ONE_PASS_BOX, effect.getBlurType());
  74         pulse();
  75         assertEquals(ShadowMode.ONE_PASS_BOX, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getShadowMode());
  76 
  77         effect.setBlurType(BlurType.TWO_PASS_BOX);
  78         assertEquals(BlurType.TWO_PASS_BOX, effect.getBlurType());
  79         pulse();
  80         assertEquals(ShadowMode.TWO_PASS_BOX, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getShadowMode());
  81 
  82         effect.setBlurType(BlurType.THREE_PASS_BOX);
  83         assertEquals(BlurType.THREE_PASS_BOX, effect.getBlurType());
  84         pulse();
  85         assertEquals(ShadowMode.THREE_PASS_BOX, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getShadowMode());
  86 
  87         effect.setBlurType(BlurType.GAUSSIAN);
  88         assertEquals(BlurType.GAUSSIAN, effect.getBlurType());
  89         pulse();
  90         assertEquals(ShadowMode.GAUSSIAN, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getShadowMode());
  91     }
  92 
  93     @Test
  94     public void testDefaultBlurType() {
  95         // default value should be BlurType.THREE_PASS_BOX
  96         assertEquals(BlurType.THREE_PASS_BOX, effect.getBlurType());
  97         assertEquals(BlurType.THREE_PASS_BOX, effect.blurTypeProperty().get());
  98         pulse();
  99         assertEquals(ShadowMode.THREE_PASS_BOX, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getShadowMode());
 100     }
 101 
 102     @Test
 103     public void testNullBlurType() {
 104         // null should default to BlurType.THREE_PASS_BOX in render tree
 105         effect.setBlurType(null);
 106         assertNull(effect.getBlurType());
 107         assertNull(effect.blurTypeProperty().get());
 108         pulse();
 109         assertEquals(ShadowMode.THREE_PASS_BOX, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getShadowMode());
 110     }
 111 
 112     @Test
 113     public void testSetColor() {
 114         // try setting correct value
 115         effect.setColor(Color.RED);
 116         assertEquals(Color.RED, effect.getColor());
 117         pulse();
 118         Color4f actual = ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getColor();
 119         assertColor4fEquals(red, actual);
 120     }
 121 
 122     @Test
 123     public void testDefaultColor() {
 124         // default value should be Color.BLACK
 125         assertEquals(Color.BLACK, effect.getColor());
 126         assertEquals(Color.BLACK, effect.colorProperty().get());
 127         pulse();
 128         Color4f actual = ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getColor();
 129         assertColor4fEquals(black, actual);
 130     }
 131 
 132     @Test
 133     public void testNullColor() {
 134         // null color should default to Color.BLACK in render tree
 135         effect.setColor(null);
 136         assertNull(effect.getColor());
 137         assertNull(effect.colorProperty().get());
 138         pulse();
 139         Color color = Color.BLACK;
 140         Color4f black = new Color4f((float) color.getRed(), (float) color.getGreen(),
 141                 (float) color.getBlue(), (float) color.getOpacity());
 142         Color4f actual = ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getColor();
 143         assertColor4fEquals(black, actual);
 144     }
 145 
 146     @Test
 147     public void testSetWidth() {
 148         // try setting correct value
 149         effect.setWidth(9.0f);
 150         assertEquals(9.0f, effect.getWidth(), 1e-100);
 151         pulse();
 152         assertEquals(9.0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 153         // test that radius changed appropriately
 154         // radius = (((width + height)/2) -1) /2
 155         assertEquals(7.0f, effect.getRadius(), 1e-100);
 156     }
 157 
 158     @Test
 159     public void testDefaultWidth() {
 160         // default value should be 21
 161         assertEquals(21f, effect.getWidth(), 1e-100);
 162         assertEquals(21f, effect.widthProperty().get(), 1e-100);
 163         pulse();
 164         assertEquals(21f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 165     }
 166 
 167     @Test
 168     public void testMinWidth() {
 169         // 0 should be ok
 170         effect.setWidth(0);
 171         // try setting value smaller than minimal
 172         effect.setWidth(-0.1f);
 173         assertEquals(-0.1f, effect.getWidth(), 1e-100);
 174         pulse();
 175         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);        
 176     }
 177 
 178     @Test
 179     public void testMaxWidth() {
 180         // 255 should be ok
 181         effect.setWidth(255);
 182         // try setting value greater than maximal
 183         effect.setWidth(255.1f);
 184         assertEquals(255.1f, effect.getWidth(), 1e-100);
 185         pulse();
 186         assertEquals(255f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);              
 187     }
 188 
 189     @Test
 190     public void testSetHeight() {
 191         // try setting correct value
 192         effect.setHeight(9.0f);
 193         assertEquals(9.0f, effect.getHeight(), 1e-100);
 194         pulse();
 195         assertEquals(9.0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 196         // check that radius changed appropriately
 197         // radius = (((width + height)/2) -1) /2        
 198         assertEquals(7.0f, effect.getRadius(), 1e-100);
 199     }
 200 
 201     @Test
 202     public void testDefaultHeight() {
 203         // default value should be 21
 204         assertEquals(21f, effect.getHeight(), 1e-100);
 205         assertEquals(21f, effect.heightProperty().get(), 1e-100);
 206         pulse();
 207         assertEquals(21f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 208     }
 209 
 210     @Test
 211     public void testMinHeight() {
 212         // 0 should be ok
 213         effect.setHeight(0);
 214         // try setting value smaller than minimal
 215         effect.setHeight(-0.1f);
 216         assertEquals(-0.1f, effect.getHeight(), 1e-100);
 217         pulse();
 218         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);       
 219     }
 220 
 221     @Test
 222     public void testMaxHeight() {
 223         // 255 should be ok
 224         effect.setHeight(1);
 225         // try setting value greater than maximal
 226         effect.setHeight(255.1f);
 227         assertEquals(255.1f, effect.getHeight(), 1e-100);
 228         pulse();
 229         assertEquals(255f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);               
 230     }
 231 
 232     @Test
 233     public void testSetRadius() {
 234         // try setting correct value
 235         effect.setRadius(4.0f);
 236         assertEquals(4.0f, effect.getRadius(), 1e-100);
 237         pulse();
 238         assertEquals(4.0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getRadius(), 1e-100);
 239         // test that width and height changed appropriately
 240         assertEquals(9.0f, effect.getHeight(), 1e-100);
 241         assertEquals(9.0f, effect.getWidth(), 1e-100);
 242     }
 243 
 244     @Test
 245     public void testDefaultRadius() {
 246         // default value should be 10
 247         assertEquals(10f, effect.getRadius(), 1e-100);
 248         assertEquals(10f, effect.radiusProperty().get(), 1e-100);
 249         pulse();
 250         assertEquals(10f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getRadius(), 1e-100);
 251     }
 252 
 253     @Test
 254     public void testMinRadius() {
 255         // 0 should be ok
 256         effect.setRadius(0);
 257         // try setting value smaller than minimal
 258         effect.setRadius(-0.1f);
 259         assertEquals(-0.1f, effect.getRadius(), 1e-100);
 260         pulse();
 261         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getRadius(), 1e-100);        
 262     }
 263 
 264     @Test
 265     public void testMaxRadius() {
 266         // 127 should be ok
 267         effect.setRadius(127);
 268         // try setting value greater than maximal
 269         effect.setRadius(127.1f);
 270         assertEquals(127.1f, effect.getRadius(), 1e-100);
 271         pulse();
 272         assertEquals(127f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getRadius(), 1e-100);                
 273     }
 274 
 275     @Test
 276     public void testRadiusNotNegative() {
 277         effect.setHeight(0.1f);
 278         effect.setWidth(0.1f);
 279         // radius should be 0, not negative
 280         assertEquals(0f, effect.getRadius(), 1e-100);
 281         pulse();
 282         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getRadius(), 1e-100);
 283 
 284         effect.setWidth(0.2f);
 285         effect.setHeight(0.2f);
 286         // radius should be 0, not negative
 287         assertEquals(0f, effect.getRadius(), 1e-100);
 288         pulse();
 289         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getRadius(), 1e-100);
 290     }
 291 
 292     @Test
 293     public void testSetChoke() {
 294         // try setting correct value
 295         effect.setChoke(1.0f);
 296         assertEquals(1.0f, effect.getChoke(), 1e-100);
 297         pulse();
 298         assertEquals(1.0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getChoke(), 1e-100);
 299     }
 300 
 301     @Test
 302     public void testDefaultChoke() {
 303         // default value should be 0
 304         assertEquals(0f, effect.getChoke(), 1e-100);
 305         assertEquals(0f, effect.chokeProperty().get(), 1e-100);
 306         pulse();
 307         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getChoke(), 1e-100);
 308     }
 309 
 310     @Test
 311     public void testMinChoke() {
 312         // 0 should be ok
 313         effect.setChoke(0);
 314         // try setting value smaller than minimal
 315         effect.setChoke(-0.1f);
 316         assertEquals(-0.1f, effect.getChoke(), 1e-100);
 317         pulse();
 318         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getChoke(), 1e-100);        
 319     }
 320 
 321     @Test
 322     public void testMaxChoke() {
 323         // 1 should be ok
 324         effect.setChoke(1);
 325         // try setting value greater than maximal
 326         effect.setChoke(1.1f);
 327         assertEquals(1.1f, effect.getChoke(), 1e-100);
 328         pulse();
 329         assertEquals(1f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getChoke(), 1e-100);
 330    }
 331 
 332     @Test
 333     public void testSetOffsetX() {
 334         // try setting correct value
 335         effect.setOffsetX(1.0f);
 336         assertEquals(1.0f, effect.getOffsetX(), 1e-100);
 337         pulse();
 338         assertEquals(1.0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getOffsetX(), 1e-100);
 339     }
 340 
 341     @Test
 342     public void testDefaultOffsetX() {
 343         // default value should be 0
 344         assertEquals(0f, effect.getOffsetX(), 1e-100);
 345         assertEquals(0f, effect.offsetXProperty().get(), 1e-100);
 346         pulse();
 347         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getOffsetX(), 1e-100);
 348     }
 349 
 350     @Test
 351     public void testSetOffsetY() {
 352         // try setting correct value
 353         effect.setOffsetY(1.0f);
 354         assertEquals(1.0f, effect.getOffsetY(), 1e-100);
 355         pulse();
 356         assertEquals(1.0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getOffsetY(), 1e-100);
 357     }
 358 
 359     @Test
 360     public void testDefaultOffsetY() {
 361         // default value should be 0
 362         assertEquals(0f, effect.getOffsetY(), 1e-100);
 363         assertEquals(0f, effect.offsetYProperty().get(), 1e-100);
 364         pulse();
 365         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getOffsetY(), 1e-100);
 366     }
 367 
 368     @Test
 369     public void testCreateWithParams2() {
 370         effect = new InnerShadow(4, Color.RED);
 371         setEffect(effect);
 372         assertEquals(4, effect.getRadius(), 1e-100);
 373         assertEquals(Color.RED, effect.getColor());
 374         // test that width and height changed appropriately
 375         assertEquals(9, effect.getHeight(), 1e-100);
 376         assertEquals(9, effect.getWidth(), 1e-100);
 377 
 378         pulse();
 379         assertEquals(4, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getRadius(), 1e-100);
 380         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 381         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 382         Color4f actual = ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getColor();
 383         assertColor4fEquals(red, actual);
 384     }
 385 
 386     @Test
 387     public void testCreateWithParams4() {
 388         effect = new InnerShadow(4, 1, 1, Color.RED);
 389         setEffect(effect);
 390         assertEquals(4, effect.getRadius(), 1e-100);
 391         assertEquals(1, effect.getOffsetX(), 1e-100);
 392         assertEquals(1, effect.getOffsetY(), 1e-100);
 393         assertEquals(Color.RED, effect.getColor());
 394 
 395         // test that width and height changed appropriately
 396         assertEquals(9, effect.getHeight(), 1e-100);
 397         assertEquals(9, effect.getWidth(), 1e-100);
 398 
 399         pulse();
 400         
 401         assertEquals(4, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getRadius(), 1e-100);
 402         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 403         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 404         assertEquals(1, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getOffsetX(), 1e-100);
 405         assertEquals(1, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getOffsetY(), 1e-100);
 406 
 407         Color4f actual = ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getColor();
 408         assertColor4fEquals(red, actual);
 409     }
 410     
 411     @Test
 412     public void testCreateWithParams6() {
 413         effect = new InnerShadow(BlurType.GAUSSIAN, Color.RED, 4, 0.5, 1, 2);
 414         setupTest(effect);
 415         assertEquals(1, effect.getOffsetX(), 1e-100);
 416         assertEquals(2, effect.getOffsetY(), 1e-100);
 417         assertEquals(4, effect.getRadius(), 1e-100);
 418         assertEquals(0.5, effect.getChoke(), 1e-100);
 419         assertEquals(Color.RED, effect.getColor());
 420         assertEquals(BlurType.GAUSSIAN, effect.getBlurType());
 421         // test that width and height changed appropriately
 422         assertEquals(9, effect.getHeight(), 1e-100);
 423         assertEquals(9, effect.getWidth(), 1e-100);
 424         pulse();
 425         assertEquals(4f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianRadius(), 1e-100);
 426         assertEquals(0.5f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getChoke(), 1e-100);
 427         assertEquals(1f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getOffsetX(), 1e-100);
 428         assertEquals(2f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getOffsetY(), 1e-100);
 429         assertEquals(ShadowMode.GAUSSIAN, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getShadowMode());
 430         Color4f actual = ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getColor();
 431         assertColor4fEquals(red, actual);
 432     }
 433 
 434     @Test
 435     public void testCreateWithDefaultParams2() {
 436         effect = new InnerShadow(10, Color.BLACK);
 437         setEffect(effect);
 438         assertEquals(10, effect.getRadius(), 1e-100);
 439         assertEquals(Color.BLACK, effect.getColor());
 440         // test that width and height changed appropriately
 441         assertEquals(21, effect.getHeight(), 1e-100);
 442         assertEquals(21, effect.getWidth(), 1e-100);
 443 
 444         pulse();
 445         assertEquals(10f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getRadius(), 1e-100);
 446         assertEquals(21f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 447         assertEquals(21f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 448         Color4f actual = ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getColor();
 449         assertColor4fEquals(black, actual);
 450     }
 451 
 452     @Test
 453     public void testCreateWithDefaultParams4() {
 454         effect = new InnerShadow(10, 0, 0, Color.BLACK);
 455         setEffect(effect);
 456         assertEquals(10, effect.getRadius(), 1e-100);
 457         assertEquals(0, effect.getOffsetX(), 1e-100);
 458         assertEquals(0, effect.getOffsetY(), 1e-100);
 459         assertEquals(Color.BLACK, effect.getColor());
 460 
 461         // test that width and height changed appropriately
 462         assertEquals(21, effect.getHeight(), 1e-100);
 463         assertEquals(21, effect.getWidth(), 1e-100);
 464 
 465         pulse();
 466         
 467         assertEquals(10f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getRadius(), 1e-100);
 468         assertEquals(21f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 469         assertEquals(21f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 470         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getOffsetX(), 1e-100);
 471         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getOffsetY(), 1e-100);
 472 
 473         Color4f actual = ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getColor();
 474         assertColor4fEquals(black, actual);
 475     }
 476     
 477     @Test
 478     public void testCreateWithDefaultParams6() {
 479         effect = new InnerShadow(BlurType.THREE_PASS_BOX, Color.BLACK, 10, 0, 0, 0);
 480         setupTest(effect);
 481         assertEquals(0, effect.getOffsetX(), 1e-100);
 482         assertEquals(0, effect.getOffsetY(), 1e-100);
 483         assertEquals(10, effect.getRadius(), 1e-100);
 484         assertEquals(0, effect.getChoke(), 1e-100);
 485         assertEquals(Color.BLACK, effect.getColor());
 486         assertEquals(BlurType.THREE_PASS_BOX, effect.getBlurType());
 487         // test that width and height changed appropriately
 488         assertEquals(21, effect.getHeight(), 1e-100);
 489         assertEquals(21, effect.getWidth(), 1e-100);
 490         pulse();
 491         assertEquals(10f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianRadius(), 1e-100);
 492         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getChoke(), 1e-100);
 493         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getOffsetX(), 1e-100);
 494         assertEquals(0f, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getOffsetY(), 1e-100);
 495         assertEquals(ShadowMode.THREE_PASS_BOX, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getShadowMode());
 496         Color4f actual = ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getColor();
 497         assertColor4fEquals(black, actual);
 498     }
 499 
 500     @Test
 501     public void testHeightSynced() throws Exception {
 502         checkDoublePropertySynced(
 503                 "javafx.scene.effect.InnerShadow", "height",
 504                 "com.sun.scenario.effect.InnerShadow", "gaussianHeight", 9);
 505         assertEquals(7, effect.getRadius(), 1e-100);
 506     }
 507 
 508     @Test
 509     public void testWidthSynced() throws Exception {
 510         checkDoublePropertySynced(
 511                 "javafx.scene.effect.InnerShadow", "width",
 512                 "com.sun.scenario.effect.InnerShadow", "gaussianWidth", 9);
 513         assertEquals(7, effect.getRadius(), 1e-100);
 514     }
 515 
 516     @Test
 517     public void testBlurTypeSynced() throws Exception {
 518         checkObjectPropertySynced(
 519                 "javafx.scene.effect.InnerShadow", "blurType",
 520                 "com.sun.scenario.effect.InnerShadow", "shadowMode",
 521                 BlurType.TWO_PASS_BOX, ShadowMode.TWO_PASS_BOX,
 522                 BlurType.GAUSSIAN);
 523     }
 524 
 525     @Test
 526     public void testOffsetXSynced() throws Exception {
 527         checkDoublePropertySynced(
 528                 "javafx.scene.effect.InnerShadow", "offsetX",
 529                 "com.sun.scenario.effect.InnerShadow", "offsetX", 10);
 530     }
 531 
 532     @Test
 533     public void testOffsetYSynced() throws Exception {
 534         checkDoublePropertySynced(
 535                 "javafx.scene.effect.InnerShadow", "offsetY",
 536                 "com.sun.scenario.effect.InnerShadow", "offsetY", 10);
 537     }
 538 
 539     @Test
 540     public void testRadiusSynced() throws Exception {
 541         checkDoublePropertySynced(
 542                 "javafx.scene.effect.InnerShadow", "radius",
 543                 "com.sun.scenario.effect.InnerShadow", "radius", 4);
 544         assertEquals(9, effect.getHeight(), 1e-100);
 545         assertEquals(9, effect.getWidth(), 1e-100);
 546     }
 547 
 548     @Test
 549     public void testChokeSynced() throws Exception {
 550         checkDoublePropertySynced(
 551                 "javafx.scene.effect.InnerShadow", "choke",
 552                 "com.sun.scenario.effect.InnerShadow", "choke", 0.3);
 553     }
 554 
 555     @Test
 556     public void testInputSynced() throws Exception {
 557         BoxBlur blur = new BoxBlur();
 558         checkEffectPropertySynced(
 559                 "javafx.scene.effect.InnerShadow", "input",
 560                 "com.sun.scenario.effect.InnerShadow", "contentInput",
 561                 blur, (com.sun.scenario.effect.BoxBlur)blur.impl_getImpl());
 562     }
 563 
 564     @Test
 565     public void testColorSynced() throws Exception {
 566         Color4f result = (Color4f) getObjectPropertySynced(
 567                 "javafx.scene.effect.InnerShadow", "color",
 568                 "com.sun.scenario.effect.InnerShadow", "color",
 569                 Color.RED);
 570         assertColor4fEquals(red, result);
 571     }
 572 
 573     // test whether width/height are changing correctly if radius is bound
 574     // and one of them is changed
 575     @Test
 576     public void testRadiusBound() throws Exception {
 577         DoubleProperty boundRadius = new SimpleDoubleProperty();
 578 
 579         effect.radiusProperty().bind(boundRadius);
 580 
 581         boundRadius.set(4);
 582         effect.setWidth(9);
 583 
 584         assertEquals(9, effect.getHeight(), 1e-100);
 585         pulse();
 586         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 587         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 588         assertEquals(4, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianRadius(), 1e-100);
 589 
 590         effect.setHeight(3);
 591         assertEquals(15, effect.getWidth(), 1e-100);
 592         pulse();
 593         assertEquals(15, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 594     }
 595 
 596     // test whether width/radius are changing correctly if height is bound
 597     // and one of them is changed    
 598     @Test
 599     public void testHeightBound() throws Exception {
 600         DoubleProperty boundHeight = new SimpleDoubleProperty();
 601 
 602         effect.heightProperty().bind(boundHeight);
 603 
 604         boundHeight.set(9);
 605         effect.setRadius(4);
 606 
 607         assertEquals(9, effect.getWidth(), 1e-100);
 608         pulse();
 609         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 610         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 611         assertEquals(4, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianRadius(), 1e-100);
 612 
 613         effect.setWidth(3);
 614         assertEquals(2.5, effect.getRadius(), 1e-100);
 615     }
 616 
 617     // test whether height/radius are changing correctly if width is bound
 618     // and one of them is changed
 619     @Test
 620     public void testWidthBound() throws Exception {
 621         DoubleProperty boundWidth = new SimpleDoubleProperty();
 622 
 623         effect.widthProperty().bind(boundWidth);
 624 
 625         boundWidth.set(9);
 626         effect.setRadius(4);
 627 
 628         assertEquals(9, effect.getHeight(), 1e-100);
 629         pulse();
 630         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 631         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 632         assertEquals(4, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianRadius(), 1e-100);
 633 
 634         effect.setHeight(3);
 635         assertEquals(2.5, effect.getRadius(), 1e-100);
 636     }
 637 
 638     // Test for special cases when 2 of width, height, radius are bound
 639     @Test
 640     public void testRadiusWidthBound() throws Exception {
 641         DoubleProperty boundRadius = new SimpleDoubleProperty();
 642         DoubleProperty boundWidth = new SimpleDoubleProperty();
 643 
 644         effect.radiusProperty().bind(boundRadius);
 645         effect.widthProperty().bind(boundWidth);
 646 
 647         boundRadius.set(4);
 648         boundWidth.set(9);
 649 
 650         assertEquals(9, effect.getHeight(), 1e-100);
 651         pulse();
 652         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 653         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 654         assertEquals(4, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianRadius(), 1e-100);
 655 
 656         // set radius once again to be sure that the order of calls is not
 657         // important
 658         boundRadius.set(7);
 659         assertEquals(21, effect.getHeight(), 1e-100);
 660         pulse();
 661         assertEquals(21, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 662     }
 663 
 664     @Test
 665     public void testRadiusHeightBound() throws Exception {
 666         DoubleProperty boundRadius = new SimpleDoubleProperty();
 667         DoubleProperty boundHeight = new SimpleDoubleProperty();
 668 
 669         effect.radiusProperty().bind(boundRadius);
 670         effect.heightProperty().bind(boundHeight);
 671 
 672         boundRadius.set(4);
 673         boundHeight.set(9);
 674 
 675         assertEquals(9, effect.getWidth(), 1e-100);
 676         pulse();
 677         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 678         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 679         assertEquals(4, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianRadius(), 1e-100);
 680 
 681         boundRadius.set(7);
 682         assertEquals(21, effect.getWidth(), 1e-100);
 683         pulse();
 684         assertEquals(21, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 685     }
 686 
 687     @Test
 688     public void testWidthHeightBound() throws Exception {
 689         DoubleProperty boundWidth = new SimpleDoubleProperty();
 690         DoubleProperty boundHeight = new SimpleDoubleProperty();
 691 
 692         effect.widthProperty().bind(boundWidth);
 693         effect.heightProperty().bind(boundHeight);
 694 
 695         boundHeight.set(9);
 696         boundWidth.set(9);
 697 
 698         assertEquals(4, effect.getRadius(), 1e-100);
 699         pulse();
 700         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 701         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 702         assertEquals(4, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianRadius(), 1e-100);
 703 
 704         boundHeight.set(21);
 705         assertEquals(7, effect.getRadius(), 1e-100);
 706         pulse();
 707         assertEquals(7, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianRadius(), 1e-100);
 708     }
 709 
 710     // all radius, width and height are bound, radius is ignored in this case
 711     // just test that it doesn't end in infinite loop
 712     @Test
 713     public void testWidthHeightRadiusBound() {
 714         DoubleProperty boundWidth = new SimpleDoubleProperty();
 715         DoubleProperty boundHeight = new SimpleDoubleProperty();
 716         DoubleProperty boundRadius = new SimpleDoubleProperty();
 717 
 718         effect.widthProperty().bind(boundWidth);
 719         effect.heightProperty().bind(boundHeight);
 720         effect.radiusProperty().bind(boundRadius);
 721 
 722         boundHeight.set(9);
 723         boundWidth.set(9);
 724         boundRadius.set(5);
 725 
 726         pulse();
 727         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianHeight(), 1e-100);
 728         assertEquals(9, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianWidth(), 1e-100);
 729         assertEquals(4, ((com.sun.scenario.effect.InnerShadow) effect.impl_getImpl()).getGaussianRadius(), 1e-100);
 730     }
 731 
 732     @Test
 733     public void testBounds() {
 734         assertEquals(box(0, 0, 100, 100), n.getBoundsInLocal());
 735     }
 736 
 737     @Test
 738     public void testBoundsWidthInput() {
 739         assertEquals(box(0, 0, 100, 100), n.getBoundsInLocal());
 740         BoxBlur blur = new BoxBlur();
 741         effect.setInput(blur);
 742         assertEquals(box(-2, -2, 104, 104), n.getBoundsInLocal());
 743     }
 744 }