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