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

Print this page
rev 6167 : RT-35330 [Monocle] Remove StubToolkit and replace it with headless glass implementation


   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 com.sun.scenario.effect.Color4f;
  30 import static org.junit.Assert.assertEquals;
  31 import static org.junit.Assert.assertNotNull;
  32 import static org.junit.Assert.assertNull;
  33 import static org.junit.Assert.assertTrue;
  34 import static org.junit.Assert.fail;
  35 import javafx.beans.property.ObjectProperty;
  36 import javafx.beans.property.SimpleObjectProperty;
  37 import javafx.scene.paint.Color;
  38 
  39 import org.junit.Before;

  40 import org.junit.Test;
  41 
  42 public class LightingTest extends EffectsTestBase {




  43     private Lighting effect;
  44 
  45     @Before
  46     public void setUp() {
  47         effect = new Lighting();
  48         setupTest(effect);
  49     }
  50 
  51     @Test
  52     public void testSetDiffuseConstant() {
  53         // try setting correct value
  54         effect.setDiffuseConstant(1.1f);
  55         assertEquals(1.1f, (float) effect.getDiffuseConstant(), 1e-100);
  56         pulse();
  57         assertEquals(1.1f, (float) ((com.sun.scenario.effect.PhongLighting) effect.impl_getImpl()).getDiffuseConstant(), 1e-100);
  58     }
  59 
  60     @Test
  61     public void testDefaultDiffuseConstant() {
  62         // default value should be 1




   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 
  30 import com.sun.javafx.FXUnit;
  31 import com.sun.scenario.effect.Color4f;
  32 import static org.junit.Assert.assertEquals;
  33 import static org.junit.Assert.assertNotNull;
  34 import static org.junit.Assert.assertNull;
  35 import static org.junit.Assert.assertTrue;
  36 import static org.junit.Assert.fail;
  37 import javafx.beans.property.ObjectProperty;
  38 import javafx.beans.property.SimpleObjectProperty;
  39 import javafx.scene.paint.Color;
  40 
  41 import org.junit.Before;
  42 import org.junit.Rule;
  43 import org.junit.Test;
  44 
  45 public class LightingTest extends EffectsTestBase {
  46 
  47     @Rule
  48     public FXUnit fx = new FXUnit();
  49 
  50     private Lighting effect;
  51 
  52     @Before
  53     public void setUp() {
  54         effect = new Lighting();
  55         setupTest(effect);
  56     }
  57 
  58     @Test
  59     public void testSetDiffuseConstant() {
  60         // try setting correct value
  61         effect.setDiffuseConstant(1.1f);
  62         assertEquals(1.1f, (float) effect.getDiffuseConstant(), 1e-100);
  63         pulse();
  64         assertEquals(1.1f, (float) ((com.sun.scenario.effect.PhongLighting) effect.impl_getImpl()).getDiffuseConstant(), 1e-100);
  65     }
  66 
  67     @Test
  68     public void testDefaultDiffuseConstant() {
  69         // default value should be 1