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 test.javafx.scene.effect;
  27 
  28 import javafx.scene.effect.PerspectiveTransform;
  29 import static org.junit.Assert.assertEquals;
  30 
  31 import org.junit.Before;
  32 import org.junit.Test;
  33 
  34 public class PerspectiveTransformTest extends EffectsTestBase {
  35     private PerspectiveTransform effect;
  36 
  37     @Before
  38     public void setUp() {
  39         effect = new PerspectiveTransform();
  40         setupTest(effect);
  41     }
  42 
  43     @Test
  44     public void testLlx() {
  45         // try setting correct value
  46         effect.setLlx(1.0f);
  47         assertEquals(1.0f, effect.getLlx(), 1e-100);
  48     }
  49 
  50     @Test
  51     public void testLly() {
  52         // try setting correct value
  53         effect.setLly(1.0f);
  54         assertEquals(1.0f, effect.getLly(), 1e-100);
  55     }
  56 
  57     @Test
  58     public void testLrx() {
  59         // try setting correct value
  60         effect.setLrx(1.0f);
  61         assertEquals(1.0f, effect.getLrx(), 1e-100);
  62     }
  63 
  64     @Test
  65     public void testLry() {
  66         // try setting correct value
  67         effect.setLry(1.0f);
  68         assertEquals(1.0f, effect.getLry(), 1e-100);
  69     }
  70 
  71     @Test
  72     public void testULx() {
  73         // try setting correct value
  74         effect.setUlx(1.0f);
  75         assertEquals(1.0f, effect.getUlx(), 1e-100);
  76     }
  77 
  78     @Test
  79     public void testUly() {
  80         // try setting correct value
  81         effect.setUly(1.0f);
  82         assertEquals(1.0f, effect.getUly(), 1e-100);
  83     }
  84 
  85     @Test
  86     public void testUrx() {
  87         // try setting correct value
  88         effect.setUrx(1.0f);
  89         assertEquals(1.0f, effect.getUrx(), 1e-100);
  90     }
  91 
  92     @Test
  93     public void testUry() {
  94         // try setting correct value
  95         effect.setUry(1.0f);
  96         assertEquals(1.0f, effect.getUry(), 1e-100);
  97     }
  98     
  99     @Test
 100     public void testCreateWithParams() {
 101         effect = new PerspectiveTransform(1, 2, 3, 4, 5, 6, 7, 8);
 102         setupTest(effect);
 103         assertEquals(1, effect.getUlx(), 1e-100);
 104         assertEquals(2, effect.getUly(), 1e-100);
 105         assertEquals(3, effect.getUrx(), 1e-100);
 106         assertEquals(4, effect.getUry(), 1e-100);
 107         assertEquals(5, effect.getLrx(), 1e-100);
 108         assertEquals(6, effect.getLry(), 1e-100);
 109         assertEquals(7, effect.getLlx(), 1e-100);
 110         assertEquals(8, effect.getLly(), 1e-100);
 111     }
 112 
 113     @Test
 114     public void testCreateWithDefaultParams() {
 115         effect = new PerspectiveTransform(0, 0, 0, 0, 0, 0, 0, 0);
 116         setupTest(effect);
 117         assertEquals(0, effect.getUlx(), 1e-100);
 118         assertEquals(0, effect.getUly(), 1e-100);
 119         assertEquals(0, effect.getUrx(), 1e-100);
 120         assertEquals(0, effect.getUry(), 1e-100);
 121         assertEquals(0, effect.getLrx(), 1e-100);
 122         assertEquals(0, effect.getLry(), 1e-100);
 123         assertEquals(0, effect.getLlx(), 1e-100);
 124         assertEquals(0, effect.getLly(), 1e-100);
 125     }
 126 }