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