< prev index next >
modules/graphics/src/test/java/test/com/sun/javafx/scene/transform/TransformUtilsTest.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -27,23 +27,23 @@
import test.com.sun.javafx.test.TransformHelper;
import javafx.scene.transform.Transform;
import com.sun.javafx.geom.transform.Affine3D;
import com.sun.javafx.scene.transform.TransformUtils;
-import com.sun.javafx.scene.transform.TransformUtilsShim;
import java.util.LinkedList;
import java.util.List;
+import javafx.scene.transform.TransformShim;
import test.javafx.scene.transform.TransformOperationsTest;
import javafx.scene.transform.Translate;
import static org.junit.Assert.*;
import org.junit.Test;
public class TransformUtilsTest {
@Test
public void shouldCreateCorrectImmutableTransform() {
- Transform t = TransformUtilsShim.getImmutableTransform(
+ Transform t = TransformShim.getImmutableTransform(
1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12);
TransformHelper.assertMatrix(t,
@@ -55,26 +55,26 @@
@Test
public void immutableTransformShouldApplyCorrectly() {
Affine3D a = new Affine3D();
a.translate(10, 20);
- Transform t = TransformUtilsShim.getImmutableTransform(
+ Transform t = TransformShim.getImmutableTransform(
1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12);
- t.impl_apply(a);
+ com.sun.javafx.scene.transform.TransformHelper.apply(t,a);
TransformHelper.assertMatrix(a,
1, 2, 3, 14,
5, 6, 7, 28,
9, 10, 11, 12);
}
@Test
public void immutableTransformShouldCopyCorrectly() {
- Transform src = TransformUtilsShim.getImmutableTransform(
+ Transform src = TransformShim.getImmutableTransform(
1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12);
Transform t = src.clone();
@@ -84,11 +84,11 @@
5, 6, 7, 8,
9, 10, 11, 12);
}
@Test public void testImmutableTransformToString() {
- Transform trans = TransformUtilsShim.getImmutableTransform(
+ Transform trans = TransformShim.getImmutableTransform(
1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12);
String s = trans.toString();
@@ -99,27 +99,27 @@
@Test public void testImmutableTransformState() {
int counter = 0;
for (Object o : TransformOperationsTest.getParams()) {
Object[] arr = (Object[]) o;
- if (arr[0] instanceof TransformUtilsShim.ImmutableTransformShim) {
- TransformUtilsShim.ImmutableTransformShim t =
- (TransformUtilsShim.ImmutableTransformShim) arr[0];
+ if (arr[0] instanceof TransformShim.ImmutableTransformShim) {
+ TransformShim.ImmutableTransformShim t =
+ (TransformShim.ImmutableTransformShim) arr[0];
TransformHelper.assertStateOk("Checking state of transform #" +
(counter++) + " of TransformOperationsTest", t,
- TransformUtilsShim.getImmutableState3d(t),
- TransformUtilsShim.getImmutableState2d(t));
+ TransformShim.getImmutableState3d(t),
+ TransformShim.getImmutableState2d(t));
}
}
}
@Test public void testReusedImmutableTransform() {
int counter = 0;
for (Object o : TransformOperationsTest.getParams()) {
Object[] arr = (Object[]) o;
- if (arr[0] instanceof TransformUtilsShim.ImmutableTransformShim) {
+ if (arr[0] instanceof TransformShim.ImmutableTransformShim) {
Transform t = (Transform) arr[0];
// reusing
@@ -133,12 +133,12 @@
TransformHelper.assertStateOk(
"Checking reusing immutable transform to values of #"
+ counter + " of TransformOperationsTest",
returned,
- (TransformUtilsShim.getImmutableState3d(returned)),
- (TransformUtilsShim.getImmutableState2d(returned)));
+ (TransformShim.getImmutableState3d(returned)),
+ (TransformShim.getImmutableState2d(returned)));
TransformHelper.assertMatrix("Checking reusing immutable "
+ "transform to values of #" + counter
+ " of TransformOperationsTest", returned, t);
@@ -150,12 +150,12 @@
TransformHelper.assertStateOk(
"Checking reusing immutable transform to values of #"
+ counter + " of TransformOperationsTest",
returned2,
- TransformUtilsShim.getImmutableState3d(returned),
- TransformUtilsShim.getImmutableState2d(returned));
+ TransformShim.getImmutableState3d(returned),
+ TransformShim.getImmutableState2d(returned));
TransformHelper.assertMatrix("Checking reusing immutable "
+ "transform to values of #" + counter
+ " of TransformOperationsTest", returned2, t);
@@ -164,25 +164,25 @@
}
}
@Test public void testConcatenatedImmutableTransform() {
- List<TransformUtilsShim.ImmutableTransformShim> ts = new LinkedList<>();
+ List<TransformShim.ImmutableTransformShim> ts = new LinkedList<>();
for (Object o : TransformOperationsTest.getParams()) {
Object[] arr = (Object[]) o;
- if (arr[0] instanceof TransformUtilsShim.ImmutableTransformShim) {
- ts.add((TransformUtilsShim.ImmutableTransformShim) arr[0]);
+ if (arr[0] instanceof TransformShim.ImmutableTransformShim) {
+ ts.add((TransformShim.ImmutableTransformShim) arr[0]);
}
}
int outer = 0;
- for (TransformUtilsShim.ImmutableTransformShim t1 : ts) {
+ for (TransformShim.ImmutableTransformShim t1 : ts) {
int inner = 0;
- for (TransformUtilsShim.ImmutableTransformShim t2 : ts) {
+ for (TransformShim.ImmutableTransformShim t2 : ts) {
int orig = 0;
// reusing
- for (TransformUtilsShim.ImmutableTransformShim t3 : ts) {
+ for (TransformShim.ImmutableTransformShim t3 : ts) {
Transform clone = t3.clone();
Transform conc = TransformUtils.immutableTransform(
clone, t1, t2);
assertSame("Checking state of concatenation of "
@@ -192,13 +192,13 @@
TransformHelper.assertStateOk(
"Checking state of concatenation of "
+ "transform #" + outer + " and #" + inner +
" reusing #" + orig +
" of TransformOperationsTest",
- (TransformUtilsShim.ImmutableTransformShim) conc,
- TransformUtilsShim.getImmutableState3d(conc),
- TransformUtilsShim.getImmutableState2d(conc));
+ (TransformShim.ImmutableTransformShim) conc,
+ TransformShim.getImmutableState3d(conc),
+ TransformShim.getImmutableState2d(conc));
TransformHelper.assertMatrix(
"Checking state of concatenation of "
+ "transform #" + outer + " and #" + inner +
" reusing #" + orig +
" of TransformOperationsTest", conc,
@@ -218,13 +218,13 @@
" of TransformOperationsTest", conc2, t2);
TransformHelper.assertStateOk(
"Checking state of concatenation of "
+ "transform #" + outer + " and #" + inner +
" of TransformOperationsTest",
- (TransformUtilsShim.ImmutableTransformShim) conc2,
- TransformUtilsShim.getImmutableState3d(conc2),
- TransformUtilsShim.getImmutableState2d(conc2));
+ (TransformShim.ImmutableTransformShim) conc2,
+ TransformShim.getImmutableState3d(conc2),
+ TransformShim.getImmutableState2d(conc2));
TransformHelper.assertMatrix(
"Checking state of concatenation of "
+ "transform #" + outer + " and #" + inner +
" of TransformOperationsTest", conc2,
TransformHelper.concatenate(t1, t2));
< prev index next >