modules/graphics/src/test/java/test/javafx/scene/transform/TranslateTest.java

Print this page
rev 9250 : 8134762: Refactor Javafx graphics module tests for clear separation of tests
Reviewed-by:


   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.transform;
  27 
  28 import static javafx.scene.transform.TransformTest.assertTx;
  29 import javafx.scene.shape.Rectangle;
  30 
  31 import org.junit.Assert;
  32 import org.junit.Test;
  33 import static org.junit.Assert.*;
  34 
  35 import com.sun.javafx.test.TransformHelper;
  36 import com.sun.javafx.geom.transform.BaseTransform;


  37 
  38 
  39 public class TranslateTest {
  40 
  41     @Test
  42     public void testTranslate() {
  43         final Translate trans = new Translate() {{
  44             setX(25);
  45             setY(52);
  46         }};
  47         final Rectangle n = new Rectangle();
  48         n.getTransforms().add(trans);
  49 
  50         assertTx(n, BaseTransform.getTranslateInstance(25, 52));
  51         TransformHelper.assertMatrix(trans,
  52                 1, 0, 0, 25,
  53                 0, 1, 0, 52,
  54                 0, 0, 1,  0);
  55 
  56         trans.setX(34);




   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.transform;
  27 
  28 import static test.javafx.scene.transform.TransformTest.assertTx;
  29 import javafx.scene.shape.Rectangle;
  30 
  31 import org.junit.Assert;
  32 import org.junit.Test;
  33 import static org.junit.Assert.*;
  34 
  35 import test.com.sun.javafx.test.TransformHelper;
  36 import com.sun.javafx.geom.transform.BaseTransform;
  37 import javafx.scene.transform.Transform;
  38 import javafx.scene.transform.Translate;
  39 
  40 
  41 public class TranslateTest {
  42 
  43     @Test
  44     public void testTranslate() {
  45         final Translate trans = new Translate() {{
  46             setX(25);
  47             setY(52);
  48         }};
  49         final Rectangle n = new Rectangle();
  50         n.getTransforms().add(trans);
  51 
  52         assertTx(n, BaseTransform.getTranslateInstance(25, 52));
  53         TransformHelper.assertMatrix(trans,
  54                 1, 0, 0, 25,
  55                 0, 1, 0, 52,
  56                 0, 0, 1,  0);
  57 
  58         trans.setX(34);